How to Create a Dynamic GS1-128 Barcode in a PDF Form
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.

- 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.
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.
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.
Download and install a GS1-128 (or Code 128) compatible barcode font onto your computer.
Open your PDF editor, navigate to the Form Tools, and add a standard Text Field named 'LotNumber' where users will type the value.
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.
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.

Use Built-in Barcode Objects in Form Designers
If you are using enterprise-grade form creation software like Adobe LiveCycle Designer, you can insert native barcode objects directly.
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. Download the installer: Visit the official WPS Office website and click the 'Free Download' button.
- 2. Install WPS Office: Run the downloaded installer and follow the on-screen instructions to set up the software on your device.
- 3. Open and edit PDFs: Launch WPS PDF to instantly start filling forms, adding annotations, and managing your PDF documents.

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.




