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

Initial page in Open Options

Advocate ,
Jun 23, 2017 Jun 23, 2017

Is there a way, via javascript, to determine (and change) the initial page that is set in the Open Options for a document?

I have a script which does a lot of processing of PDF files, and if the initial page is not set to the first page in the open options, I would like to alert the user, and give the option of changing it if needed.

TOPICS
Acrobat SDK and JavaScript
1.2K
Translate
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 , Jun 23, 2017 Jun 23, 2017

You can't change the initial page setting in the PDF via JavaScript. However, you can detect what page the PDF is on when it opens and then alert the user if it's not the first page and allow them to override it. At that point you have a few choices. If you want the PDF to always override the initial view settings, then you'd add a hidden field to the document and store the user selection there. If you want the override to be user specific, then you'd store the selection in the global object.

You

...
Translate
Community Expert ,
Jun 23, 2017 Jun 23, 2017

You can't change the initial page setting in the PDF via JavaScript. However, you can detect what page the PDF is on when it opens and then alert the user if it's not the first page and allow them to override it. At that point you have a few choices. If you want the PDF to always override the initial view settings, then you'd add a hidden field to the document and store the user selection there. If you want the override to be user specific, then you'd store the selection in the global object.

Your script would look for the setting. If not found, give the user the option to "change" it. If it is found, jump to the first page.

If either of those sounds reasonable, I can provide further help.

Translate
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
Advocate ,
Jun 23, 2017 Jun 23, 2017

Thanks, I was afraid of that.

I'm not looking for a script to add within the document, just wanted to be able to let the user know if this document wasn't set to open to page 1. This script resides in an action that is run to do some final checks and processing on these documents to finalize them before they are distributed. Usually, they should be set to the first page, but if it's not, I'd like the user to know so they can determine if there is a reason for this, or it needs to be changed.

Thanks for the info.

Translate
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 ,
Jun 23, 2017 Jun 23, 2017

Ok - in that case, I'd create an Acrobat Action something like the "Prepare for Distribution" that uses the action "Document Processing" -> "Set Open Options" first and then "More Tools" -> "Execute JavaScript" for the rest of your checks. Actions can chain processing steps. If the document was set to either the default or already set to page 1, the open options don't really change anything so it doesn't matter what the original setting was.

Translate
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
Advocate ,
Jun 23, 2017 Jun 23, 2017

I don't want to set the value without verifying it with the person running the action. There may be cases where the initial page is not the first page, and I don't want to override it without verification first.

Translate
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 ,
Jun 23, 2017 Jun 23, 2017
LATEST

In the action, you can prompt user and pop open the initial view dialog.

Translate
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 ,
Jun 23, 2017 Jun 23, 2017

No, JS has no access to this information.

Translate
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