Copy link to clipboard
Copied
I have a pdf doc that when the user clicks a button, the document scales and scrolls both vertically and horizontally to a certain point inside the pdf. I need to get the user's Preference>Page Display> Resolution to ensure the user is navigated to the correct point in the pdf. How do i get that property using Javascript?
While this property is not directly available, there are some things you can do to find the resolution.
Here are the steps for a script to follow.
1. save the current viewState:
var vsOrig = this.viewState.toSource();
2. Set the zoom type to FitH. Save the zoom level.
3. Set the zoom type to FitV. Save the zoom level.
4. Reset the viewSate.
this.viewState = eval(vsOrig);
Now you have proportionality factors between the current zoom and the full width and height of the document. This g
...Copy link to clipboard
Copied
You can't access this property with Javascript.
Copy link to clipboard
Copied
While this property is not directly available, there are some things you can do to find the resolution.
Here are the steps for a script to follow.
1. save the current viewState:
var vsOrig = this.viewState.toSource();
2. Set the zoom type to FitH. Save the zoom level.
3. Set the zoom type to FitV. Save the zoom level.
4. Reset the viewSate.
this.viewState = eval(vsOrig);
Now you have proportionality factors between the current zoom and the full width and height of the document. This gives you enough information to calculate the portion of a document page being shown so you can set the page offsets (scroll) exactly.
Its all worked out, calculations and the code, here (but it's only available to site members):
Scripts for Navigating to a specific document location