Link to home
Start Free TrialLog in
Avatar of TechMan4Ever
TechMan4Ever

asked on

Insert a page in Adobe Acrobat 11 Pro

Hi,

I'm trying to create a custom java-script in Adobe Acrobat Pro 11.
=======================
this.insertPages(
{
nPage: this.numPages-1,
cPath: "C:\Program Files (x86)\Adobe\Acrobat 11.0\Acrobat\TabDoc.pdf"
});
=================
I found some examples of the code but it does not always work, once I press it, it works once but when you try again, it does not.

I want to have a one page PDF file that gets inserted after the current page that user is looking at. How can I program that so it does it continuously.  User can insert the same page into various spots in the same document. I would also need error handling, etc.

Any assistance is greatly appreciated.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Karl Heinz Kremer
Karl Heinz Kremer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TechMan4Ever
TechMan4Ever

ASKER

That worked, thank you for your help... is there a way when you create the action and every time I have to press start script, is there a way to just have it run once I press the action?

Thanks.
Ah, I did not know that you are running this in an Action. You can create a menu item in Acrobat (or a tool button) that would execute your insert page function. Take a look at the app.addMenuItem() method:

http://help.adobe.com/livedocs/acrobat_sdk/11/Acrobat11_HTMLHelp/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Acrobat11_HTMLHelp&file=JS_API_AcroJS.89.137.html
Thank you Karl,

I did read the article and it provides quite a bit of info. One more question, I'm new to Adobe Acrobat Pro scripting/automation but not new to programming, scripting. I'm very proficient with MS Word, etc. Can you give me a bit of quick guide, where would I put this code? Is there a start up file (line normal.dotx in word) or is there something equivalent, where I can add the code, or is this on a file level..etc.) I want to have a button, on the side menu and preferably on the top (quick tools menu). I want to have a button in both if possible that once I click on it, it will add a new page (as per previously provided code), no user interaction, just press the button, it adds a page after current page, press it again, it adds again. Simple one click kind of solution. Would you be able to provide me with some pointers?

Thank you and have a good one!
You would create a "folder level" script that gets executed whenever Acrobat starts. Take a look at this blog post I wrote a while ago about where these files need to be stored: http://khkonsulting.com/2010/12/acrobat-javascripts-where-do-they-go/

You may want to read the document "Developing Acrobat Applications with JavaScript": http://help.adobe.com/livedocs/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/js/html/wwhelp.htm?href=JS_API_AcroJS.88.145.html&accessible=true

You will have to expand the tree and go down the Javascript branch to find this document.
Thank you very much for all the info and you help!

Have a good one!