Español

Lee este artículo en español.

How to split a PDF in n8n (by page ranges)

If you work with n8n, sometimes you get a PDF that's really several documents bundled together: a batch of scanned invoices, a dossier with several appendices, or a report that needs to be split by section. With the regular HTTP Request node and the Cofferdock API, you split it by page ranges in one step.

Quick note: n8n has no dedicated "split PDF" node. You do it with the HTTP Request node calling an API that you give the ranges to, and it returns one file per range.

What you'll get

You send the PDF and the page ranges you want (for example 1-3,5,7-9, which gives three files) and get back one PDF per range. To get one file per page, just list them all: 1,2,3.

Common uses in n8n:

What you need

Step by step in the HTTP Request node

Add an HTTP Request node and fill it in like this:

{
  "file": "={{ $binary.data.data }}",
  "ranges": "1-3,5,7-9"
}

The response includes files, a list with one object per range (range, pages, pdf in base64, size_bytes). To save each one as a real file, add a Convert to File node afterward, pointing at each item's pdf field.

A quick example

Say you split a batch of scanned invoices out of a single PDF:

  1. A node that fetches the PDF with the full batch (a manual upload, an email, or Google Drive).
  2. The HTTP Request node above, with each invoice's ranges (1-2,3-4,5).
  3. A Split Out node over files to process each result separately, followed by Convert to File to turn each pdf into binary.
  4. A Google Drive node that saves each invoice as an individual file.

One PDF with five invoices goes in, five separate files come out.

Options you can tweak

Add it in the same JSON body:

OptionDefaultWhat it does
outputjsonjson (each file in base64) or url (a 15-minute temporary link per file, lighter if you're going to download them afterward).

Prefer to see it in code?

The same call with curl, with the PDF already in base64:

curl -X POST "https://api.cofferdock.com/pdf-split" \
  -H "x-api-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"file": "BASE64_OF_THE_PDF", "ranges": "1-3,5,7-9"}'

How much does it cost?

Each split uses 1 credit from your plan, no matter how many files come out. Every Cofferdock tool draws from the same pool of credits.

FAQ

Does n8n have a native node to split PDFs? No. You do it with the HTTP Request node calling the Cofferdock API.

Why is the response always JSON, and I can't pick "Response Format: File"? Because the result is several files, not one, and a single binary can't carry more than one file at a time. That's why each one travels as base64 inside the JSON (or as a link, with output: "url").

How are pages numbered? Starting at 1, not 0. 1-3 is the first three pages.

Can I get one file per page? Yes, by listing every page separated by commas: 1,2,3,4,5.

Related guides

Try it yourself

You'll find the full instructions, with copy-paste examples, on the split PDF page. And if you don't have an account yet, you can create one for free and build your first flow today.