UPC-A barcode in Adobe Illustrator using a script

An instructional image featuring a step-by-step guide on creating a UPC-12 barcode in Adobe Illustrator. The background is divided diagonally with a soft gradient from beige to teal. On the left, a large number '041220318834' points with an arrow towards a barcode on the right, which displays the same number underneath. Above in bold text reads "Create UPC-12 BARCODE in Adobe Illustrator

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.

Share:

Author picture

My name is Katja Bjerrum and I love to eliminate boring routine tasks in Adobe Illustrator. I work with scripts, actions and other tricks in Adobe Illustrator to streamline work processes.

Table of Contents

Recent Posts

8 Responses

  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.

  2. I was searching for a way to quickly generate multiple vector UPC-A barcodes and automate it in a way that would reduce human error. I found this script and I think it’s awesome. Thanks!

    PS: I was able to mod the script to use the typeface I want for the barcode number text. I just changed the name of the typeface in the script and adjusted the font size variable by the difference between the script’s original typeface and the one I was switching to. Works great!!!

    1. Thank you for this comment, Jacob.
      It’s nice to get feedback and see that what I do benefits people. I’m glad that you are happy with thе UPC-A barcode script and that you were able to easily modify the scripts to make it work according to your needs. Great job!

      1. Hi Katja,
        Last week I did a sheet of 125 unique barcodes using your script. My proofreader tested them and they all worked! However, 5-10 didn’t scan right away.

        This week I did another sheet of 64 barcodes and 17 of were picky. I got 5 of them to scan but the other 12 wouldn’t scan at all. (That’s about a 27% error margin).

        I generated one of the barcodes using my barcode software (Easy Barcode Creator – it can only make 1 at a time though) and the bars of the barcodes didn’t match up.

        So is it possible that I’m doing something wrong or is it that the script is just not perfectly precise? It would be a real shame if this didn’t work. I wouldn’t be able to use the script if it’s not reliable. We’re so close to this awesome solution!!!

        Please advise. Thanks!

    2. Hi Jacob

      Thank you for the report on this issue. I looked at the problem and found the cause. I adjusted the code now and updated it on my webpage.

      1. Hi Katja,
        I tested the updated script to generate all 189 of my barcodes and they worked perfectly!!!!

        Thank you so much!!!

Leave a Reply

Your email address will not be published. Required fields are marked *