Free plan

Split scan by barcode

Split a batch scan into separate PDFs by barcode sheets
POST
/v1/pdfs/split-by-code

About this tool

When you scan a big pile of different documents, you can put a sheet with a barcode or QR code between them. This tool reads the codes on the pages and cuts the scan into separate PDFs where a separator sheet appears, or where the code value changes. Each file can be named from its code. All files come in one ZIP.
For example, you scanned a batch of customer forms with a barcode sheet before each customer and want one PDF per customer.

How to use it

  1. Choose this tool.
  2. Add your scanned PDF.
  3. Choose whether a separator sheet starts a new document, or a change in code value does.
  4. If needed, type which codes count, whether to drop the separator sheets and whether to name files from the code.
  5. Press Generate, then download the ZIP.

What you get back

You get a ZIP file holding one PDF per document. You can download it and unpack it.
GOOD TO KNOW
A code is read from the picture of each page. Without any code the whole file is returned as one document, with a warning. Counts as one PDF operation.
TEST IT LIVE

Try Split scan by barcode in the Studio

One click opens the Studio with this tool already selected. Add your file and see the result in seconds.
Open in the Studio
Family
PDFs
Plan
Free
Method
POST
Endpoint
/v1/pdfs/split-by-code
Tool ID
pdfs.split-by-code
Authentication
API key
Accepts
PDF
Background jobs
Yes
Usage group
Pdf
For developers

Use it from your code

cURL

curl -X POST "https://app.h2i.davixlabs.io/v1/pdfs/split-by-code" \
  -H "X-Api-Key: $DAVIX_H2I_API_KEY" \
  -F 'file=@document.pdf' \
  -F 'mode=separator' \
  -F 'pattern=SPLIT*' \
  -F 'unmatched=previous'

Node.js

const { DavixH2I } = require('@davixlabs/h2i-sdk');

const h2i = new DavixH2I({ apiKey: process.env.DAVIX_H2I_API_KEY, baseUrl: process.env.DAVIX_H2I_URL });
const result = await h2i.pdfs.splitByCode({
    "file": 'document.pdf',
    "mode": "separator",
    "pattern": "SPLIT*",
    "unmatched": "previous"
  });
console.log(result.data, result.requestId);

PHP

<?php
require 'vendor/autoload.php';

$h2i = new \Davix\H2I\Client(['apiKey' => getenv('DAVIX_H2I_API_KEY'), 'baseUrl' => getenv('DAVIX_H2I_URL')]);
$result = $h2i->pdfs()->splitByCode([
    'file' => 'document.pdf',
    'mode' => 'separator',
    'pattern' => 'SPLIT*',
    'unmatched' => 'previous',
]);
echo $result->requestId;
FAQ

Frequently asked questions

Cut a scanned batch of documents into separate PDFs where a separator sheet with a barcode appears (or where the code value changes), each named from its code, as one ZIP.

Split scan by barcode accepts PDF. You can send several files in one request.

Split scan by barcode is included in every plan, including Free. Each run uses credits from your monthly allowance.

Send a POST request to /v1/pdfs/split-by-code with your API key in the X-Api-Key header. Official SDKs for Node.js, Python, PHP, Go, Java, .NET and Ruby do the same for you, and the code box on this page shows ready-to-copy examples. For large work it can also run as a background job, so your request returns straight away.