CreatePdfZXingBarcodeProvider는 ZXing-C++ 2.3.0으로 빌드한 대상 환경에 맞는 네이티브 브리지의 절대 경로를 받아 IPdfBarcodeProvider를 제공합니다
TryCreatePdfZXingBarcodeProvider는 프로세스의 검색 경로를 바꾸지 않고 라이브러리나 export 누락, 호환되지 않는 브리지 ABI를 보고합니다
EPdfBarcodeBackendError는 EPdfProduction에서 파생되며 모든 백엔드 실패에 대해 발생합니다. 누락된 브리지 라이브러리나 export, 지원되지 않는 ABI 버전, 유한 한도를 벗어난 옵션, 소진된 예산, 백엔드가 반환한 잘못된 텍스트나 지오메트리가 그 대상입니다
Code128, QR, DataMatrix, PDF417을 생성하며 요청한 모듈 크기의 검은 벡터 사각형을 반환합니다. Code128은 지원하는 문자 집합을 받으며 매트릭스 코드는 Unicode 텍스트를 지원합니다
QuietZoneModules는 검은 사각형을 왼쪽과 위쪽에서 띄웁니다. 결과를 배치하거나 래스터화할 때는 호출자가 오른쪽과 아래쪽에도 흰 여백을 확보해야 합니다
인식 입력은 위에서 아래 순서의 1바이트 회색조 데이터와 명시적인 너비, 높이, stride입니다. 경계는 반열린 픽셀 사각형이며 confidence 1은 디코딩 성공을 뜻하고 통계적 확률은 아닙니다
TPdfZXingBarcodeOptions는 공급자의 수명 동안 이를 제한합니다. 유한 한도를 벗어난 값은 무제한 작업을 네이티브 브리지로 전달하는 대신 EPdfBarcodeBackendError와 함께 생성에 실패합니다
MaxPixels는 생성되는 바코드 이미지와 인식 입력을 최대 폭×높이 4,194,304 픽셀로 제한하며, 더 큰 이미지는 EPdfBarcodeBackendError를 일으킵니다
MaxTextBytes는 UTF-8 페이로드를 생성 입력과 디코딩된 각 인식 결과에 대해 32,768바이트로 제한합니다
MaxRectangles는 한 생성 호출이 출력할 수 있는 벡터 사각형을 1,000,000개로 제한합니다. 더 많이 필요로 하는 바코드는 EPdfBarcodeBackendError를 일으킵니다
기본 상한은 4,194,304픽셀, UTF-8 텍스트 32,768바이트, 벡터 사각형 1,000,000개이며 여백은 4, 오류 정정 수준은 2입니다
ErrorCorrectionLevel은 생성기 오류 정정 강도를 0부터 8까지에서 선택하며 공급자 생성 시 검증됩니다
QR 오류 정정 수준은 0–2가 L, 3–4가 M, 5–6이 Q, 7–8이 H입니다. PDF417은 0–8을 사용하며 Code128과 DataMatrix는 이 옵션을 무시합니다
요청한 최대값이 더 커도 인식 결과는 최대 255개 심벌입니다. 기존 프로바이더 인터페이스에는 취소 토큰이 없습니다
빌드 설명과 실행 가능한 인코딩/디코딩 예제는 Native/BarcodeZXing와 Tests/BarcodeProvider에 있습니다. 이번 변경에는 네이티브 브리지 바이너리나 의존성 소스를 포함하지 않습니다
실제 Delphi/FPC Win32/Win64 실행에서 회전, 반전, Unicode를 포함한 인코딩/디코딩 왕복 60회를 검증했습니다. Linux 네이티브 브리지도 15회 왕복을 검증했지만 Pascal 프로바이더에는 래퍼의 Windows 의존성이 계속 적용됩니다
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;