Link Search Menu Expand Document

PDF Split By Barcode

Split PDF into multiple PDF files.

Available Methods

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

Attributes
url required
URL to the source file. Supports links from Google Drive, Dropbox, and PDF.co built-in files storage. To upload files via API, Check out the Files Upload section.

Note: If you experience intermittent Too Many Requests or Access Denied errors, please try to add cache: to enable built-in URL caching. (e.g cache:https://example.com/file1.pdf)

For data security, you have the option to encrypt output files and decrypt input files. Learn more about user-controlled data encryption.
httpusername optional
HTTP auth user name if required to access source url.
httppassword optional
HTTP auth password if required to access source url.
searchString required
Text to search for on pages. The data type must need to 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/]]",
..
Attributes
excludeKeyPages optional, false by default
Set to true if you want to exclude pages where text was found.
regexSearch optional, false by default
Set to true to enable regular expressions for the search string. “
caseSensitive optional, false by default
Set to true to enable case-sensitive search.
lang optional
Set the language for OCR (text from image) to use for scanned PDF, PNG, and JPG documents input when extracting text.
The 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
Set async to true for long processes to run in the background, API will then return a jobId which you can use with /job/check endpoint to check the status of the process and retrieve the output while you can proceed with other tasks without waiting for this process to finish.
inline optional
Must be one of: true to return data as inline or false to return a link to the output file (default).
name optional
File name for the generated output. The data type must need to be a string.
expiration optional
Set the expiration time for the output link in minutes (default is 60 i.e 60 minutes or 1 hour), After this specified duration, any generated output file(s) will be automatically deleted from PDF.co temporary files storage. The maximum duration for link expiration varies based on your current subscription plan. Learn more

To store permanent input files (e.g. re-usable images, pdf templates, documents), Consider using PDF.co built-in Files Storage.
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
Use this parameter to set additional configurations for fine-tuning and extra options. Data must need to be in a “string” format. Explore PDF.co knowledgebase for profile examples.
  • Method: POST
  • URL: /v1/pdf/split2

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://pdfco-test-files.s3.us-west-2.amazonaws.com/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://pdfco-test-files.s3.us-west-2.amazonaws.com/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
}'