Hot to get the Zoom Mangification string

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Hot to get the Zoom Mangification string

Post by DSSavant »

Real simple, I need something that tells me that the current page zoom level is "FitWidth" or "FitPage" or ...

The following will only give me the numeric zoom level:

DoVerb("Documents[#4095].Pages.Zoom", "get", null, myOut, 0); Returns 54 when it is FitWidth.
DoVerb("Documents[#4095].Pages.Zoom", "get", null, myOut, PXCVA_Flags.PXCVA_GetNamed); Returns 54 when it is FitWidth.

So what am I missing here?
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Hot to get the Zoom Mangification string

Post by Vasyl - PDF-XChange »

Hi, DSSavant.

You may use:

Code: Select all

DoVerb("Documents[#4095].Pages.Zoom", "getNamed", null, myOut, 0);
or:

Code: Select all

GetProperty("Documents[#4095].Pages.Zoom", myOut, PXCVA_Flags.PXCVA_GetNamed);
The code:
DoVerb("Documents[#4095].Pages.Zoom", "get", null, myOut, PXCVA_Flags.PXCVA_GetNamed);
- does not work in your case because "get" operation have greater priority and PXCVA_GetNamed flag is ignored.

HTH
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Hot to get the Zoom Mangification string

Post by DSSavant »

Neither of the commands you suggest will return back "FitWidth" after the viewer has been told to specifically "FitWidth".

When executing the DoVerb to set the zoom level:

Viewer.DoVerb("Documents[#4095].Pages.Zoom", "set", (object)"FitWidth", out myout, 0);

myout will equal "FitWidth" simply because that is what was passed in. If you then call the following:

Viewer.DoVerb("Documents[#4095].Pages.Zoom", "getNamed", null, out myout, 0);

say after an event notification that the zoom level has changed, myout will equal the numeric value of "FitWidth" for the specific page. In my case it will equal "51%". I need a command that gives me the enumeration value for FitWidth or the string "FitWidth". If I view another page and it is landscape, then my view % will not be the same and therefore I will not be able to tell if 51% is truly "FitWidth".

I need this so that I can keep my menu's and toolbar buttons in sync with the viewer at all times. Put another way, I want my menus and toolbar buttons to be set based upon events being fired from the viewer. This way, I will always know they are set correctly. Compare this with setting them during the button or menu click events.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2448
Joined: Thu Jun 30, 2005 4:11 pm

Re: Hot to get the Zoom Mangification string

Post by Vasyl - PDF-XChange »

Hi, DSSavant.

Sorry but I was mistaken some in my previous post.
For obtain actual zoom level you should call:

Code: Select all

DoVerb("Documents[#4095].Pages.Zoom", "get", null, myOut, 0);
after this myOut will contain floated number which represents number of percents, or with "getNamed" - text like as "120%".
For obtain actual zoom mode:

Code: Select all

DoVerb("Documents[#4095].Pages.ZoomMode", "get", null, myOut, 0);
after this myOut will contain int. number(or string with "getNamed") which represents:
0 - "Percent"
1 - "ActualSize"
2 - "FitWidth"
3 - "FitPage"
The "ZoomMode" is read only property. Will be described in the next build.
Remark: you may use the "Zoom" property for setup any zoom level or any predefined zoom mode(as described in the Help already):

Code: Select all

DoVerb("Documents[#4095].Pages.Zoom", "set", "FitWidth", null, 0);
HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Hot to get the Zoom Mangification string

Post by DSSavant »

Perfect, thanks!
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19913
Joined: Mon Jan 12, 2009 8:07 am

Re: Hot to get the Zoom Mangification string

Post by Stefan - PDF-XChange »

:)