Back to Articles List

How do I add custom actions to my documents?

I have documents I would like to perform a special  action on each time that I close, save or print.


The PDF-XChange Editor offers the ability to edit Document Properties, including adding actions to documents. This allows advanced users to write scripts that can be applied to the entire document each time a certain action is performed. These actions can be found by opening the Document in question, and pressing Ctrl+D.

Adding JavaScript Actions

If you are looking to add special actions to links in your documents, Please see this KB for more information.

In the below Example, we will tell the document to always Flatten all comments just before saving. This is done using JavaScript, as of build 326.1 this is limited to the contents of the Adobe JS API Reference, In the future we hope to extend this selection with our own capabilities.

In the PDF-XChange Editor

1. Open the document you wish to modify and Press Ctrl+D.

The Document Properties window will open.

2. Navigate to the Actions tab:

3. Select when to perform the action, for this article we will choose Before Document Saving, then click Edit:

4. The Edit Action dialog will appear, paste the following JS code into the window and press OK.


**This script will cause the document to be flattened every time that it is saved, just before saving.

You can create your own actions using JavaScript as well. Our JS Currently utilizes most actions from the Adobe JS API reference.

These scripts are saved directly to the document, and should remain in place regardless of what PDF manipulation software is used with it in the future.

5. Click OK and save the document.

You should now find that any comments, such as the Rectangle tool, have been flattened, and must now be edited using the Edit Content tool, instead of the Select Comments tool.

Was this article helpful?
Yes No Somewhat