These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Change "Documents Properties - Intial View" by JS

oald
Registered: Oct 12 2011
Posts: 17

Hi,

I want to change the "Documents Properties - Intial View" of multiple documents to:

Navigation tab: Bookmarks Panel and Page
Page layout: Default
Magnification: Default
Open to page: 1

I wonder if JavaScript can do this, your help and guidance are really appreciated!

My Product Information:
Acrobat Pro 8.1.6, Windows
try67
Online
Expert
Registered: Oct 30 2008
Posts: 2398
You don't need JS. One of the commands in the Batch Sequences options can do this by itself. It's called "Open Options".

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

oald
Registered: Oct 12 2011
Posts: 17
Hi try67, thanks for your prompt reply! I know that batch sequences can do this, but as I want to realize 2 more functions which can be done by JavaScript (I have completed the coding), if "Documents Properties - Intial View" setting can also be reset by JavaScript, I can include the 3 functions and serve as a tool to handle multiple documents.

Your help is really appreciated!
try67
Online
Expert
Registered: Oct 30 2008
Posts: 2398
You can add multiple commands to the same batch process. So first use "Open Options" and then an "Execute a JavaScript" command.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

oald
Registered: Oct 12 2011
Posts: 17
Hi try67, thanks for your update, actually I want to do is:

For documents more than one page:
Navigation tab: Bookmarks Panel and Page
Page layout: Default
Magnification: Default
Open to page: 1

For documents with only one page:
Navigation tab: Page Only
Page layout: Default
Magnification: Default
Open to page: 1

But I don't know how to do this by JavaScript, can you advise? Thanks a lot!

if this.numPages == 1
{
...
}
else{
...
}






radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

to show the Pages pane you can use:
this.viewState = {overViewMode:2};
For the Bookmark pane use:
this.viewState = {overViewMode:3};
To hide all panes use:
this.viewState = {overViewMode:5};
For the attachment pane use:
this.viewState = {overViewMode:7};
To use the single page layout:
this.viewState = {pageViewLayoutMode:1};
Here's an example I made for XFA forms. But it should olso work for AcroForms.
You only need to change the scripts containing "event.target...." into "this...."
http://thelivecycle.blogspot.com/2010/04/xfa-form-control-view-settings.php

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

oald
Registered: Oct 12 2011
Posts: 17
Hi radzmar, thanks for your reply! I try your codes but they can only change the current view state, I want to change the setting in "File - Properties - Initial View", can you advise further? Thanks a lot!
try67
Online
Expert
Registered: Oct 30 2008
Posts: 2398
You can't change those settings directly with a script. What you can do is use the code provided and embed it into the file, so that it executed when the file is opened.
You can use the addScript method to do that.

By the way, for the layout I would use this:
this.layout = "SinglePage";

To go to the first page, use this:
this.pageNum = 0;

For the zoom setting, you can use this:
this.zoomType = zoomtype.none;

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com