CreatePdfZXingBarcodeProvider provides an IPdfBarcodeProvider by loading a native bridge built from ZXing-C++ 2.3.0; supply its absolute path and ensure it matches the target
TryCreatePdfZXingBarcodeProvider diagnoses missing libraries or exports and incompatible bridge ABIs, leaving the process search path untouched
The generator produces Code128, QR, DataMatrix and PDF417 as black vector rectangles at the chosen module size; Code128 is limited to its supported character set, whilst the matrix formats accept Unicode text
QuietZoneModules leaves space above and to the left of the black rectangles; when placing or rasterising them, reserve a white quiet zone below and to the right as well
For recognition, supply top-down single-byte greyscale data together with width, height and stride; returned bounds are half-open pixel rectangles, and confidence 1 indicates an accepted decode rather than a statistical probability
The default allowances are 4,194,304 pixels, 32,768 bytes of UTF-8 text and 1,000,000 vector rectangles; the quiet zone is 4 and the error-correction level is 2
For QR, levels 0–2 mean L, 3–4 mean M, 5–6 mean Q and 7–8 mean H; PDF417 accepts 0–8, whilst Code128 and DataMatrix disregard this setting
A recognition call returns no more than 255 symbols, regardless of a larger requested limit; the existing provider interface does not expose a cancellation token
See Native/BarcodeZXing for building the bridge and Tests/BarcodeProvider for a runnable encoding/decoding example; this change includes neither bridge binaries nor dependency source
Actual Delphi/FPC Win32/Win64 runs pass 60 encoding/decoding round trips covering rotation, inversion and Unicode; the native Linux bridge passes 15 round trips, although the Pascal provider still depends on the wrapper's Windows facilities
Provider := CreatePdfZXingBarcodeProvider( BridgePath, TPdfZXingBarcodeOptions.Default); Rects := GeneratePdfBarcode(pbkQr, 'Invoice 12345', 2, Provider); Results := RecognisePdfBarcodes(Pixels, Width, Height, Stride, Provider, 256);
type
EPdfBarcodeBackendError = class(EPdfProduction);
TPdfZXingBarcodeOptions = record
MaxPixels: Int64;
MaxTextBytes: Integer;
MaxRectangles: Integer;
QuietZoneModules: Integer;
ErrorCorrectionLevel: Integer;
class function Default: TPdfZXingBarcodeOptions; static;
end;
// Recognition accepts top-down, one-byte grayscale pixels with explicit stride
// Bounds are half-open pixel rectangles; Confidence=1 denotes a valid decode
// The backend does not supply a statistical confidence estimate
// A recognition call returns at most 255 symbols, even with a higher requested limit
function CreatePdfZXingBarcodeProvider(const BridgeLibraryPath: string;
const Options: TPdfZXingBarcodeOptions): IPdfBarcodeProvider;
function TryCreatePdfZXingBarcodeProvider(const BridgeLibraryPath: string;
const Options: TPdfZXingBarcodeOptions; out Provider: IPdfBarcodeProvider;
out ErrorMessage: string): Boolean;