How to Copy Values from PDF Form Fields into Text or Email
Question details
Combining values from multiple PDF form fields into a single formatted message for text extraction or email preparation.

- Product
- PDF Editor
- Device & OS
- not provided
- Scenario
- The user needs to extract data from various PDF fields (such as text, read-only, and dropdowns) and concatenate them into a customized text output or email draft.
- Observed behavior
- Form field values must be extracted and ordered manually via script because the PDF software does not automatically infer sentence structures from individual fields.
Verify the exact property names of the PDF form fields you intend to extract, and ensure your PDF editor supports running custom JavaScript actions.
Use JavaScript to Extract and Concatenate Form Fields
Write a custom script using the getField method to collect specific data from your PDF and format it into a cohesive text block or email layout.
PDF JavaScript allows you to retrieve values from any form field—including those set as read-only. By explicitly defining the order in your script, you can organize names, dates, and dropdown selections into a readable format.
Right-click the form fields in your PDF editing tool, select 'Properties', and note the exact names of the fields you want to extract (e.g., 'name1', 'dob').
In your PDF editor, add a new interactive button, go to its 'Actions' properties, select 'Run a JavaScript', and click 'Add'.
Use the this.getField("FieldName").value method inside the editor to read the data from each individual field.
Combine the retrieved variables using the '+' operator, adding custom labels and line breaks (using '\n') to format the final message string.
Assign the final concatenated string to a multiline text field's value, or use the app.mailMsg() method to automatically generate an email with the extracted text as the body.

Manage and Share PDF Forms Easily with WPS Office
WPS Office provides a comprehensive PDF editor that makes it incredibly simple to fill out interactive forms, extract form data, and quickly share your finalized documents via email without needing complex programming.
- 1. Open your PDF: Launch WPS Office and open the interactive PDF form you need to process.
- 2. Fill the Form Data: Navigate to the 'Form' tab to actively fill out text fields, select from dropdowns, and check necessary boxes.
- 3. Share via Email: Click the 'Menu' or 'Share' button in the top toolbar to automatically attach the completed form to a new email draft.

Frequently Asked Questions
Can a script read a PDF form field if it is set to read-only?
Yes. Read-only fields prevent manual user edits but are not skipped by scripts. They can still be accessed and read by JavaScript using the getField method.
Why aren't my form fields automatically combining into a paragraph?
PDF software handles fields independently. You must explicitly define the sequence, custom text formatting, and labels within your script to combine them into a logical sentence or paragraph.
How do I add line breaks in my concatenated PDF form text?
When writing your JavaScript string, you can insert '\n' to instruct the resulting text box or email output to create a new line.




