Knowledgebase

Back to Articles List

How do I create and use dynamic stamps in PDF-XChange Viewer and PDF-XChange Editor?

Question:

How do I create dynamic stamps in PDF-XChange Editor Plus?

Answer:

Please note that it is necessary to have PDF-XChange Editor Plus or PDF-XChange PRO in order to carry out the operation detailed below, as forms functionality is required.

JavaScript can be used to add dynamic elements to stamps in PDF-XChange Editor Plus, but there are a few steps to consider prior to adding JavaScript, or form fields:

1. You will first need to create the visual aspects of what will become your stamp. This can be an existing image or PDF. You will find generic instructions on creating stamps here: https://www.tracker-software.com/knowledgebase/174-How-do-I-use-the-Stamps-Palette-to-create-and-save-customized-stamps-for-the-Stamp-Tool
In this example I have created a new PDF, and added a rectangle and some static text:

2. Save and close this PDF. It is named "DavidStampTest.pdf" in this example.

3. With any other PDF document open, go to the stamps pallet, and choose Add New Stamp from File:

4. Choose "DavidStampTest.pdf" and give it a name suited for the stamp you are creating. You should see the new stamp in your collection once saved:

**Note:  You cannot add stamps to the default "Dynamic dates" stamp collection, as that is a locked collection.

5. Close the PDF-XChange Editor. This is a crucial step that must not be overlooked.

6. Open two Windows Explorer windows side by side. In one, navigate to %Appdata%\Tracker Software\PDFXEditor\3.0\Stamps. In the other, navigate to any folder in your system to use as a intermediary location. The desktop is to be used in this example.

7. Locate, but do not open the programmatic, specially formatted Stamp Collection file containing your new stamp in %Appdata%\Tracker Software\PDFXEditor\3.0\Stamps:

8. Move that specially formatted Stamp Collection file to your desktop.

9. Open the stamp collection file you just moved to your desktop. It should be opened in the PDF-XChange Editor.

10. Add Form fields (usually text fields) that will contain the dynamic elements of your soon-to-be dynamic stamp. You will find instructions on adding form fields here: https://help.tracker-software.com/pdfxe7/ For example, the JavaScript below will automatically place the date and time at which the stamp was placed when included in the Value Calculation/Run a JavaScript property of that form field.

var d = new Date;
event.value = util.printd("yyyy/mm/dd/ HH:MM:ss", d);


Click on the Ellipsis [...] next to Run a JavaScript in order to activate the Edit Action: "Run a JavaScript" dialog, and enter the JavaScript:

**Note: When a dynamic stamp is placed, it becomes a flat comment on that PDF. The values of any given form field must auto-evaluate as the stamp is placed. In the JavaScript example above, the date cannot be changed once the stamp is placed as expected. Find more information regarding working with PDF's and JavaScript in the Acrobat JavaScript API documentation.

11: As shown below, the JavaScript adds the date and time to the text field:

This will be shown immediately once the JavaScript is added to the form field's Value Calculation/Run a JavaScript property.

12. This step is usually where a mistake will be made, if any. Please save and close the file to its current location - do not rename it.

13. move the stamp collection file from your desktop (or whichever file you moved it to in step 8) back into %appdata%\Tracker Software\PDFXEditor\3.0\Stamps

 You should now see your dynamic stamp in the Editor functioning correctly, back into the same stamp collection as shown in step 4. Now, as shown below, the stamp auto evaluates the date and time when placed:

 

Was this article helpful?
Yes No Somewhat