PDF Editing Issues

How to Create a Dynamic GS1-128 Barcode in a PDF Form

Jason MillerJason Miller Oct 28, 2026 869 views

Question details

The user needs to generate a dynamic GS1-128 barcode associated with a form value, such as a product lot number, within a PDF document.

How to Create a Dynamic GS1-128 Barcode in a PDF Form
Product
PDF Forms
Device & OS
not provided
Scenario
Creating dynamic and automatically updating barcodes linked to data entered into text fields.
Observed behavior
Requires a setup that dynamically updates the visual barcode when the lot number changes and complies with GS1-128 formatting requirements.
Before you start

Verify that you have a compatible GS1-128 or Code 128 barcode font installed on your system or have access to the Native Barcode options within your advanced PDF designer software.

Solution 1Recommended

Apply a Barcode Font to a Dynamic Text Field

The most straightforward solution is to use a standard one-dimensional barcode font mapped to a dynamic text field that mirrors your data.

By binding two fields together using JavaScript inside the PDF, you can have a visible 'Lot Number' text field and a matching 'Barcode' text field. The barcode field will automatically translate the typed text into a scannable GS1-128 barcode using your installed font.

1
Install a barcode font

Download and install a GS1-128 (or Code 128) compatible barcode font onto your computer.

2
Create the data entry field

Open your PDF editor, navigate to the Form Tools, and add a standard Text Field named 'LotNumber' where users will type the value.

3
Create the barcode display field

Add a second Text Field named 'BarcodeDisplay'. Right-click the field, select 'Properties', and under the 'Appearance' tab, change the text font to your newly installed barcode font.

4
Apply a custom calculation script

In the 'Properties' of the 'BarcodeDisplay' field, navigate to the 'Calculate' tab. Select 'Custom calculation script' and click 'Edit'. Add a script that retrieves the value of 'LotNumber' and formats it with the necessary GS1-128 start, FNC1, checksum, and stop characters.

Apply a Barcode Font to a Dynamic Text Field
Encoding Requirement: GS1-128 requires specific start characters and a checksum digit. If your font does not calculate this automatically, your JavaScript must format the raw data string before rendering it as a barcode.
Free Microsoft Office alternative

Handle All Your PDF and Document Needs with WPS Office

While highly advanced dynamic barcode generation may require specialized enterprise form designers, WPS Office provides a comprehensive, lightweight, and free suite to view, edit, fill, and manage all your PDFs and Office documents seamlessly.

  1. 1. Download the installer: Visit the official WPS Office website and click the 'Free Download' button.
  2. 2. Install WPS Office: Run the downloaded installer and follow the on-screen instructions to set up the software on your device.
  3. 3. Open and edit PDFs: Launch WPS PDF to instantly start filling forms, adding annotations, and managing your PDF documents.
Effortlessly read, fill out, and sign standard PDF forms.Fully compatible with Adobe PDF and Microsoft Word, Excel, and PowerPoint formats.Lightweight software that ensures smooth performance on Windows, Mac, and Linux.Built-in PDF editor with intuitive tools for text editing, merging, and splitting documents.
microsoft office alternative - wps office

Frequently Asked Questions

Can I use any Code 128 font for GS1-128 barcodes?

While GS1-128 utilizes the Code 128 character set, it strictly requires a special Function 1 (FNC1) character immediately after the start character to be recognized as GS1-128. You must ensure your data script includes this prefix when using a standard Code 128 font.

Why is my dynamic barcode not scanning properly?

If the barcode updates visually but fails to scan, it is likely missing the required start/stop characters or the mathematical checksum digit. When mapping a font to a dynamic text field, your background script must calculate and append these elements to the raw data.

Are barcode fonts supported in all PDF viewers?

Barcode fonts will only render correctly if the font is embedded in the PDF document or actively installed on the user's device. Always ensure your form saving preferences are set to embed fonts to maintain cross-device compatibility.