Link Search Menu Expand Document

PDF Split By Barcode

Split PDF into multiple PDF files.

Available Methods

[POST] /pdf/split2 (split by barcode)

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching. You can also encrypt data for output files and decrypt data input files with user-controlled data encryption (uses strong AES encryption with your own keys). Click here to learn more.
  • searchString (required). Text to search for on pages. Must be a String.

To search for a barcode use the following macros string: [[barcode:<barcodeTypesSeparatedByComma> <barcodeValue>]].

To search for barcode type without analyzing its value, use this notation instead:

[[barcode:<barcodeTypesSeparatedByComma>]].

Supported Barcode types:

AustralianPostCode
Aztec
BorderedTable
Checkbox
Circle
CircularI2of5
Codabar
CodablockF
Code128
Code16K
Code39
Code39Extended
Code39Mod43
Code39Mod43Extended
Code93
DataMatrix
DPMDataMatrix
EAN13
EAN2
EAN5
EAN8
GS1
GS1DataBarExpanded
GS1DataBarExpandedStacked
GS1DataBarLimited
GS1DataBarOmnidirectional
GS1DataBarStacked
GTIN12
GTIN13
GTIN14
GTIN8
HorizontalLine
IntelligentMail
Interleaved2of5
ITF14
MaxiCode
MICR
MicroPDF
MSI
Oval
PatchCode
PDF417
Pharmacode
PostNet
PZN
QRCode
Rectangle
RoyalMail
RoyalMailKIX
Segment
Trioptic
UnderlinedField
UPCA
UPCE
UPU
VerticalLine

Example 1: split by qr code

..
"searchString": "[[barcode:qrcode]]",
..

Example 2: split by qr code with value

..
"searchString": "[[barcode:qrcode bytescout]]",
..

Example 3: split by qr code with value search with regex

..
"searchString": "[[barcode:qrcode /bytescout\\.com/]]",
..

Example 4: split by qr code or datamatrix with value search with regex

..
"searchString": "[[barcode:qrcode,datamatrix /bytescout\\.com/]]",
..
  • excludeKeyPages (optional). Set to true if you want to exclude pages where text was found. false by default.
  • regexSearch (optional). Set to true to enable regular expressions for search string. false by default.
  • caseSensitive (optional). Set to true to enable case sensitive search. false by default.
  • lang optional. Sets language for OCR (text from image) to use for scanned PDF, PNG, JPG documents input when extracting text. Default is “eng”. Other languages are also supported: deu, spa, chi_sim, jpn and many others (full list of supported OCR languages is here. You can also use 2 languages simultaneously like this: eng+deu or jpn+kor (any combination).
  • async optional. Runs processing asynchronously. Returns JobId that you may use with /job/check to check state of the background job (possible states: working, failed, aborted and success). Must be one of: true, false.
  • inline optional. false by default. In async mode makes to return body with the content of the output json (with the links to the output).
  • name optional. name of the output file.
  • expiration (optional). Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage. Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
  • httpusername (optional) - http auth user name if required to access source url.
  • httppassword (optional) - http auth password if required to access source url.
  • profiles optional. Must be a String. Use this parameter to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.

  • Method: POST
  • URL: /v1/pdf/split2

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3.us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-split/split_by_barcode.pdf",
    "searchString": "[[barcode:qrcode,datamatrix /bytescout\\.com/]]",
    "excludeKeyPages": true,
    "regexSearch": false,
    "caseSensitive": false,
    "inline": true,
    "name": "output-split-by-barcode",
    "async": false
}

Example responses

/pdf/split2 (split by barcode)
{
    "urls": [
        "https://pdf-temp-files.s3.us-west-2.amazonaws.com/A2WX2GR0PX4818EIKW96VR3BZTK5FWT2/output-split-by-barcode_page1.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzEK3%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDH1Gv1Q88EtgGpfAYiKCAaQTLV5ot8KMblEXIEFzeznT8mOeGKylp0uktJk2Se8SK5r3nfQTJKa8JqJE0GcW9vOtcBPPqHcPZXf2iQkvSk3yvFJv6cDj8%2B6kck0Eadz4BOXz0ljrE1Vt%2BX2gItx86Fd8rldFG3TL7u99FKiuc1rN9OaBRJpPHL12fVP2gjuVUUIomqShmQYyKHbhGDuLKoCWq%2BdLkggz2eTJna6w9eWR7QMvpIJxc8sBGFT1WEm%2FsyA%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHORHIVCFW/20220919/us-west-2/s3/aws4_request&X-Amz-Date=20220919T114402Z&X-Amz-SignedHeaders=host&X-Amz-Signature=8241ad05ecb5555cbbd4998b5c334104f2849bf4177384e86fbb5cc5d7e81ce8",
        "https://pdf-temp-files.s3.us-west-2.amazonaws.com/B6Z9J274GZ5BK5QYK547ST4T5WF61LNQ/output-split-by-barcode_page3-5.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzEK3%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDH1Gv1Q88EtgGpfAYiKCAaQTLV5ot8KMblEXIEFzeznT8mOeGKylp0uktJk2Se8SK5r3nfQTJKa8JqJE0GcW9vOtcBPPqHcPZXf2iQkvSk3yvFJv6cDj8%2B6kck0Eadz4BOXz0ljrE1Vt%2BX2gItx86Fd8rldFG3TL7u99FKiuc1rN9OaBRJpPHL12fVP2gjuVUUIomqShmQYyKHbhGDuLKoCWq%2BdLkggz2eTJna6w9eWR7QMvpIJxc8sBGFT1WEm%2FsyA%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHORHIVCFW/20220919/us-west-2/s3/aws4_request&X-Amz-Date=20220919T114402Z&X-Amz-SignedHeaders=host&X-Amz-Signature=94764cfb37819f2a4885ba064dd1ae20f38f42d6bc6c1a208010637fca74a591",
        "https://pdf-temp-files.s3.us-west-2.amazonaws.com/XT5TD1BDBFDNKX0LM6N5GLFLOAF1UC0Y/output-split-by-barcode_page7-9.pdf?X-Amz-Expires=3600&X-Amz-Security-Token=FwoGZXIvYXdzEK3%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDH1Gv1Q88EtgGpfAYiKCAaQTLV5ot8KMblEXIEFzeznT8mOeGKylp0uktJk2Se8SK5r3nfQTJKa8JqJE0GcW9vOtcBPPqHcPZXf2iQkvSk3yvFJv6cDj8%2B6kck0Eadz4BOXz0ljrE1Vt%2BX2gItx86Fd8rldFG3TL7u99FKiuc1rN9OaBRJpPHL12fVP2gjuVUUIomqShmQYyKHbhGDuLKoCWq%2BdLkggz2eTJna6w9eWR7QMvpIJxc8sBGFT1WEm%2FsyA%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHORHIVCFW/20220919/us-west-2/s3/aws4_request&X-Amz-Date=20220919T114402Z&X-Amz-SignedHeaders=host&X-Amz-Signature=0a7c90a05fd159659451d29273284fbf422d34bd204c07fbc9abdf7a36a84294"
    ],
    "pageCount": 10,
    "error": false,
    "status": 200,
    "name": "output-split-by-barcode.pdf",
    "credits": 350,
    "duration": 4456,
    "remainingCredits": 98221710
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/split2' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://bytescout-com.s3.us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-split/split_by_barcode.pdf",
    "searchString": "[[barcode:qrcode,datamatrix /bytescout\\.com/]]",
    "excludeKeyPages": true,
    "regexSearch": false,
    "caseSensitive": false,
    "inline": true,
    "name": "output-split-by-barcode",
    "async": false
}'