Add and test barcode fields

Last updated on Aug 16, 2025

Learn how to add and test barcode fields in Acrobat using JavaScript for enhanced PDF forms.

Before you begin

Enable automatic calculations. Go to Preferences > Forms, select the Automatically calculate field values checkbox, and then select OK.

Add barcode fields

From the All tools menu, select Prepare a form.

Select   Barcode from the left pane.

Drag a rectangle to define the barcode area, switch to the Select tool, and then double-click the barcode field.

In the Barcode Field Properties dialog box, configure the following:

On the Value tab:

  • For Encode Using, select a format (XML or Tab Delimited). Select Pick and choose the form fields to encode in the barcode.
  • Or, select Custom calculation script and then select EditNext, enter your custom JavaScript code in the JavaScript Editor dialog box.

On the Options tab:

  • For Symbology, select PDF417, QR Code, or Data Matrix.
  • Choose a Decode Condition based on how the form will be processed.
Tip

If you insert a maximum-sized barcode, adjusting the cell size or decode condition may cause it to extend beyond the page. To prevent this, choose the appropriate cell size and decode settings.

Select Close to add the barcode field to your form.

Note

JavaScript automatically encodes selected fields in XML or Tab-Delimited format. If you add a new field after creating the barcode, it won't be included by default, but you can manually add it.

Tip

To efficiently encode data in PDF form barcodes, you can customize them using JavaScript. A basic understanding of JavaScript and Acrobat-specific scripting is recommended. For more advanced capabilities, explore resources on developing Acrobat applications with JavaScript.

Test barcode fields

From the Prepare a form tools pane, select Preview.

Fill out the form fields with sample data. Use realistic data that represents what users might enter.

Check if the barcode field displays properly:

  • If it's grayed out, you may need to resize the field or adjust data settings.
  • Ensure the barcode area is large enough to contain all the encoded data.

To clear the sample data, select More > Clear Form in the right pane.

Exit preview mode and save your form.