Overview
Barcode detection identifies and decodes barcodes found in document pages. Each detected barcode is returned as a structured page fragment with its decoded value, barcode type, and bounding box — allowing downstream processing to handle barcodes separately from text, tables, and other content. Barcode detection is available in themodel03 OCR model and is enabled via a flag in ParsingOptions.
Enabling Barcode Detection
Setbarcode_detection="true" in your ParsingOptions along with ocr_model="model03":
Barcode detection requires Tensorlake Python SDK version
0.2.91 or later. Run pip install --upgrade tensorlake before using this feature.How It Works
When barcode detection is enabled, the pipeline:- Parses each page into fragments (text, tables, barcodes, etc.)
- Runs a barcode detector and decoder over the page image
- Emits
fragment_type: "barcode"entries alongside other page fragments - Includes bounding boxes and page dimensions so barcodes can be positioned or highlighted in a viewer
Fragment Output
Each detected barcode is returned as a fragment with the following structure:| Field | Description |
|---|---|
fragment_type | Always "barcode" for barcode fragments |
content.content | The barcode type and decoded value, formatted as "<TYPE>: <value>" |
reading_order | Position of this fragment in reading order relative to other page fragments |
bbox | Bounding box coordinates (x1, y1, x2, y2) in page pixels |
Common Use Cases
Barcodes appear across many operational document types:- Shipping labels and packing slips — tracking numbers and carrier codes
- Lab reports and sample labels — specimen and sample IDs
- Insurance documents — claim IDs and policy references
- Utility bills, tickets, and receipts — account numbers and confirmation codes
- Match barcode values to internal IDs (shipment, claim, order, patient)
- Validate that a barcode value matches a printed text label on the same page
- Flag documents where an expected barcode is missing or unreadable
- Render barcode overlays in a document viewer using the provided bounding boxes