How to Email a PDF Using the Email Address from a Digital Signature
Question details
The user needs to extract the email address associated with a digital signature in a PDF and use it to automatically send the completed document.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Automating a PDF workflow to send a signed document back to the original signer.
- Observed behavior
- Using Acrobat JavaScript to pull the signer's identity metadata, lock the form fields, and route the PDF via email.
Ensure that the document has an existing digital signature field and that the signer's digital ID certificate contains a valid email address before running the script.
Extract Email via JavaScript and Use mailDoc
Use the signatureInfo() method in your PDF JavaScript environment to parse the signer's email address and route the document.
By utilizing the PDF JavaScript API, you can programmatically read the metadata of a digital signature once it is applied. The signer's identity string usually contains their email address formatted within angle brackets.
You can use a regular expression to target and extract just the email address, which can then be passed to the mailDoc() function to automatically draft an email.
Determine the exact name of the digital signature field in your PDF form (for example, 'SignatureFieldName').
Use the script this.getField('SignatureFieldName').signatureInfo().name to pull the identity string of the signer.
Apply a regular expression to parse the email address from the identity string. You can append .match(/<(.+)>$/)[1] to the previous script to isolate the email.
Pass the extracted email address variable into the app.mailDoc() function as the recipient parameter to automatically draft and send the email with the PDF attached.

Manage and Sign PDFs Easily with WPS Office
While advanced JavaScript routing is specific to certain PDF editing APIs, WPS Office provides a lightweight, highly compatible, and free alternative for signing, editing, and managing your PDF documents effortlessly.

Frequently Asked Questions
Why is the JavaScript returning an error when extracting the email?
The script will fail if the digital signature has not been applied yet, if the field name does not match, or if the signer's digital ID does not include an email address in the expected <email@domain.com> format.
Can I use this JavaScript code in any PDF viewer?
No, this specific JavaScript method relies on advanced PDF scripting APIs (like Acrobat JavaScript). Basic PDF readers may not support the signatureInfo() method or the mailDoc action.
How do I lock fields after the PDF is signed?
Instead of manual scripting, you can typically configure the digital signature field properties in your PDF editor to automatically mark specific fields (or all fields) as read-only once the signature is placed.




