How to Create Multiline Text from Form Fields in Acrobat PDF
Question details
The user needs to combine values from multiple PDF form fields into a single multiline text block that can be easily selected and copied.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating a consolidated, copyable text block from various user inputs in a PDF form.
- Observed behavior
- Acrobat JavaScript cannot directly copy text to the system clipboard, requiring the use of a multiline target text field to display the combined values on separate lines.
Ensure you have Adobe Acrobat Pro installed, as the free Acrobat Reader does not allow you to create or edit form fields and custom calculation scripts.
Use a Custom Calculation Script in a Multiline Text Field
Create a target text field configured for multiline input and use JavaScript to concatenate the values from the source fields.
Since Acrobat JavaScript restricts direct access to the system clipboard for security reasons, the best workaround is to generate the combined text inside a read-only multiline text field. Users can then manually select and copy the text.
Open your PDF in 'Prepare Form' mode. Add a new Text Field where you want the combined text to appear.
Right-click the new text field and select 'Properties'. Go to the 'Options' tab and check the 'Multi-line' box.
Switch to the 'Calculate' tab. Select 'Custom calculation script' and click 'Edit'.
Enter a script to get the values of your source fields, combine them with newline characters (\n), and assign the result to event.value. For example: var a = this.getField('FieldA').valueAsString; var b = this.getField('FieldB').valueAsString; event.value = a + '\n' + b;

Create and Manage PDF Forms with WPS Office
WPS Office provides a comprehensive PDF editor that allows you to create, edit, and manage interactive PDF forms effortlessly. It is a lightweight and cost-effective solution for all your document needs.
- 1. Open WPS PDF: Launch WPS Office and open your PDF document using the built-in PDF editor.
- 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to access various form field controls.
- 3. Add Text Fields: Click on 'Text Field' and drag on the document to create input areas for your users.
- 4. Edit Properties: Double-click the form field to adjust its properties, including multiline settings and appearance.

Frequently Asked Questions
Why can't I copy text directly to the clipboard using Acrobat JavaScript?
For security reasons, modern PDF viewers restrict scripts from accessing the system clipboard automatically. This prevents malicious documents from overwriting or stealing clipboard data without user consent.
How do I add a line break in Acrobat JavaScript?
You can add a line break by using the newline character '\n' in your JavaScript string concatenation. Ensure the target text field has the 'Multi-line' option enabled, or the line breaks will be ignored.
Can I hide the source fields after combining their text?
Yes. You can set the source fields to 'Hidden' in their Properties under the General tab if you only want the user to see the final combined multiline text field.
Does this calculation update automatically?
Yes, as long as the PDF viewer supports JavaScript and calculation is enabled, the target field will automatically update its multiline text whenever the values in the source fields change.




