Open Barcode

Free Open-Source barcode generator for PHP, Pyhton, Javascript, C# and Java

View project on GitHub

Barcode Generator.

Test drive the barcode generator below using the Javascript API.

Usage

Refer to the examples below to use "Open-Barcode" for your own project. Open-Barcode calculates the bar sequence and returns an array of integers (0s and 1s), zeroes being white and 1s being black bars respectively.

JavaScript

// UPC-A barcode
var upc = new OpenBarcode.UPC("12345678998");
var bars = upc.barcode();
var numericCode = upc.code;

// EAN13 barcode
var ean = new OpenBarcode.EAN("123456789985");
var bars = ean.barcode();
var numericCode = ean.code;

// Code39 barcode
var code39 = new OpenBarcode.Code39("Open Barcode");
var bars = code39.barcode();
var numericCode = code39.code;

PHP

// UPC-A barcode
$upc = new \OpenBarcode\UPC("12345678998");
$bars = $upc->barcode();
$numericCode = $upc->code;

// EAN13 barcode
$ean = new \OpenBarcode\EAN("123456789985");
$bars = $ean->barcode();
$numericCode = $ean->code;

// Code39 barcode
$code39 = new \OpenBarcode\Code39("Open Barcode");
$bars = $code39->barcode();
$numericCode = $code39->code;

Python

from openbarcode.linear import *

// UPC-A barcode
upc = new UPC("12345678998");
bars = upc.barcode();
numericCode = upc.code;

// EAN13 barcode
ean = new EAN("123456789985");
bars = ean.barcode();
numericCode = ean.code;

// Code39 barcode
code39 = new Code39("Open Barcode");
bars = code39.barcode();
numericCode = code39.code;

Java

import com.floms.openbarcode.Code39;
import com.floms.openbarcode.EAN;
import com.floms.openbarcode.LinearBarcode;
import com.floms.openbarcode.UPC;

public class Main {

    public static void main(String[] args) throws Exception {
        // UPC-A barcode
        LinearBarcode upc = new UPC("12345678998");
        int[] bars = upc.barcode();
        String upcCode = upc.code();

        // EAN13 barcode
        LinearBarcode ean = new EAN("123456789985");
        int[] eanBars = ean.barcode();
        String eanCode = ean.code();

        // Code39 barcode
        LinearBarcode code39 = new Code39("Open Barcode");
        int[] code39Bars = code39.barcode();
        String code39Code = code39.code();

    }
}

Authors and Contributors

This free and open-source project is brought to thanks to the sponsorship of Floms, LLC and Yoel Nunez (@ynunez).

Support or Contact

Having trouble? Contact Us at opensource@floms.com and we'll help you.