Enhanced fork of boombuler/barcode with extended PDF417 barcode configuration options.
This fork adds the ability to precisely control the number of columns in PDF417 barcodes through the Options structure.
type Options struct {
ECCLevel byte // Error Correction Code Level (0-8)
Columns int // Number of columns (0 = auto, 1-30 = fixed)
}ECCLevel (Error Correction Code Level)
- Range: 0-8
- Controls error correction level
- Higher level = more redundancy, but larger barcode size
Columns (Number of columns)
0- automatic calculation of optimal column count1-30- fixed number of columns- Allows creating barcodes of specific width
import "github.com/Rapir-0/barcode/pdf417"
// Standard generation
barcode, err := pdf417.Encode("Hello World", 0)
if err != nil {
log.Fatal(err)
}import "github.com/Rapir-0/barcode/pdf417"
// Generation with custom options
options := pdf417.Options{
ECCLevel: 4, // Medium error correction level
Columns: 10, // Fixed 10 columns
}
barcode, err := pdf417.EncodeWithOptions("Hello World", options)
if err != nil {
log.Fatal(err)
}// Compact barcode (minimum columns)
compact := pdf417.Options{ECCLevel: 0, Columns: 1}
// Wide barcode with high reliability
wide := pdf417.Options{ECCLevel: 8, Columns: 30}
// Automatic selection with high error correction
auto := pdf417.Options{ECCLevel: 6, Columns: 0}- Fully compatible with the original boombuler/barcode library
- All existing functions and interfaces preserved
- New functionality available through additional methods
This fork inherits all capabilities of the original library:
- Support for multiple barcode types
- High performance
- Simple API
- Scaling and color schemes
go get github.com/Rapir-0/barcode/pdf417MIT License (inherited from the original library)
Fork Author: Rapir-0
Original Library: boombuler/barcode