• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Getting Preferences>Page Display>Resolution using Javascript

New Here ,
Feb 26, 2019 Feb 26, 2019

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?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

380

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 26, 2019 Feb 26, 2019

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

...

Votes

Translate

Translate
Community Expert ,
Feb 26, 2019 Feb 26, 2019

Copy link to clipboard

Copied

You can't access this property with Javascript.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 26, 2019 Feb 26, 2019

Copy link to clipboard

Copied

LATEST

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

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines