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
helloBarcode.jsp
Features
1. Usage Method
Generate barcodes through simple Servlet calls:
/servlet/Barcode?type=qrcode&msg=HelloWorld
2. Parameter Description
type
: Barcode type (qrcode, code128, ean13, etc.)msg
: Content to be encoded
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
- Easy to Use: Generate barcodes through URL parameters
- Rich Formats: Supports various 1D and 2D barcode formats
- High-Quality Output: Based on mature open-source libraries
- Flexible Configuration: Adjustable barcode size and content
Considerations
- Content Length: Different barcode types have different length limitations
- Character Set: QR Code supports full character set, other barcode types may have character restrictions
Application Scenarios
- Product Identification: Generate product barcodes using EAN-13/UPC
- Logistics Tracking: Use Code 128 or ITF-14 for logistics management
- URL Sharing: Share URLs or contact information using QR Code
- Asset Management: Use Code 39 for asset identification
- 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.