Revu JavaScript
Use the Revu JavaScript Console to enhance the capabilities of PDF forms, create interactive stamps, and more.
The Revu API Reference Guide documents all JavaScript capabilities available in Revu.
| Version | Date | Notes |
|---|---|---|
| 1.0 | September 16, 2025 | JavaScript articles created. |
JavaScript history
JavaScript was invented as part of the Netscape Navigator browser so that web pages could be more interactive. As lore goes, the first version was created in only 10 days! It has stood the test of time and remains as the cornerstone of web development. These days, JavaScript development for the web looks very different than it did nearly 30 years ago. There are numerous advancements—such as single page application frameworks, package managers, bundlers, and more—that have enabled teams of people to work on complex web applications.
However, PDF JavaScript development is not so different than the way development took place in the early internet. Generally, PDF JavaScript is embedded within individual PDF files, and rather than pulling in many different pre-existing packages and using build systems, plain JavaScript needs to be written that targets a completely different object model than that of the web.
As the original stewards of the PDF specification, Adobe introduced JavaScript capabilities into Adobe Acrobat in support of interactive form fields. Revu has supported JavaScript since version 6.5 with expanded support in updated versions of Revu over time.
Document Object Models (DOMs)
The only similarity between web and PDF development is that the core language is the same (types such as strings, arrays, and numbers are applicable whether in the web or a PDF). However, the web and PDF have very different DOMs. As such, it is imperative that when making internet searches for JavaScript assistance, you understand when the results are referring to web development that may not be applicable for the PDF JavaScript you are developing.
A DOM connects the core language of JavaScript to the domain of the particular application hosting the script capability. For web, this domain is an HTML web page and its tree of elements. For PDF, the domain is the PDF document with its own collection of PDf specific elements, such as form fields, layers, and more. The Revu API Reference Guide documents the complete DOMs of Revu and dives into using JavaScript in PDF files to make them more interactive for specific workflows.
Contexts
Another key difference between web development and PDF development is where you write your code. In web development, you would typically create a file with the .js extension that lives alongside your HTML file and is published as part of the web page. Additionally, you would modify the .js file in the code/text editor of your choice.
PDF is different in that snippets of JavaScript are typically embedded throughout the PDF and accessed in different areas within Revu directly.
The Contexts article goes into detail of all the different contexts of which JavaScript can be run from within a PDF file. For now, let's dive straight to a Hello World example.
The quickest way to get started with PDF JavaSript is to attach a snippet of JavaScript to the Mouse Up action of a form field button. Executing JavaScript as part of a form field action is one of the primary ways that JavaScript gets executed with a PDF.
To access the JavaScript Editor for a button, follow these steps:
-
Create a new PDF file.
-
Place a form field button the first page of the PDF.
-
In the Form Field Properties panel, expand Actions.
-
Select Mouse Up for the Trigger, and select Add Action.
-
On the Form tab, select Edit.
-
In the JavaScript Editor window, paste the following:
copyapp.alert('Hello, World!') -
Select OK on all dialogs.
-
In the main workspace, press Esc to deselect the button.
-
Try clicking the button–you should see a popup with your 'Hello, World!' string!
The app.alert method is one of many Revu-specific functions that are available.
Now that you know where to begin with writing JavaScript in Revu, learn the fundamentals of JavaScript before diving into the available Revu-specific functions.
Resources
Revu 21
Revu JavaScript
JavaScript
