Barcode Technology

Barcode History

Barcode Label Paper

Barcode Printer

Barcode Application

Inventory Management

AI Barcode QRCode

Barcode Scanner

Barcode Software

Barcode Software B

Barcode Software C

Barcode Software D

Barcode Software E

New Technology A

New Technology B

Robot Technology

Barcode Types

Barcode Types B

Barcode Types C

Barcode Types D

Barcode Types E

Barcode Types F

Electronic Technology

Psychology at Work

Barcode Technology and Barcode Software Related   <<< Back to Directory <<<

ZXing (Zebra Crossing) (P13)

ZXing (Zebra Crossing) Comprehensive Technical Analysis

Part 13 of 17

13. ZXing API Structure and Developer Interface

13.1 Overview of the API philosophy

The ZXing library emphasizes simplicity, modularity, and extensibility. Its API is designed to:

1. Abstract low-level barcode logic

2. Provide uniform interfaces across formats

3. Allow developers to encode, decode, and analyze barcodes with minimal code

4. Enable platform-independent integration through standard object models

The API exposes Reader, Writer, LuminanceSource, and BitMatrix as core abstractions, which together provide a consistent developer experience.

13.2 Core classes and interfaces

The main API components are:

1. `LuminanceSource` Abstracts image data and provides pixel intensity information for decoding.

2. `BinaryBitmap` Encapsulates a binarized version of the image for decoder consumption.

3. `Reader` / `MultiFormatReader` Interfaces for decoding barcodes from binary images.

4. `Writer` / `MultiFormatWriter` Interfaces for generating barcodes from input data.

5. `BitMatrix` Stores logical representation of barcode modules.

6. `Result` Contains decoded information, format, and metadata.

7. `DecodeHintType` Configurable hints to influence decoding behavior.

8. `BarcodeFormat` Enumeration of supported barcode symbologies.

Each of these classes is designed for modularity, allowing developers to mix and match components.

13.3 LuminanceSource and BinaryBitmap

`LuminanceSource`:

* Abstract base class for providing grayscale pixel data

* Supports derived classes for specific platforms (e.g., `BufferedImageLuminanceSource` in Java, `BitmapLuminanceSource` in .NET)

* Enables camera-independent image acquisition

`BinaryBitmap`:

* Wraps `LuminanceSource` after binarization

* Provides a uniform interface for decoders to access black-and-white pixels

* Decouples preprocessing from decoding logic

This separation allows developers to implement custom image sources for webcams, file streams, or synthetic images.

13.4 Reader interface

The `Reader` interface defines methods for decoding:

* `decode(BinaryBitmap)` Attempts to decode a barcode and returns a `Result`

* `decode(BinaryBitmap, Map hints)` Accepts optional hints for fine-tuning decoding

* `reset()` Clears any internal state for reusable instances

Subclasses implement format-specific logic:

* `QRCodeReader`

* `DataMatrixReader`

* `EAN13Reader`

* `Code128Reader`

The MultiFormatReader aggregates these readers and tries them sequentially, providing a convenient single entry point.

13.5 MultiFormatReader

Key features of `MultiFormatReader`:

1. Accepts a set of allowed barcode formats via hints

2. Delegates decoding to individual readers

3. Returns the first valid result

4. Handles orientation and rotation automatically

5. Provides retry logic for challenging images

This class enables plug-and-play barcode recognition without requiring the developer to implement format detection manually.

13.6 Writer interface

The `Writer` interface defines barcode generation:

* `encode(String contents, BarcodeFormat format, int width, int height)` Generates a barcode BitMatrix

* `encode(String contents, BarcodeFormat format, int width, int height, Map hints)` Supports optional encoding hints

Format-specific writers implement:

* `QRCodeWriter`

* `DataMatrixWriter`

* `Code128Writer`

Developers can render the resulting `BitMatrix` to images, PDFs, or screens.

13.7 BitMatrix

`BitMatrix` is the logical representation of a barcode, independent of resolution or rendering technology:

* Stores a 2D array of boolean values (on/off modules)

* Provides methods to set, get, flip, and clear bits

* Supports rotation and mirroring transformations

* Serves as the bridge between encoding and rendering

This abstraction enables consistent behavior across all output formats.

13.8 Result and ResultMetadata

`Result` encapsulates a decoded barcode:

* `getText()` Returns the decoded string

* `getBarcodeFormat()` Returns the symbology

* `getResultPoints()` Provides key points for visual localization

* `getResultMetadata()` Stores additional information such as error correction level, byte segments, and structured append data

Metadata enables advanced applications, including overlay visualization, analytics, and multi-segment reassembly.

13.9 DecodeHintType

`DecodeHintType` allows developers to optimize decoding:

* `TRY_HARDER` Apply more aggressive scanning

* `PURE_BARCODE` Skip pattern detection if the image contains only a barcode

* `ALLOWED_FORMATS` Restrict attempts to specific symbologies

* `CHARACTER_SET` Specify expected encoding

* `ASSUME_CODE_39_CHECK_DIGIT` Assume Code 39 includes a check digit

Hints provide fine-grained control without requiring internal modifications.

13.10 Encoding hints (EncodeHintType)

Similarly, encoding hints influence barcode generation:

* `ERROR_CORRECTION` Selects QR Code error correction level

* `MARGIN` Defines quiet zone size

* `CHARACTER_SET` Defines character encoding for the data

* `PDF417_COMPACT` Applies to PDF417 symbols for compact encoding

* `DATA_MATRIX_SHAPE` Forces square or rectangular Data Matrix symbols

Hints allow developers to customize output for printing, display, or system constraints.

13.11 Exception hierarchy

ZXing defines a structured exception hierarchy:

* `NotFoundException` No barcode detected

* `ChecksumException` Symbol checksum or error correction failed

