javascriptpdfdocumentationacrobatpdf-manipulation

Documentation for using JavaScript code inside a PDF file


Where can I find documentation on running JavaScript code inside a PDF?

I've never added a JavaScript action inside a PDF document. However, I've done quite a bit of web development using JavaScript. I have a few questions to whoever has any familiarity with JavaScript inside a PDF document.

NitroPDF and Adobe Acrobat definitely support JavaScript in PDF files. Is there a standard on various objects that exist and functions to manipulate a PDF file via JavaScript? Everything I've found so far has been from Adobe. Anywhere else seems to reference Adobe's documentation. Is there a standard out there, or is Adobe just the "de Facto" standard?

Also, Do all PDF viewers support JavaScript actions?

The best documentation on using JavaScript inside a PDF document that I could find was from Adobe - Adobe :: Acrobat JavaScript Scripting Guide.

NitroPDF has this link - NitroPDF :: JavaScript in PDF Files, but it basically just says it supports what Adobe has.

I also found this link from Scribus - Scribus :: How to enhance your PDF forms with JavaScript, but this only includes a few small snippets of code. Nothing super useful.

Adobe has documentation on how you can set breakpoints, etc... for JavaScript using their IDE. Is it possible to run JavaScript in a PDF file using another IDE and have breakpoints, etc...? It would be awesome to find something as cool as Firebug.

Note:

Please do not answer how to manipulate a PDF that is loaded in a web browser. The question is about running JavaScript from within a PDF document. I'm trying to explore the possibilities available via executing JavaScript in the PDF document. Specifically I may use functions from quickpdflibrary to add JavaScript functionality to existing documents.

Another useful link is Developing with Acrobat JavaScript. Apparently JavaScript code in PDFs is frequently called AcroJS or Acrobat JavaScript.


Solution

  • Probably you are looking for JavaScript™ for Acrobat® API Reference.

    This reference should be the most complete. But, as @Orbling said, not all PDF viewers might support all of the API.

    EDIT:

    It turns out there are newer versions of the reference in Acrobat SDK (thanks to @jss).

    Acrobat Developer Center contains links to different versions of documentation. Current version of JavaScript reference from Acrobat DC SDK is available there too.