Frequently Asked Question:
How do you set Initial View Magnification using QuickPDF?
I saw functionality for setting Layout and Mode, but cannot find any for setting Magnification. (except for the Outline Zoom function, but that's just for the bookmark)
I did see that adjusting magnification is an advertised capability of QuickPDF.
Could anyone point me to the function that allows this?
The PDF specification doesn't have a simple document setting that specifies the initial page number and zoom magnification.
However it is possible to add an "open action" to the document that specifies the action to perform when the document is opened.
Quick PDF Library's SetOpenActionDestination function allows you to set the initial page and the zoom level:
// Create a two page document with the
// page number shown on each page
QP.NewDocument();
QP.DrawText(100, 500, "Page 1");
QP.NewPage();
QP.DrawText(100, 500, "Page 2");
// Set the page layout to "Single page". This step isn't needed but
// shows the zoom effect nicely
QP.SetPageLayout(0);
// Set the open action to show page 2 at 25% zoom
QP.SetOpenActionDestination(2, 25);
// Save the file
QP.SaveToFile("C:\docs\Page2-Zoom25.pdf");
There are two other functions that allow greater control of the open action.
The SetOpenActionDestinationFull
function allows you to set the initial page and specify advanced sizing/positioning options.
A JavaScript open action can be added using the SetOpenActionJavaScript
function. For this to work the user must have JavaScript enabled in their PDF viewer.