Patch Code - Dynamsoft Barcode Reader SDK
What is a Patch Code?
Originally created by Kodak to help processing applications separate large documents, the patch code appears at page/section breaks to give instructions such as when to change from single-sided to duplex scanning.
A patch code is a type of barcode that consists of alternating black parallel bars and spaces. Once scanned, typically with a TWAIN driver, it can carry out a predefined action.
However, unlike most barcodes, Patch Codes do not contain any encoded data. While they are printed on all four edges of a document, only one is ever read. This allows the code to be read even if the page is upside down or rotated.
Additional barcodes, such as Code 39, can also be added to the page to convey encoded information.
There are six distinct barcode patterns, each consisting of varying arrangements of wide and narrow bars:
- Patch 1 (wide, wide, narrow, narrow) used for post-scan image control
- Patch 2 (wide, narrow, narrow, wide) assigns image level 2 to the current document
- Patch 3 (wide, narrow, wide, narrow) assigns image level 3 to the current document
- Patch 4 (narrow, wide, wide, narrow) used for post-scan image control (toggle patch)
- Patch 6 (narrow, narrow, wide, wide) used for post-scan image control
- Patch T (narrow, wide, narrow, wide) assigns predefined image level to the next document (transfer patch)
Where is a Patch Code used?
Where they really shine is in batch scanning documents. This is common across many industries where a large number of documents need to be processed using a document scanner and then organized in a digital format.
Instead of running multiple scans, which would require scanning each document separately, the documents are loaded into the scanner with a Patch 2 separating the different areas of the document.
If you’re scanning hundreds of documents such as loan applications, or tax information, you can incorporate a Patch 2 codes on the first page to indicate the start of a new form. Or, if you need to separate different sections of the document, you can prepare the document by inserting these barcodes into the different sections, which instruct the capture software to organize documents into separate files.
Another application is to use Patch 4 (color toggle) to separate black and white pages from colored pages. It works by placing Patch 4 codes before and after the color sections.
The following process is carried out by the document capture software:
- 1. The scanner begins scanning in black and white
- 2. When it reaches the first Patch 4 code, it toggles the scanner to scan the next section in color
- 3. When it encounters the second toggle patch, the scanner reverts to scanning the pages in black and white
The action taken by the document capture software upon recognizing a Patch Code is configurable to a given application. For instance, the toggle patch may be used to toggle between high and low resolutions, as well as single- or multi-sided scanning.
- Patch Codes 1, 4, and 6 are used for color or multi-feed detection
- Patch Code 2 is used for document separation
- Patch Code 3 is used for batch separation
- Patch Code T can be used for either document or batch separation
How could Dynamsoft help you with Patch Code?
Dynamsoft barcode reader enables you to efficiently embed high-speed and reliable barcode reading functionality in your web, desktop or mobile application using just a few lines of code.
Download the free trial SDK, explore our helpful resource center including sample codes, tutorials, guides and more to get started.
FAQ
1. Why are Patch Codes printed on all four edges of a page?
A separator sheet may enter the scanner in any orientation, so printing the pattern on all four edges ensures detection. Only one Patch Code is read; the others serve as backups. Patch Codes do not store data; the pattern of wide and narrow bars provides the instruction.
2. Can Code 39 and Patch Codes be used together on the same page?
Yes. Patch Codes are often used with Code 39 for indexed batch scanning. The Patch Code instructs the capture software, while a Code 39 or Code 128 on the same sheet provides data such as batch number, account ID, or form type. This approach enables both separation and indexing in one scan. Dynamsoft Barcode Reader can read both from a single page image.
3. How do you use a Patch Code to separate scanned documents?
To separate documents, use Patch 2 sheets. To separate batches, use Patch 3 sheets. Put a patch sheet at the beginning of each document, load the stack, and then scan all the pages together. Each time the software comes across a patch, it closes the existing file and opens a new one. Patch T can be used to separate documents or batches. Patches 1, 4, and 6 are used for imaging controls, with Patch 4 being commonly used to switch between color sections.
4. What happens if a Patch Code isn't detected during a scan?
When a Patch Code is missed, the pages are not separated and are instead combined with those from the previous document. This could cause the whole batch to be saved as a single file with wrong index values. Common causes include a resolution below 200 DPI, excessive skew, low contrast due to photocopied separator sheets, or incorrect bar sizes. Therefore, print the separators from the original master and check that the number of detected separators matches the number of documents to detect any problems.
5. How can I test if my application can read Patch Codes?
You can upload a scanned page to the free online scanner at the top of this page. It runs in your browser, so your file remains on your device. For real-world testing, use your own production scans along with the Barcode Test Sheet and Barcode Dataset, which include skewed and low-contrast images. Then process these files through your workflow with the 30-day trial SDK.