PDF Editing Issues

How to Automatically Populate PDF Metadata from Form Fields

Adam DavisAdam Davis Oct 28, 2026 869 views

Question details

The user needs to automatically copy data entered into specific PDF form fields directly into the PDF document's Title metadata.

Automatically Populate PDF Metadata from Form Fields
Product
PDF Editor
Device & OS
not provided
Scenario
Creating or managing interactive PDF forms where document metadata needs to reflect the entered form data dynamically.
Observed behavior
The document's Title metadata updates automatically based on the values typed into the Name, City, and State form fields.
Before you start

Ensure you have a professional PDF editing tool that supports JavaScript integration and interactive form field properties. Save a backup of your original PDF form before adding or testing any document-level scripts.

Solution 1Recommended

Use JavaScript to Update Document Metadata

Attach a custom JavaScript action to a form button or field event to dynamically update the PDF metadata based on user input.

By using a document-level script or attaching a script to a specific trigger like a Submit button, you can read values from your form fields and write them directly into the PDF's properties.

1
Open form editing mode

Open your PDF form in a professional PDF editor with form editing capabilities, and enter the Form Editing mode.

2
Access field properties

Right-click the field or button that will trigger the metadata update, then select 'Properties'.

3
Add a JavaScript action

Navigate to the 'Actions' tab, select 'Run a JavaScript' from the 'Select Action' dropdown, and click the 'Add' button.

4
Enter the script

Enter the following script into the editor: this.info.Title = this.getField('Name').valueAsString + ', ' + this.getField('City').valueAsString + ', ' + this.getField('State').valueAsString;

5
Save and test

Click 'OK' to save the script, exit form editing mode, and test the form by filling in the Name, City, and State fields to see if the metadata updates.

Use JavaScript to Update Document Metadata
Script Trigger: You can also set this script as a Document Action (e.g., 'Will Save') so the metadata updates automatically right before the user saves the PDF.
Efficient PDF Form Management

Edit and Manage PDF Forms with WPS PDF

WPS Office includes a powerful PDF editor that allows you to fill out interactive forms, edit PDF content, and manage document properties with ease. It's a lightweight, all-in-one solution for handling documents across different formats.

  1. 1. Install WPS Office: Download and install WPS Office on your device.
  2. 2. Open the PDF: Open your PDF file using the WPS PDF tool.
  3. 3. Fill out forms: Use the 'Form' tab to interact with or fill out form fields easily.
  4. 4. Check metadata: Go to 'Menu' > 'Document Properties' to view or edit metadata manually.
Easily fill, edit, and manage interactive PDF forms.Modify document properties and metadata quickly.High compatibility with Adobe Acrobat PDF standards.Fully compatible with Microsoft Word, Excel, and PowerPoint formats.
microsoft office alternative - wps office

Frequently Asked Questions

Can I update other metadata fields like Author or Subject using JavaScript?

Yes, you can update other metadata fields by modifying the script. For example, use 'this.info.Author' or 'this.info.Subject' instead of 'this.info.Title' to target those specific document properties.

Why isn't the metadata updating immediately when I type?

If the script is attached to a button or a document save action, it will only execute when that action occurs. To update immediately, you need to attach the script to the 'On Blur' event of the specific form fields.

Is JavaScript supported in all PDF viewers?

No, basic PDF viewers, such as those built into web browsers, often do not support JavaScript execution. Users need to open the form in a fully-featured PDF reader or editor for the script to run properly.

How do I check if the metadata has been updated?

You can check the document's metadata by going to 'Menu' > 'Document Properties' or 'File' > 'Properties' in your PDF viewer and looking at the 'Description' tab where the Title, Author, and Subject are displayed.