How to Insert a Custom Dynamic Stamp into a PDF Using OLE
Question details
The user needs to insert a custom, temporary dynamic stamp into a PDF using OLE automation, allowing the stamp to display dynamic document text and be repositioned by the user.

- Product
- Adobe Acrobat
- Device & OS
- Windows
- Scenario
- Automating PDF workflows where external Windows programs pass text to a PDF stamp dynamically without saving the stamp for future sessions.
- Observed behavior
- The user must pass the required text from an external program to a PDF document-level variable via JSO and apply a temporary stamp that can be manually repositioned before closing.
Ensure you have basic knowledge of JavaScript for PDFs and administrative access to run external Windows OLE automation scripts on your device.
Apply a Dynamic Stamp via OLE and JSO
Use an external Windows program to communicate with the PDF's JavaScript Object (JSO), passing text variables directly to a custom dynamic stamp.
To achieve this, the dynamic stamp's data must be available in a location accessible to JavaScript. By utilizing the JavaScript Object (JSO) bridge, your external OLE program can write custom text data to a document-level variable, which the dynamic stamp can then read and display.
Open your advanced PDF editor and create a new custom dynamic stamp. Ensure its internal script is configured to read from a specific document-level JavaScript variable.
In your external Windows program (such as C#, VB.NET, or VBA), instantiate the PDF application object to establish an OLE connection.
Use the JavaScript Object (JSO) bridge via OLE to define a document-level variable in the active PDF, and assign your custom text data to this variable.
Execute a script command through the OLE interface to apply the dynamic stamp to the target page. The stamp will automatically pull the text from the document-level variable you just populated.
Configure your OLE script to leave the PDF document open in the viewer. This allows the user to click and reposition the temporary stamp manually before printing or closing the file without saving.

Easily Add Custom Stamps to PDFs with WPS Office
If you want to bypass complex OLE scripting and JavaScript variables, WPS PDF offers an intuitive, user-friendly interface to quickly create, apply, and reposition custom stamps in your documents without any coding.
- 1. Open Your PDF in WPS Office: Launch WPS Office and open the PDF document you want to edit.
- 2. Access the Stamp Tool: Navigate to the 'Comment' tab on the top ribbon and click on the 'Stamp' icon.
- 3. Create a Custom Stamp: Select 'Click to Add' or 'Custom Stamp' from the dropdown menu, then type your desired text or upload a custom image.
- 4. Apply and Reposition: Click anywhere on the PDF page to apply the stamp. You can easily click and drag the stamp to reposition it before saving your document.

Frequently Asked Questions
What is OLE automation in the context of PDFs?
OLE (Object Linking and Embedding) automation allows external Windows applications to control PDF software programmatically, enabling automated tasks like passing variables, extracting text, and applying custom stamps without manual user input.
Why use a document-level JavaScript variable for dynamic stamps?
A document-level variable acts as a data bridge. The external OLE program writes text to this variable, and the dynamic stamp's internal JavaScript reads from it to display the custom text in real-time.
Can I manually reposition a stamp applied via OLE?
Yes. As long as your OLE script leaves the PDF file open in the active viewer interface, users can manually click and drag the stamp to a new location before finalizing the document.
Are custom dynamic stamps permanent once applied?
Stamps only become permanent if you save the document. If your workflow requires temporary stamps, you can apply them during the active session, print the document, and close it without saving to discard the stamp.




