efw Barcode and QR Code Generation Example

Overview

The efw framework provides powerful barcode and QR code generation capabilities that can generate various types of barcodes and QR codes through simple Servlet calls. This functionality is implemented based on ZXing and Barcode4j libraries, supporting multiple barcode formats including QR Code, Code 128, EAN-13, and more.

Core Files

Features

1. Usage Method

Generate barcodes through simple Servlet calls:

/servlet/Barcode?type=qrcode&msg=HelloWorld

2. Parameter Description

Supported Barcode Types

2D Barcode Types

Type Description Features
QR Code Quick Response Code Supports Chinese characters, large data capacity, fast reading
Data Matrix Data Matrix Code High-density encoding, small size printing
PDF417 Portable Data File Stacked QR code, high error tolerance

1D Barcode Types

Type Description Application Scenarios
Code 128 High-density Linear Code Logistics, warehouse management
Code 39 Standard 39 Code Industrial identification, asset management
EAN-13 International Article Number Retail product identification
EAN-8 Shortened Article Number Small packaging products
UPC-A Universal Product Code North American retail
UPC-E Compressed UPC Code Space-limited applications

Specialized Barcode Types

Type Description Application Fields
ITF-14 Interleaved 2 of 5 Code Logistics packaging identification
Codabar Codabar Code Libraries, blood banks
Postnet Postal Numeric Encoding Mail sorting
RM4SCC Royal Mail 4-State Customer Code UK postal service
USPS 4CB Intelligent Mail Barcode US postal service

Core Features

  1. Easy to Use: Generate barcodes through URL parameters
  2. Rich Formats: Supports various 1D and 2D barcode formats
  3. High-Quality Output: Based on mature open-source libraries
  4. Flexible Configuration: Adjustable barcode size and content

Considerations

  1. Content Length: Different barcode types have different length limitations
  2. Character Set: QR Code supports full character set, other barcode types may have character restrictions

Application Scenarios

  1. Product Identification: Generate product barcodes using EAN-13/UPC
  2. Logistics Tracking: Use Code 128 or ITF-14 for logistics management
  3. URL Sharing: Share URLs or contact information using QR Code
  4. Asset Management: Use Code 39 for asset identification
  5. Postal Services: Use specialized postal barcodes for mail processing

Summary

The efw framework’s barcode generation functionality provides a simple yet powerful solution that can generate various types of barcodes and QR codes through Servlet calls. Whether for retail product identification, logistics management, or information sharing, suitable barcode types can be found to meet requirements. Based on mature ZXing and Barcode4j libraries, it ensures the quality and reliability of generated barcodes.