Automate Payslip and Statement Splitting with n8n and Zapier
Split a payslip or statement run into one PDF per person, automatically: step-by-step n8n and Zapier workflows using the PodPDF split API.
Payroll and billing systems love to produce one enormous PDF: every payslip for the month, every customer statement for the quarter, one after another. Somebody then has to cut it into individual files and send each one to the right person. In print shops this is called bursting, and it is exactly the kind of job to hand to an automation.
This guide shows how to burst a PDF run with the PodPDF split API, first in n8n and then in Zapier.
The Pattern
Most runs have a fixed number of pages per person — one page per payslip, two per statement — so the split is simple:
- One page each:
{"mode": "each_page"} - N pages each:
{"mode": "every_n", "every_n": 2} - Uneven lengths:
{"mode": "ranges", "ranges": ["1-2", "3-5", "6-6"]}, if your system tells you where each document starts
The output files come back in order, so file number k belongs to the k-th person in the export your payroll or billing system already gives you. Joining the two lists is the whole trick.
Name the files so they’re easy to trace with options.filename_pattern, for example payslip-{index:03} gives payslip-001.pdf, payslip-002.pdf.
Size Matters: Instant or Queued
A run of up to 4 MB and 100 people can be split with a single request to POST /pdf/split. Larger runs — anything up to 150 MB, 5000 pages and 500 files — go through an upload and a background job. Payslip runs for a company of a few hundred people usually need the job flow, so both are shown below.
A note on size: payslips and statements share a letterhead, logo and fonts. Every output file needs its own copy of those, so 300 split payslips can be larger in total than the original run. That’s expected.
n8n
You need an n8n instance and a PodPDF API key stored as a Header Auth credential with the header name X-API-Key (see using the PodPDF API in n8n for setup).
Small runs: one HTTP Request node
- Trigger — whatever delivers the run: an email attachment, a new file in Google Drive, a scheduled download from your payroll system. Make sure the PDF is available as binary data (usually the
dataproperty). - HTTP Request node:
- Method:
POST - URL:
https://api.podpdf.com/pdf/split - Authentication: your Header Auth credential
- Send Body: on, Body Content Type:
Form-Data - Parameter
fileof type n8n Binary File, input data fielddata - Parameter
splitof type Form Data, value{"mode": "each_page"} - Parameter
optionsof type Form Data, value{"filename_pattern": "payslip-{index:03}"}
- Method:
- Split Out node on the
outputsfield, so each output becomes its own item. - HTTP Request node that downloads
{{ $json.download_url }}with Response Format set to File. - Merge node (combine by position) with the employee list from your payroll export, then Gmail or Outlook to send each person their file.
Large runs: upload, queue, wait
Replace step 2 with four nodes:
- HTTP Request —
POST https://api.podpdf.com/pdf/upload-urlwith JSON body{"content_length_bytes": {{ $binary.data.fileSize }}}. Depending on your n8n version the size may be a string such as “3.2 MB”; if so, add a Code node that reads the buffer length first. - HTTP Request —
PUTto{{ $json.upload_url }}, body n8n Binary File, headerContent-Type: application/pdf, no authentication (the URL is already signed, and sending your API key to storage would be refused). - HTTP Request —
POST https://api.podpdf.com/pdf/jobswith JSON body:
{
"operation": "split",
"inputs": [{ "s3_key": "{{ $('Upload URL').item.json.s3_key }}", "filename": "payslips.pdf" }],
"split": { "mode": "each_page" },
"options": { "filename_pattern": "payslip-{index:03}" }
}
- Wait for the job. Either loop a
GET /jobs/{{ $json.job_id }}request with a Wait node untilstatusiscompleted, or — better — register a webhook forjob.completedin PodPDF and start a second workflow from a Webhook trigger. The webhook payload includesjob_type: "pdfop",output_countandfiles_url.
Then call GET /jobs/{job_id}/files and continue from step 3 of the small-run workflow, downloading each file with GET /jobs/{job_id}/files/{index}/download.
Zapier
Zapier’s Webhooks by Zapier → Custom Request step sends JSON, which works well with the base64 form of the split API for runs up to about 4 MB. You’ll need a Zapier plan that includes Webhooks by Zapier (see using the PodPDF API in Zapier).
- Trigger — for example New Attachment in Gmail or New File in Folder in Google Drive.
- Code by Zapier (JavaScript) — fetch the file and base64-encode it:
const response = await fetch(inputData.fileUrl);
const buffer = Buffer.from(await response.arrayBuffer());
return { pdf_base64: buffer.toString('base64'), size: buffer.length };
- Webhooks by Zapier → Custom Request:
- Method:
POST, URL:https://api.podpdf.com/pdf/split - Headers:
X-API-Key: YOUR_API_KEY,Content-Type: application/json - Data:
- Method:
{
"input": { "pdf_base64": "{{pdf_base64}}", "filename": "statements.pdf" },
"split": { "mode": "every_n", "every_n": 2 },
"options": { "filename_pattern": "statement-{index:03}" }
}
- Looping by Zapier over
outputs, then send eachdownload_urlas an attachment with Gmail or save it to Google Drive. Download links are valid for an hour, so keep the send in the same Zap run.
For runs larger than the instant limit, Zapier needs the same upload–job–webhook flow as n8n. The upload step has to send raw bytes, which is easiest from a Code by Zapier step with fetch(upload_url, { method: 'PUT', body: buffer, headers: { 'Content-Type': 'application/pdf' } }). Then catch the job.completed webhook with Webhooks by Zapier → Catch Hook in a second Zap.
Checks Worth Adding
- Page count sanity check. Before splitting, call
POST /pdf/inspect(free) and comparepage_countwith employees × pages per payslip. If they don’t match, stop and alert someone instead of sending payslips to the wrong people. - Encrypted exports. Some payroll systems protect PDFs by default. A protected file is refused with
PDF_ENCRYPTED; switch the export setting off rather than working around it. - Concurrency. Up to 2 merge or split jobs can run at once per account. If you burst several runs in parallel, a third job gets
PDF_JOB_ALREADY_ACTIVE— retry it after a short wait. - Keep the originals. Output files are kept for 7 days. Store the files you send somewhere permanent if you need them later.
Get Started
- Try a split by hand first in the dashboard: PDF Tools → Split
- Read how to split a PDF into multiple files
- See the API reference