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

JavaScript button for pdf

bnagaraj
Registered: Jun 16 2009
Posts: 8

I just wrote a JavaScript to rotate pages for my pdf, but it only works in this pdf (used the Advanced/JavaScript/Set Document Option). Is there a way to save it and run it externally so I can generalize the file name and run on my pdfs each time I create it?

My Product Information:
Acrobat Standard 7.0, Macintosh
Bianca
Registered: May 26 2009
Posts: 66
you can set so calles folder level java scripts. they are placed in the acrobat home folder/javascripts. i'm not sure if it's exactly the same with mac os x but with windows it works fine. you will find more information in the acrobat java script scripting guide:

http://partners.adobe.com/public/developer/en/acrobat/sdk/AcroJSGuide.pdf

hope, that helps
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Folder level scripts are cross platform. These are "*.js" files that are on the users systems in a specific folder location. They work the same way on Macs that they do on Windows, except that the folder location is different on the different platforms. These types of scripts are used to create Acrobat automation tools, which is exactly what you need.

You'll find more info in this article (and others on this site):
http://www.acrobatusers.com/tutorials/2006/folder_level_scripts

The example in that article creates a menu item to active the script. But you can also create custom toolbar buttons, as shown in this article:
http://www.acrobatusers.com/tutorials/2007/10/apply_security_with_js

In fact I wrote a tool for creating Acrobat JavaScript toolbar buttons, [url=http://www.windjack.com/products/acrobuttons.php]AcroButtons[/url].

You'll also find serveral free automation tools, with buttons, at the pdfscripting.com site listed below.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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