- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
EAN-8, also known as European Article Number 8, UPC-8, GTIN-8, GS1-8, EAN/UCC-8, is the short barcode version of EAN-13 barcode.
Generate and create EAN-8 barcode using Java is one of the functions in OnBarcode's
Barcode for Java Generating Java library (jar file), which supports
generating & printing EAN-8 and 20+ other linear & 2D bar codes in Java application and software.
EAN-8 Generator and Reader library, SDK & application
EAN-8 Generator components and software include
.NET EAN-8,
C# EAN-8,
VB.NET EAN-8,
ASP.NET EAN-8,
EAN-8 Generator.
This document is providing a detailed Java sample source code about generating EAN-8 barcodes in Java class using
Java Barcode generation component.
Complete EAN-8 custmoization settings is included in
Java EAN-8 generating guide.
Generating EAN-8 barcode in Java class example:
EAN8 barcode = new EAN8(); /* EAN 8 Valid data char set: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (Digits) EAN 8 Valid data length: 7 digits only, excluding the last checksum digit */ barcode.setData("7777777"); // for EAN8 with supplement data (2 or 5 digits) /* barcode.setSupData("12"); // supplement bar height vs bar height ratio barcode.setSupHeight(0.8f); // space between barcode and supplement barcode (in pixel) barcode.setSupSpace(15); */ // EAN 8 Unit of Measure, pixel, cm, or inch barcode.setUom(IBarcode.UOM_PIXEL); // EAN 8 bar module width (X) in pixel barcode.setX(3f); // EAN 8 bar module height (Y) in pixel barcode.setY(75f); // EAN 8 image margins barcode.setLeftMargin(0f); barcode.setRightMargin(0f); barcode.setTopMargin(0f); barcode.setBottomMargin(0f); // barcode image resolution in dpi barcode.setResolution(72); // disply barcode encoding data below the barcode barcode.setShowText(true); // barcode encoding data font style barcode.setTextFont(new Font("Arial", 0, 12)); // space between barcode and barcode encoding data barcode.setTextMargin(6); // barcode displaying angle barcode.setRotate(IBarcode.ROTATE_0); barcode.drawBarcode("C:\\ean8.gif");