How to Add Watermark Through JavaScript in Acrobat

To customize your PDF files you can use JavaScript. With that you can enable automated handling, commenting and a lot of other things. You can apply the JavaScript to a particular document, page, field, or even use it to add a watermark in Acrobat. In this tutorial we will add a book mark using the JavaScript in Acrobat.



Step # 1 – Copy the Script
We have a document here on which we want to add a watermark.
this.addWatermarkFromText({
cText: “DRAFT\n\nCOPY”,
nTextAlign:app.constants.align.center,
cFont: “Helvetica-Bold”,
nFontSize:36,
aColor: color.red,
nStart: this.pageNum,
nOpacity: 0.5,
bOnScreen: false
});
On this page there is a JavaScript for adding a watermark to your documents, copy the JavaScript to Acrobat by pressing “Ctrl + C”.
Step # 2 – Click on the “Create New” action button
After copying the JavaScript return to your Adobe Acrobat X and go to the “Tools” task pane, from the different panels click on the “Action Wizard” panel. A drop down menu will appear having different buttons. Click on the “Create New Action” button.
Select the ‘Create New’ action button

Step # 3 – Choose “Execute JavaScript” Button
After the dialog box opens, click on the “More Tools” panel which is on the left side of the box and a list will appear. From the list select “Execute JavaScript” button. After that click on the “Options” button of the “Steps” section which will be on the right side of the box which will open a small dialogue box.
Click on the ‘Execute JavaScript’ Button

Step # 4 – Paste the Java Script
Give a title to your script and hit “Enter” to go to the new line, paste the script. You can make changes to the script like the font size and the font type. Here we only changed what we want in the water mark to appear. Previously it was draft and copy and we changed it to “Water mark test”. Click on the “OK” button and then on the “Save” button. Write a name for your action and hit the “Save” button to add the Watermark in Acrobat.
Enter the JavaScript in the Box

Step # 5 – Execute the Action
Return to your main document and then click on the action which is saved under the name of “water mark test” and click on the “next” button. After the water mark will be added you will be required to save your document.
Perform the Action