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

javascript to insert pdf via windows prompt

Tim Klahr
Registered: Feb 7 2011
Posts: 12

All,
 
Is there a menu item command to make the "insert pages > from file" dialog box pop up? I want users to be able to click a button to attach a pdf to the current pdf, and I do not want to use something like this.insertPages, because I want them to have full control over the pdf they choose.
 
Thanks,
 
Tim

My Product Information:
Acrobat Pro 9.0, Windows
Kelly McCathran
Registered: Feb 9 2010
Posts: 38
Tim,

Try adding a button, in Actions select Execute a Menu Item, from the list choose Document > Insert Pages...That should do the trick.

Kelly McCathran
Adobe Certified Instructor
Adobe User Group Manager (http://creativesuitelovers.com)
Certified Technical Trainer+

UVSAR
Expert
Registered: Oct 29 2008
Posts: 1357
If your users are viewing the file in Adobe Reader, you can't do that. Inserting pages is an Acrobat-only function, and is *not* the same as creating an attachment.

Neither will it work in Acrobat X, as there is no "Document" menu. Distributed scripts are advised never to use direct references to menu items if the client version is unknown.

To script the creation of a file attachment, use this.importDataObject() - see the example in the Acrobat JavaScript SDK.
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You have a number of problems here. As UVSAR points out Reader cannot insert pages into a PDF and menu items are for the most part unusable in Reader, so unless all your users have Acrobat Pro this methodology is a non-starter.
Better to go with File attachments, however, file attachments are a protected feature in Acrobat that requires special PDF enabling to work in Reader. So again, unless your users have Acrobat Pro your stuck.

But there is trick for allowing users with Reader to do file attachments, and that is to add a button that runs a script to add a "File Attachment" annotation to the PDF. Then enable the PDF for commenting in Reader. I haven't tried this method on Reader X, but it used to work in previous versions.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Kelly McCathran
Registered: Feb 9 2010
Posts: 38
Thom & Dave,Excellent points both, thank you for the follow up! I answered his question for Acrobat 9 (since he's running that), but hadn't thought to check the same in 10. Looks like I'll have to recommend a script going forward (especially keeping in mind Reader).

Kelly McCathran
Adobe Certified Instructor
Adobe User Group Manager (http://creativesuitelovers.com)
Certified Technical Trainer+