Preview to fit on the screen

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Preview to fit on the screen

Postby Bengt » Thu Nov 10, 2016 10:44 am

When a document is previewed with

Send DoVpePreviewDoc VPE_SHOW_NORMAL

a preview window twice as wide as it is high is shown and only the upper part of an A4 is shown in that window. I would like to show more or less a whole A4 page by default, and I tried to do that with the statement

Send DoVpePreviewDocSP 50 200 950 700 VPE_SHOW_NORMAL

This looks good on the screen resolution I normally use on my computer, but when moving the program to other computers with lower resolution, the preview doesn’t fit on the screen.

Is there a way to get the preview automatically fit on the screen? Is there such a function in VPE or is it necessary to in some other way retrieve the screen resolution and adjust the parameters in the Send DoVpePreviewDocSP statement?

Bengt
Bengt
 
Posts: 89
Joined: Fri Jan 27, 2006 5:29 pm

Re: Preview to fit on the screen

Postby IDEAL Software Support » Fri Nov 11, 2016 1:02 pm

You can either use VPE_SHOW_MAXIMIZED as parameter for VpePreviewDoc(), or you need to retrieve yourself the screen resolution and provide the desired position and dimensions of the preview using the positional parameters.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: Preview to fit on the screen

Postby Bengt » Fri Nov 11, 2016 1:40 pm

When using VPE_SHOW_MAXIMIZED as parameter for VpePreviewDoc(), the preview covers the whole screen which I don't want.

It works with Send DoVpePreviewDocSP and adjusting the parameters according to screen resolution, but as I use VPE4VDF from StarZen, VpePreviewDoc() is often called from StarZen classes, and changing them get other consequences. It would be much better if it would be possible to change the size of the window used by Send DoVpePreviewDoc VPE_SHOW_NORMAL.

In VPE DLLReference documentation for VpePreviewDoc, I find

void VpePreviewDoc(
VpeHandle hDoc,
RECT *rc,
int show_hide
)

VpeHandle hDoc
Document Handle

RECT *rc
position of the preview window in pixels, if it is NULL, it is ignored. For use with interpreter
languages, you can set rc.right = -1 then it is also ignored.

However I don't understand how RECT is supposed to be used. Is that a possibility to specify position and size of the preview window.

Bengt
Bengt
 
Posts: 89
Joined: Fri Jan 27, 2006 5:29 pm

Re: Preview to fit on the screen

Postby IDEAL Software Support » Mon Nov 14, 2016 2:23 pm

VpePreviewDocSP() is provided, because some programming languages - especially interpreted languages - can not handle the RECT data type.

Internally, VpePreviewDocSP() calls VpePreviewDoc(). So with Dataflex, use VpePreviewDocSP(). Provide the desired coordinates and use VPE_SHOW_NORMAL. This way you can specify the position and dimensions of the preview window.

Hint: If you set rc.right = -1 (or x2 = -1 when using VpePreviewDocSP()), the positional parameters are ignored. This is useful, if you did hide the preview and want to make it visible again at the last position. For VPE_SHOW_MAXIMIZED the positional parameters are always ignored.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 16 guests

cron