Barcode & Label Software

Barcode-Lib4J – A free Java Library for 1D and 2D Barcodes

BARCODE-Lib4J – Free Java library for precise drawing, printing and storage of 1D & 2D barcodes in vector (PDF, EPS, SVG) and raster (PNG, BMP, JPG) images. Proven in practice through its use in our software products.


  • Drawing and printing 1D & 2D barcodes using Java2D (java.awt.Graphics2D)
  • Exporting to PDF: Compliance with PDF/X-1a:2001 for CMYK and PDF/X-3:2002 for RGB
  • Exporting to EPS: Generation of an optional embedded TIFF preview, supports RGB and CMYK colors
  • Exporting to SVG: Supports RGB colors only
  • Barcode precision: Coordinates are stored with up to 6 decimal places in all supported vector formats
  • Exporting to PNG, BMP, JPG: DPI resolution stored in file header. No unwanted effects such as aliasing, etc.
  • Adjustment of bar widths to printer resolution (essential for proper barcode quality at <= 600 dpi)
  • Bar width reduction/correction (useful for addressing ink spread on inkjet printers)
  • Barcodes include minimum distances ("quiet zones")
  • Barcode number placement options: on top, bottom, or invisible
  • Customizable plain text line: font + font size, spacing, modifiable content
  • Automatic font size adjustment, if desired
  • Advanced setting: enables printing with a user-defined module width
  • Optionally transparent background (Supported in EPS, PDF, SVG and PNG)
  • Rotation in 90-degree increments
  • Configurable ratio from 2:1 to 3:1 for barcode types that support it
  • Add-On 2/5 for barcodes like EAN-13, EAN-8, ISBN-13 and UPC-A, second plain text line for ISBN and ISMN
  • Comprehensive support for GS1 barcodes: Includes data integrity checks, validation of application identifiers, checks for length and content of user data, verification/calculation of the check digit in SSCC and GTIN and more.

Supported 1D and 2D Barcodes

  • 1D Barcodes: Code 128, Code 128 A, Code 128 B, Code 128 C, 2 of 5 Interleaved, Code 39, Code 39 Extended, GS1-128 (EAN-128), GTIN-13 (EAN-13), GTIN-8 (EAN-8), UPC-A, UPC-E, ISBN-13, ISMN, Code 93, Code 93 Extended, GTIN-14 (EAN-14), SSCC-18 (NVE), PZN, PZN8, Codabar.
  • 2D Barcodes: QR Code, GS1 QR Code, DataMatrix, GS1 DataMatrix, PDF417, Aztec.


OpenPDF version 1.3.0 or higher is required for PDF export or when compiling the source code. The compiled code is runnable without the library.
Barcode-Lib4J Version: 2.0.0
Size: 463 KB
License: Apache 2.0
Minimum Java: 9

Source + Docs: DOWNLOAD
JavaDoc online