Hello World
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.
Follow these steps to access the JavaScript Editor for a Button
- Create a new PDF file
- Place a form field button the first page of this new PDF
- Access the properties panel and navigate to the Actions sub-section
- Click 'add action' with the 'Mouse Up' trigger selected
- Click 'edit' found on the Form tab within that dialog
And now with the JavaScript Editor showing, paste in the following:
app.alert('Hello, World!')
Click 'Ok' on all the dialogs, and once back to the main view, press 'escape' to deselect the button. Now try clicking the button and 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, let's dive into the fundamentals of JavaScript before we explore more of the Revu specific functions that are available.