n8n is the open-source, self-hostable automation platform that has matured into a real alternative to Zapier and Make for PDF workflows. Its two killer features for PDF work: you can run it on your own infrastructure (no document ever touches a third-party server), and you can drop into JavaScript inside a workflow whenever the visual nodes do not cut it. This guide walks through the practical use cases.
What n8n is
A visual workflow builder where each node is a step. Like Zapier or Make, but:
- Open source (fair-code license; free for self-hosting).
- Self-hostable on Docker, Kubernetes, or n8n Cloud.
- Code nodes: write JavaScript inline. Run arbitrary npm packages.
- Fair pricing on n8n Cloud, or zero per-run cost on self-hosted.
- HTTP-first: every integration is essentially a configured HTTP request, so any API works.
The tradeoff: you operate it. Self-hosting means a VM, updates, backups, and monitoring on your plate. n8n Cloud removes that work but reintroduces some of the data-residency questions of any SaaS.
Why pick n8n for PDFs
The recurring themes:
- Privacy. PDF files often contain PII or confidential business content. Self-hosted n8n means the binary never leaves your network.
- File size. No SaaS-imposed file-size caps when self-hosted; bounded only by your VM.
- Custom logic. PDF processing often needs a small bit of code: peek at the trailer, check a flag, retry with different parameters. n8n's Function node handles it.
- Cost at volume. Tens of thousands of PDFs per day with zero per-task SaaS cost.
Nodes that matter for PDF work
- Read/Write Binary File: load and save PDFs locally.
- HTTP Request: call PDF.co, CloudConvert, Apryse, or any custom service.
- Code (JavaScript): parse, transform, inspect.
- OpenAI / Anthropic / Hugging Face: AI nodes for extraction or classification.
- Cloud storage: Drive, OneDrive, Dropbox, Box, S3, MinIO.
- Email: IMAP/SMTP for triggers and notifications.
- Webhook: receive PDF uploads from any front end.
- SplitInBatches: chunk large lists for rate limits.
The HTTP Request node is the workhorse. Most PDF APIs (PDF.co, CloudConvert, Apryse, qpdf-as-a-service) are easier to call directly than through a wrapping node.
Recipe: ingest invoices, extract, file, post
Drop-in to most AP teams.
- IMAP trigger: watch the AP mailbox.
- Filter: only
.pdfattachments. - Code: hash the file and check a recent-hash store to skip duplicates.
- HTTP: send to a self-hosted OCR if scanned.
- OpenAI / Anthropic: prompt with the text, return JSON (vendor, invoice number, total, due date).
- Code: validate the JSON (totals add up; dates parse).
- Postgres: insert into the AP table.
- Drive or S3: file under
/year/month/vendor/filename. - Slack: post to AP channel.
The hash-dedupe and JSON-validation steps are the kind of small-code work that n8n does naturally and other platforms do awkwardly.
Recipe: merge a folder of PDFs nightly
- Cron trigger: nightly.
- Drive: list files in the input folder.
- SplitInBatches: 50 per batch.
- HTTP / pdf-lib in Code node: merge each batch.
- Aggregate all batch outputs into a final merge.
- Drive: upload the merged PDF.
- Code: archive source files to a "processed" folder.
For local PDF merging without an external service, you can run pdf-lib inside the Code node and never make an outbound call. See how to combine PDF files.
Recipe: redact PII and route
- Webhook: receive uploaded PDF.
- HTTP: pass to a redaction service or run a self-hosted redactor.
- OpenAI with vision: spot-check the result.
- If clean: store and notify recipient.
- If suspicious: route to human review queue.
For the redaction step's pitfalls, see PDF redaction failures and how to avoid them and how to redact text in a PDF.
Recipe: contract approval state machine
- Webhook: receive new contract request.
- PandaDoc / Docusign: send for signatures.
- Wait node: pause until external trigger or timeout.
- Webhook: receive completion callback.
- Code: parse signed PDF metadata, confirm validity.
- Postgres: update contract status.
- Notify: stakeholders.
State machines are exactly where n8n's Wait nodes shine; without them you would poll.
Local vs cloud nodes
For sensitive PDFs, prefer:
- Self-hosted OCR (Tesseract, OCRmyPDF) on the same network.
- Local pdf-lib in Code nodes for merging, splitting, watermarking.
- Local Ghostscript or qpdf invoked via Execute Command.
- On-premise LLMs (Ollama, vLLM) for extraction.
Reserve hosted APIs (OpenAI, CloudConvert, PDF.co) for non-sensitive workflows or when local quality is not enough.
Code-node tricks
Some snippets that come up often.
Compute a content hash for dedupe:
const crypto = require('crypto');
const hash = crypto.createHash('sha256').update(items[0].binary.data.data).digest('hex');
return [{ json: { hash } }];
Pass binary through after JSON modifications:
return items.map(item => ({
json: { ...item.json, verified: true },
binary: item.binary
}));
Validate extracted JSON:
const parsed = JSON.parse(items[0].json.llmResponse);
if (!parsed.invoiceNumber || !parsed.total) {
throw new Error('Missing required fields');
}
return [{ json: parsed }];
Error handling
n8n has explicit error workflows: define a workflow that runs whenever any node fails. Common error patterns:
- Retry on rate limit. Use the Retry On Fail option in the node.
- Quarantine and notify. Route the failing item to a "review" queue and Slack-ping a human.
- Continue with partial result. Mark the item with an error code and let downstream nodes handle the absence.
For PDF processing specifically, watch for: OCR timeouts, malformed PDFs (encrypted, corrupt), API rate limits, and out-of-memory errors on very large files.
Scaling and operations
Self-hosted n8n scales with two patterns:
- Single instance: fine for hundreds of executions per day.
- Queue mode: separate the main node from worker nodes. Workers consume from Redis. Add more workers as load grows.
For production: deploy with the official Docker image, back the database with Postgres, enable queue mode early, set up Prometheus metrics. Keep n8n's encryption key in a secrets manager.
Privacy and compliance
n8n self-hosted gives you the strongest privacy posture among the major automation platforms:
- PDFs never leave your network if you stick to local nodes.
- Auth tokens for third-party services are encrypted at rest.
- Logs can be configured to redact body content.
For regulated content, this matters. See HIPAA-compliant PDF handling, GDPR and PDF documents, and PDF and zero-trust document security.
Comparing n8n to alternatives
- Zapier: easier; more app integrations; cloud only; cost-prohibitive at scale.
- Make: visual; binary-friendly; cloud only; great for medium volume.
- n8n: open source; self-hostable; code escape hatch; you operate it.
- Apache NiFi, Airflow, Prefect: more powerful for very large pipelines; steeper learning curve; less PDF-aware out of the box.
For most PDF teams, n8n hits a sweet spot of capability and operability.
Getting started
To run n8n locally for evaluation:
docker run -it --rm \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
Open localhost:5678, build a "Hello PDF" workflow with a Webhook trigger plus a PDF.co call. Done in 10 minutes.
For production, the official Docker compose with Postgres and Redis is the starting point.
Limits and gotchas
Steep first hour. The visual builder is intuitive eventually, but Code nodes and item-data semantics take time.
Updates. Self-hosting means you upgrade. The cadence is fast (often weekly). Build in upgrade windows.
No visual debugging across executions. Each execution shows its data, but cross-execution patterns require an external dashboard.
Binary data memory. Large PDFs in items can OOM the Node process. Tune --max-old-space-size for big files.
Trigger reliability. IMAP triggers occasionally miss messages on flaky connections. Webhooks are more reliable.
Practical recipe checklist
For a new n8n PDF workflow:
- Trigger filter is tight.
- Dedupe step early (hash or external key).
- Heavy operations in workers (queue mode).
- Error workflow attached.
- Logs scrubbed of PII.
- Monitoring (Prometheus, alerts) for execution failures.
Takeaway
n8n is the right pick when you want full control over your PDF automation infrastructure, especially for privacy-sensitive content and at high volume. Its learning curve is real but its ceiling is high. Combine it with browser-local PDF tools like Docento.app for client-side preparation and you have an end-to-end pipeline that never leaks documents to third parties. See also automating PDF workflows with Zapier, automating PDF workflows with Make (Integromat), and building a RAG system with PDFs.