PDF Editing Issues

How to Show a PDF Barcode Field Name and Value on the Same Line

Adam DavisAdam Davis Nov 5, 2026 868 views

Question details

The user needs a way to format a QR barcode in a PDF form so that the linked field name and its corresponding data value are displayed together on a single line when scanned.

How to Show a PDF Barcode Field Name and Value on the Same Line
Product
PDF
Device & OS
not provided
Scenario
Creating an interactive PDF form where a QR barcode encodes user-inputted form data.
Observed behavior
When the generated QR barcode is scanned, the field name appears on one line and the field value appears on the line below it, instead of inline.
Before you start

Before modifying your form field properties, ensure you have a reliable QR scanner app installed on your mobile device to immediately test the formatting changes.

Solution 1Recommended

Use a Custom Calculation Script to Format the Payload

Modify the barcode field's calculation script to manually concatenate the field name and value into a single, space-delimited string before it is encoded.

The final layout of a scanned barcode depends entirely on the raw payload data format and how the scanning application interprets it. By default, some PDF form utilities might insert line breaks between the field name and its value.

To force both elements onto the same line, you can intercept the data using a custom JavaScript calculation that combines them with a custom delimiter (like a colon and a space) instead of a line break.

1
Open Barcode Properties

Right-click the QR barcode field in your PDF editor's form mode and select 'Properties' from the context menu.

2
Navigate to the Calculate Tab

In the Properties window, click on the 'Calculate' tab to change how the barcode retrieves its data.

3
Enter Custom JavaScript

Select 'Custom calculation script' and click 'Edit'. Enter a script that concatenates your desired string, for example: event.value = 'YourFieldName: ' + this.getField('YourFieldName').value;

4
Save and Test

Click 'OK' to save the script, exit form editing mode, type a test value into the source field, and scan the resulting QR code.

Use a Custom Calculation Script to Format the Payload
Scanner Compatibility: Different QR scanning apps interpret data differently. If the single-line format still breaks into two lines, check the scanner app's settings, as some automatically format detected key-value pairs.

Create and Manage PDF Forms Easily with WPS Office

If you are designing interactive documents, WPS Office provides a robust and user-friendly PDF editor. You can easily insert text fields, manage form properties, and handle data without navigating overly complex settings.

  1. 1. Open your PDF: Launch WPS Office and open your existing PDF document or create a blank one.
  2. 2. Access Form Tools: Navigate to the 'Form' tab on the top ribbon to view all available interactive field options.
  3. 3. Edit Field Properties: Insert or select a form field, then double-click it to modify its name, appearance, and value settings.
  4. 4. Save and Export: Once your form fields are configured, click 'Save' or export the document to share it with users.
Intuitive form-building tools for interactive PDFsHighly compatible with standard Adobe Acrobat PDF formatsLightweight application that won't slow down your deviceSeamlessly edit text, images, and pages within your PDF
microsoft office alternative - wps office

Frequently Asked Questions

Why does my barcode scanner separate my PDF data into multiple lines?

Scanning applications often look for hidden characters like carriage returns (\r) or newline characters (\n) in the payload. If the PDF utility inserts these by default between a field name and its value, the scanner will display them on separate lines.

Can I use JavaScript to format data inside PDF forms?

Yes, standard PDF formats support JavaScript for custom calculations. This allows you to manipulate exactly how text strings are combined and formatted before they are passed to a barcode field or another text field.

What delimiter should I use to keep barcode text on one line?

A standard colon followed by a space (': ') or a simple dash (' - ') works best. Avoid using 'Enter' or tab characters when setting up the string, as these are universally interpreted as line or column breaks by scanner software.