UPC-A barcode in Adobe Illustrator using a script

What about, if you could generate UPC-A (UPC12) in Adobe Illustrator by replacing all 12-digit text in your open document with a working barcode? This free script creates barcodes that will follow the placement, size and rotation of your barcode text. Isn’t it smart and easy?
Finally, I found time to write this blog post, where I’ll describe how the UPC-A barcode script works and cover the known issues. The UPC-A Barcode script is available here. You are also welcome to have a look at my other scripts. This script works the same way as my EAN13 Barcode Script, with the only difference being that it creates a UPC-A Barcode.

Installation of UPC-A Barcode Script in Adobe Illustrator:

  1. Download the ZIP folder
  2. Extract the JSX file from ZIP folder.
  3. Place the UPC12.jsx file in:
    • Win (32 bit): C:\Program Files (x86)\Adobe\Adobe Illustrator [vers.]\Presets\en_GB\Scripts\
    • Win (64 bit): C:\Program Files\Adobe\Adobe Illustrator [vers.] (64 Bit)\Presets\en_GB\Scripts\
    • Mac OS: /Applications/Adobe Illustrator [vers.]/Presets.localized/en_GB/Scripts
  4. Restart Illustrator
  5. The script should be visible now under File > Scripts > UPC12

NOTE: The OCRB Std font also needs to be installed on your computer. This font is available at Adobe TypeKit.

If you want to improve your workflow, I can suggest recording an action. This method I covered in my previous posts. (here and here).

How Can You Generate UPC-A Barcode in Adobe Illustrator with the UPC-A Barcode Script?

Well, it’s straightforward. In the open Adobe Illustrator document, write the 12 digits of your barcode and run the UPC-A Barcode script. The script will find the strings that contain 12-digits corresponding to a valid UPC-A barcode and replace them with barcodes.

The Size of the UPC-A Barcode

The size of your barcode will depend on the size of your text. For example, the default Myriad Pro 12 points text will generate a UPC-A in Adobe Illustrator as a barcode group of around 28 mm. If you increase the size of the text, the generated barcode will also scale proportionally.

Rotation of the UPC-A Barcode

In case if you rotate the barcode text, then the generated barcode will also be rotated. I found this function very convenient. For example, if you create a box or other packaging, the barcode should be located at a certain angle according to your design.

Checksum Digit in your UPC-A Barcode

A unique formula calculates the checksum digit that all barcodes have. UPC-A also follows this rule. Therefore if your 12 digits create a wrong checksum digit, an alert will appear.
As you can see in the picture below, the alert suggests a checksum digit, but it is essential to ensure that the barcode you received is correct, rather than simply change the last digit to 7.

UPC-A and Layers

Further, created barcodes keep their position on the respective layers, as illustrated in the GIF below.

However, you must remember that the script will ignore this text string if a layer is locked or invisible. When I programmed the script to do so, I had it in mind that if a layer is locked or invisible, it’s because you don’t want to allow changes on this layer.

Using UPC-A barcode script in Adobe Illustrator with Data sets and the Batch action

I experienced that several users have asked if it is possible to use UPC12 barcode script with datasets and batch action. Unfortunately, this is not possible in the current UPC12 barcode script version, but I plan to improve the script in this direction. In the meantime, I can suggest the procedure described below. First, run the Batch action, which will save all Data sets as separate documents in a folder.

How to make a batch action with EAN-13 script

Afterwards, run the UPC12 barcode script as a new Batch action using the newly created folder.

This procedure will save all sets as separated files with the barcodes created.

In the end, I want to say that I hope my script will help you to make UPC12 barcode in Adobe Illustrator and be beneficial to designers working with packaging design. I’m always open to hearing your opinion and ideas on how I can improve this tool. So please do not be shy to contact me directly or leave a comment.

2 thoughts on “UPC-A barcode in Adobe Illustrator using a script”

  1. This is awesome! Thank you so much for taking the time to post both the UPC-12 and the EAN-13 barcode scripts for AI. I have a few clients who generate barcodes on old software and can’t export said barcodes to attach to the art for printing. It was a real inconvenience and we had to scan the strips of barcodes to add to art. Uugh…. this is a terrific solution.

    Reply

Leave a Comment