Confiqure Confiqure - 5 months ago 19
Javascript Question

How can I put JavaScript code into a PDF document?

How do I insert JavaScript code into a PDF file?

I can code JavaScript, I just wish to know how to put it into a file to, for example, display the current date, use a combobox, etc.

Answer

JavaScript is typically tied to objects in a PDF document. For example, if you want the user to be able to print the PDF by clicking a Print button, follow the steps below:

  • Add a button to the form (done under advanced editing)
  • Right click on the button and go to properties
  • Click the actions tab
  • Under Select Action: choose Run a JavaScript
  • put print(); in the code window

Here's a link to an old (Acrobat 7.0.5) Acrobat JavaScript Scripting Reference to get you started.