How to Auto-Populate Name and Date After Digitally Signing a PDF
Question details
The user wants to automatically fill in a client's name and approval date in a PDF form immediately after a certificate-based digital signature is applied.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form that requires digital signatures and needs to automatically extract and display the signer's certificate details in separate text fields.
- Observed behavior
- The form author needs a method to retrieve the certificate information upon signature application and map it to specific text fields (like name and date).
Ensure your PDF editing software supports form field JavaScript and that you have already created the target text fields (e.g., 'SigName' and 'SigDate') in your document.
Use JavaScript on the Signature Field's Signed Tab
Use the signatureInfo() method in a custom JavaScript to extract the certificate name and date, then populate read-only text fields automatically upon signing.
By attaching a script directly to the digital signature field, the PDF can automatically pull data from the user's digital certificate the moment it is applied. It is also good practice to make these destination text fields read-only so users cannot manually alter the generated values.
Open your PDF document and enter Form Editing mode. Ensure you have your Digital Signature field and the blank text fields (e.g., SigName, SigDate) placed on the page.
Double-click the Digital Signature field to open its Properties dialog box.
Go to the 'Signed' tab in the Properties window and select the option 'This script executes when field is signed'.
Click 'Edit' or 'Add' to input your script. You will use event.target.signatureInfo() to pull the certificate details and map them to your fields using this.getField('FieldName').value.
Double-click your target text fields (SigName and SigDate), go to the General tab, and check the 'Read-Only' box to prevent manual editing.

Edit and Manage PDF Forms with WPS Office
WPS PDF provides comprehensive form editing features, allowing you to easily add digital signatures, interactive text fields, and customize field properties to create professional documents.
- 1. Open your PDF: Launch WPS Office and open your PDF document.
- 2. Access the Form tab: Navigate to the 'Form' tab on the top ribbon to view all interactive field tools.
- 3. Add fields: Select the 'Digital Signature' tool or 'Text Field' tool and click on the document to place them.
- 4. Customize properties: Double-click the fields to rename them, set them to read-only, and configure their appearance before saving the document.

Frequently Asked Questions
Can I auto-populate the date without using a digital signature?
Yes, you can use a custom JavaScript on a standard text field or a document-level script to populate the current date when the PDF is opened or printed, bypassing the need for a certificate.
Why aren't my text fields updating after I sign the document?
Ensure that the field names in your JavaScript exactly match the actual names of the text fields in the PDF form. JavaScript is case-sensitive, so 'SigName' is different from 'signame'.
What happens to the populated names if the digital signature is removed?
If you use a validation check in your script (like checking if signatureValidate() == 4), you can program the else condition to automatically clear the populated name and date fields when the signature is cleared.




