Understanding Barcode Document Separation
TL;DR
Barcode document separation splits a scanned batch into individual documents by reading barcodes placed on the pages: a separator sheet between documents, a cover sheet on each document's first page, or a code stamped on every page that carries the document's number. Because it reads marks instead of interpreting content, it is deterministic, needs no model, and costs milliseconds per page. In LM-Kit.NET, the BarcodeSplitting class implements it for PDFs, multi-page TIFFs and images, and BarcodeReader reads barcodes on their own.
What is Barcode Document Separation?
Definition: Barcode document separation is the stage of a scanning or Intelligent Document Processing (IDP) pipeline that decides where each document of a batch begins and ends from barcodes printed on the pages. The barcode also carries a value (a case number, a customer id) that names, labels and routes the resulting document.
Why It Matters
- Determinism: the same batch always splits the same way, which audit and compliance workflows require.
- Speed and cost: no inference, no GPU; a page is decoded in milliseconds.
- Existing practice: operators already print separator and cover sheets; the split honors the workflow they know.
- Routing: the value read from the barcode names the output file and selects the next stage of the pipeline.
Separation Strategies
| Strategy | The barcode... | Typical batch |
|---|---|---|
| Separator sheet | stands on a sheet between two documents, usually removed from the output | reusable sheets slipped between documents |
| First page marker | marks a document's first page, which stays in it | cover sheets, stamped first pages |
| Last page marker | marks a document's last page | a closing slip after each document |
| Value change | carries a value; a new document starts when it changes | every page stamped with its file number |
| Group by value | carries a value; all pages with that value form one document | a mixed stack, pages out of order |
Two practical concerns come with every strategy:
- Unrelated barcodes: invoices carry EAN codes, parcels carry shipping labels. A match rule (symbology, value, pattern, page area) decides which barcodes count.
- Duplex scanning: a single-sided separator sheet scanned in duplex leaves a blank back page, which the split removes.
Barcode Separation vs. AI Splitting
| Barcode separation | AI splitting | |
|---|---|---|
| Input requirement | Batch marked with barcodes | Any batch |
| Decision | Read the marks | Interpret page content with a vision model |
| Determinism | Always the same result | Model-dependent |
| Cost | Milliseconds per page, CPU only | Model inference per page |
| LM-Kit.NET class | BarcodeSplitting |
DocumentSplitting |
Both return documents with page ranges, and BarcodeSplittingResult.ToDocumentSplittingResult() converts a barcode split to the AI splitter's result type, so downstream pipelines accept either.
Code Example
using LMKit.Extraction.Barcodes;
var splitter = new BarcodeSplitting(new BarcodeSplittingOptions
{
Mode = BarcodeSplitMode.FirstPageOfDocument,
Match = new BarcodeMatchRule { Formats = new[] { BarcodeFormat.QRCode } },
ValuePattern = @"CASE-(?<value>\d+)",
FileNameTemplate = "case_{value}"
});
BarcodeSplittingResult result = splitter.SplitToFiles("claims_batch.pdf", "cases");
foreach (BarcodeSegment segment in result.Segments)
Console.WriteLine($"{segment.Label}: pages {segment.StartPage}-{segment.EndPage}");
Key Terms
- Separator sheet: a page carrying a barcode that stands between two documents of a batch.
- Cover sheet: a barcoded first page that identifies the document it opens.
- Symbology: the barcode family (QR Code, Data Matrix, Code 128, PDF417, and so on).
- Match rule: the conditions a barcode must meet to count for the split.
- Document value: the text read from the delimiting barcode, used as the document's label and file name.
Related API Documentation
BarcodeSplitting: Splits batches into documents by barcodesBarcodeSplittingOptions: Mode, match rule, value, blank pages, outputsBarcodeMatchRule: Which barcodes countBarcodeReader: Reads barcodes on images and document pages
Related Glossary Topics
- Intelligent Document Processing (IDP): The pipelines barcode separation feeds
- Optical Character Recognition (OCR): Usually the next stage after the split
- Classification: Assigning a type to each separated document
- Structured Data Extraction: Pulling fields out of each separated document
External Resources
- Split Scanned Batches by Barcode: Step-by-step guide
- Barcode Document Splitting Demo: Console sample that splits a batch and reports every page
Summary
Barcode document separation turns a scanned batch into individual, named documents by reading the barcodes operators already place on separator sheets, cover sheets or every page. It is deterministic, fast and model-free. In LM-Kit.NET, BarcodeSplitting covers every separation strategy with match rules, document values, duplex blank page removal and file, stream or in-memory outputs, and hands its result to the same pipelines as the AI splitter.