DetectPageBarcodesJSON

Barcode recognition, document inspection, rendering

Description

Recognizes supported one-dimensional and two-dimensional barcodes in a full page or bounded page region and returns deterministic JSON with decoded content and page-space geometry

Syntax

Delphi

Function TPDFlib.DetectPageBarcodesJSON(Page: Integer;
  Left, Top, Width, Height, DPI: Double; Formats: Integer= 0;
  Options: Integer= 0; MaxResults: Integer= 32): WideString;

ActiveX

Function PDFlib::DetectPageBarcodesJSON(Page As Long,
  Left As Double, Top As Double, Width As Double, Height As Double,
  DPI As Double, Formats As Long, Options As Long,
  MaxResults As Long) As String

DLL

const wchar_t* DLDetectPageBarcodesJSON(int InstanceID, int Page,
  double Left, double Top, double Width, double Height, double DPI,
  int Formats, int Options, int MaxResults);
const char* DLDetectPageBarcodesJSONA(int InstanceID, int Page,
  double Left, double Top, double Width, double Height, double DPI,
  int Formats, int Options, int MaxResults);

Parameters

PageThe one-based page number
Left, TopThe region origin in page user-space points measured from the top-left corner
Width, HeightThe region size in page user-space points; set all four region values to zero to scan the full page
DPIThe rendering resolution from 24 through 2400 after applying RenderScale; zero selects 300 DPI
FormatsA mask of the PDF_BARCODE_FORMAT_* constants PDF_BARCODE_FORMAT_AZTEC, PDF_BARCODE_FORMAT_CODABAR, PDF_BARCODE_FORMAT_CODE39, PDF_BARCODE_FORMAT_CODE93, PDF_BARCODE_FORMAT_CODE128, PDF_BARCODE_FORMAT_DATABAR, PDF_BARCODE_FORMAT_DATABAR_LIMITED, PDF_BARCODE_FORMAT_DATABAR_EXPANDED, PDF_BARCODE_FORMAT_DATAMATRIX, PDF_BARCODE_FORMAT_EAN8, PDF_BARCODE_FORMAT_EAN13, PDF_BARCODE_FORMAT_ITF, PDF_BARCODE_FORMAT_MAXICODE, PDF_BARCODE_FORMAT_PDF417, PDF_BARCODE_FORMAT_QRCODE, PDF_BARCODE_FORMAT_MICRO_QRCODE, PDF_BARCODE_FORMAT_RM_QRCODE, PDF_BARCODE_FORMAT_UPCA, PDF_BARCODE_FORMAT_UPCE, and PDF_BARCODE_FORMAT_DX_FILM_EDGE; zero selects PDF_BARCODE_FORMAT_ANY (every format)
OptionsA mask of PDF_BARCODE_TRY_HARDER, PDF_BARCODE_PURE, PDF_BARCODE_RETURN_ERRORS, PDF_BARCODE_DISABLE_ROTATE, PDF_BARCODE_DISABLE_INVERT, and PDF_BARCODE_DISABLE_DOWNSCALE
MaxResultsThe maximum result count from 1 through 255

Return values

Returns a JSON object containing the page, effective DPI, requested region, result count, and result objects with formatName, text, content type, symbology identifier, error-correction level, orientation, validity flags, four page-space corner points, and bounds

Returns an empty string when validation, rendering, backend loading, or recognition fails

Remarks

The method renders only the requested region into a bounded top-down BGR bitmap and restores the previously selected page before returning

Deploy PDFlibBarcode32.dll or PDFlibBarcode64.dll beside the host executable, PDFlib DLL, or ActiveX module according to process architecture; PDFLIB_BARCODE_READER may specify an alternate absolute backend path

LastErrorCode is 115 for invalid page, geometry, masks, resolution, or limits and 519 for rendering, backend, or recognition failures

See also

RenderPageRegionToFile, DrawBarcode, LastErrorCode