SVG Barcode Generator

The past few days have been spent writing a PHP class that will generate barcodes and save them as SVG files. This class is going to be used in an upcoming barcode-related website I’m building.

Currently it supports:

  • UPC-A: The normal barcode you will see on most products in the US.
  • UPC-E: A smaller, compressed version of UPC-A. Typically seen on products that do not have enough space to fit a full UPC-A barcode.
  • EAN-13: The new international standard for barcodes. All stores in the US are supposed to be capable of using EAN-13 barcodes, but most products are still labeled with the older UPC-A barcodes.
  • EAN-13 w/ EAN-5: An EAN-13 barcode with an EAN-5 barcode next to it. The EAN-5 barcode indicates the recommended price for the item. These are typically seen on books and periodicals, although it is common for books to have the EAN-13 w/ EAN-5 barcode on the back, and a UPC-A barcode on the inside of the cover.

The advantage of generating an SVG file instead of a PNG or JPG is that SVG graphics are vectors. This means you can make the barcode as large or small as you want without any loss in quality. Once you’ve sized it as large or small as you want, you can export it to a PNG, JPG, GIF, whatever.

Anyways, I’m not releasing the source yet (sorry). ExitBlue is designing my new barcode site (should be ready by the end of the month), and then I’ll need a week or two to get the PHP backend stuff working, and then maybe I’ll release some of the code. In the mean time, you can check out the online barcode generator.


  1. Morgan Cook

    Jacob, looks great!
    I’ve been thinking of doing the same type of project, however time has not allowed. I could contribute to your project to add additional symbologies. If you already have a good base of code in place. Send me an email if interested.

  2. Thank you!!!
    Excellent application.
    Why dont you do a standalone application with your barcode software????

  3. Justin Souter

    So, did you ever post the SVG barcode source anywhere?

  4. Hello,

    Help me
    CW_Barcode class method with how will the post?

Leave a Reply

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