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

PopUp Menue to open additional (pdf) files

Harry2908
Registered: May 12 2010
Posts: 3

Hi there!
I´m looking for a (javascript) popup menue to open other (pdf) files and place it into a new window.
I work with this script:

// Declare pop-up menu properties as an array.
var aParams = [
{cName: "Adobe Web Page", cReturn: "www.adobe.com"},
{cName: "-"},
{cName: "Second Page",
cReturn: "index/page-2.pdf"},
{cName: "Third Page",
cReturn: "index/page-3.pdf"}
];
// Apply the function app.popUpMenuEx to the app object, with an array
// of parameters aParams
var cChoice = app.popUpMenuEx.apply( app, aParams );
if ( cChoice != null ) app.launchURL(cChoice);

It works fine so far, but it opens the new pdf-file in the web-browser. It should be opened within the Acrobat Reader application.

Has anyone an idea?

Thanks for answering!!!

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
The description for 'launchURL' from Acrobat JS API Reference:

"Launches a URL in a browser window."

Have you looked at the 'openDoc' method:

"Opens a specified PDF document and returns its Doc object. This object can be used by the script to call methods, or to get or set properties in the newly opened document."

George Kaiser

Harry2908
Registered: May 12 2010
Posts: 3
Thank you for your help.
It worked out fine.

Here is the final script of the poup menue for anyone who needs it:

// Declare pop-up menu properties as an array.
var aParams = [
{cName: "Text 1",
cReturn: "docs/my.pdf"},
{cName: "Text 2",
cReturn: "docs/my.pdf"},
{cName: "-"},
{cName: "HEADLINE 2"},
{cName: "• Item 1", oSubMenu:
[ {cName: "Item 1 A",
cReturn: "docs/my.pdf"},
{cName: "Item 1 B",
cReturn: "docs/my.pdf"}
]
},
{cName: "• Item 2", oSubMenu:
[ {cName: "Item 2" A",
cReturn: "docs/my.pdf"},
{cName: "Item 2" B",
cReturn: "docs/my.pdf"}
]
},
{cName: "• Item 3", oSubMenu:
[ {cName: "Item 3 A",
cReturn: "docs/my.pdf"},
{cName: "Item 3 B",
cReturn: "docs/my.pdf"}
]
},
{cName: "• Item 4", oSubMenu:
[ {cName: "Item 4 A",
cReturn: "docs/my.pdf"},
{cName: "Item 4 B",
cReturn: "docs/my.pdf"}
]
},
{cName: "-"},
{cName: "HEADLINE 3"},
{cName: "• Document A",
cReturn: "docs/my.pdf"},
{cName: "-"},
{cName: "HEADLINE 4"},
{cName: "• Document B",
cReturn: "docs/my.pdf"},
{cName: "-"}
]
// Apply the function app.popUpMenuEx to the app object, with an array
// of parameters aParams
var cChoice = app.popUpMenuEx.apply( app, aParams );
if ( cChoice != null ) app.openDoc(cChoice, this);

Greets!
Harry