Skip to main content
Known Participant
November 15, 2021
Question

PDF JavaScript 'app.execMenuItem("ZoomViewOut")' not working as document level script

  • November 15, 2021
  • 2 replies
  • 982 views

I put the line

app.execMenuItem("ZoomViewOut");

into my PDF document's JavaScript section like this:



It turns up in the general JavaScript section like this:

//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------

//<Document-Level>
//<ACRO_source>Zoom Out</ACRO_source>
//<ACRO_script>
/*********** belongs to: Document-Level:Zoom Out ***********/
app.execMenuItem("ZoomViewOut");
//</ACRO_script>
//</Document-Level>

 

But it is not executed. Instead, it throws a "bad parameter" error:


I believe however that it should work, since the command is in the safe commands list:

 

...as described in the Adobe JavaScript Reference Manual on p. 93:

 

So how can I execute 'app.execMenuItem("ZoomViewOut")' every time my PDF document is opened?

This topic has been closed for replies.

2 replies

try67
Community Expert
Community Expert
November 16, 2021

Try moving it to the Page Open event of page 1.

try67
Community Expert
Community Expert
November 16, 2021

Also, this not a very good way of setting the default zoom of a document. Why not use the Initial View options (under File - Properties) to set the desired zoom level to what you want it to be?

Legend
November 15, 2021

Surely the document level scripts are executed before the document is displayed, so it is too early for navigation?