* `FormatException` Symbol could not be parsed

* `ReaderException` Base class for all reader-specific exceptions

This hierarchy allows developers to handle failures gracefully and implement robust applications.

13.12 Example usage (conceptual)

Decoding a QR Code in Java or C:

1. Load image into a `LuminanceSource`

2. Create a `BinaryBitmap` using a binarizer

3. Instantiate `MultiFormatReader`

4. Call `decode()` with optional hints

5. Retrieve `Result` and metadata

Encoding a QR Code:

1. Instantiate `QRCodeWriter`

2. Call `encode()` with data, dimensions, and optional hints

3. Obtain `BitMatrix`

4. Render to image or screen

This simple API design abstracts complexity while supporting advanced use cases.

13.13 Integration with applications

ZXing APIs are used in:

* Mobile apps (real-time scanning)

* Web applications (browser-based decoding)

* Enterprise systems (batch barcode generation)

* Embedded devices (industrial scanners)

The uniform interface ensures minimal learning curve and cross-platform portability.

13.14 Extensibility

Developers can extend ZXing by:

* Implementing custom `LuminanceSource` for new image sources

* Creating new `Reader` subclasses for specialized barcode formats

* Adding custom `Writer` implementations for proprietary symbols

* Extending `ResultMetadata` for additional application-specific information

The modular API encourages innovation without modifying the core library.

13.15 Summary of Part 13

In this part, we explored:

1. ZXing API philosophy

2. Core classes: `LuminanceSource`, `BinaryBitmap`, `Reader`, `Writer`, `BitMatrix`

3. Multi-format decoding with `MultiFormatReader`

4. Encoding and decoding hints

5. Result and metadata structures

6. Exception handling

7. Example workflows for decoding and encoding

8. Application integration and extensibility

Part 14 will focus on performance optimization and resource management, including strategies ZXing uses for real-time scanning, memory efficiency, and processing large image streams.

 

EasierSoft Barcode Label Design & Bulk Printing Software

---- Use Excel Data to Batch Print Barcodes on Label Sheets or Roll Labels  

---- How to use this barcode software

Download:  Free Barcode Software + Barcode Label Designer

Download Free Barcode Software at Softonic

     Download at CNET

Once you obtain a GS1/UPC/EAN barcode, or other barcode type and QR code, you can use our free software to batch print barcode labels onto Roll label paper using a professional label printer, or to batch print barcodes onto Avery 5160 label sheets using a regular laser or inkjet printer. Our software has free and paid versions.

The free version fully meets your needs for batch printing GS1/UPC/EAN barcodes. The paid version can import data from Excel and databases to batch print barcode labels with different values.

How to Start

Input Data

Import Excel Data

Print Barcode

Barcode Format

Label Designer

All Screen Shot

Export Barcode Image

Save Template

Output Word Excel

How to Use & FAQ:

The supported barcode types

Load Excel data (pro)

Manually copy data from Excel files

Filter some data for printing

Edit imported barcode data

Input data (Pro)

Label Designer

Edit data in Label designer

Label Designer - Add new label

Label Designer - Printing

Set the barcode label format to be printed

Other Barcode Label Format Settings

Barcode types supported by this program

Barcode Label Font Settings

Configuring the Barcode Print Rotation

Text Alignment for Barcode Labels

Automatically Adjusting Barcode Width

Text Beneath the Barcode

Configuring Barcode Size

Auto Calculate the Barcode Size

Export Barcode images

Export Barcode Image Format

File Names for Exported Barcode

Resolution of Exported Barcode Images

Fixed Folder for Exporting Barcode

Default Barcode Image Export Format

Print bulk barcodes quickly

Print barcodes to Avery 5160 label

How to bulk Barcode Printing

Sample - Avery 5162 (2x7) Label Sheet

Example: Print barcodes to 5*3cm roll

Example: Print barcodes to 5161 label

Example: Print barcodes to 5162 label

Example: Print barcodes to 5163 label

Example: Print barcodes to 5164 label

Example: Print portrait orientation 5164

Example: Print barcodes to 5167 label

Example: Print barcodes to 5168 label

Example: Print portrait orientation 5168

Example: Print barcodes to 5169 label

Example: Print barcodes to 5660 label

Example: Print barcodes to 5661 label

Example: Print barcodes to 5662 label

Example: Print barcodes to 5663 label

Example: Print barcodes to 5664 label

Example: Print portrait orientation 5664

Example: Print barcodes to 5873 label

Example: Print barcodes to 5874 label

Two ways to import Excel data

Import Excel Data - Pro Edition

Highlights

Excel integration: Import data directly from Excel to generate and print barcodes in bulk.

Label designer: Create complex labels with multiple barcodes, text, logos, and shapes.

Batch printing: Print thousands of barcodes at once using standard inkjet/laser printers or professional barcode printers.


Flexible editions:

Standard Edition: Simple batch printing with Excel data.

Professional Edition: Adds command-line automation for workflow integration.

Label Designer Edition: Advanced design features for complex labels.


Why Choose Our Barcode Solutions?

Cost-effective: Free online generator and permanent free desktop version available.

Easy to use: No technical expertise required—just input data and print.

Versatile: Supports nearly all 1D and 2D barcode types, including QR codes.

Trusted: Recommended by CNET and widely downloaded by users worldwide.


Suitable Use Cases

Small businesses and startups needing quick barcode labels for products.

Retailers and online sellers managing inventory with batch barcode printing.

Manufacturers requiring sequential or custom barcode labels for packaging.

Educational and testing environments where barcodes are used for tracking.

 

 

CONTACT

cs@easiersoft.com

If you have any question, please feel free to email us.

 

https://free-barcode.com

 

<<< Back to Directory <<<     Barcode Generator     Barcode Freeware     Privacy Policy