Copy link to clipboard
Copied
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.
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
...Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
In the action, you can prompt user and pop open the initial view dialog.
Copy link to clipboard
Copied
No, JS has no access to this information.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now