This article contains affiliate links. If you buy through them, we may earn a commission at no extra cost to you.
PDF Workflow Automation with n8n and PDF Agile — Step by Step
Every team that handles invoices, contracts or reports knows the pain: a PDF lands in an inbox, someone manually extracts the relevant data, copies it into a spreadsheet, renames the file and forwards it to the right person. Multiply that by fifty documents a day and you have a serious productivity drain. This guide shows you how to close that loop in around 20 minutes using two tools that work exceptionally well together.
The PDF editing and processing side is handled by PDF Agile — an all-in-one PDF tool that covers editing, conversion, compression, OCR and signing. The automation glue is n8n, an open-source workflow platform with more than 400 integrations that you can self-host for free or run on n8n Cloud.
What You Will Build
The workflow you are about to create does the following automatically:
- Watches a folder or email inbox for incoming PDFs
- Runs OCR on scanned documents to make text machine-readable
- Extracts key fields (invoice number, date, total, sender)
- Writes those fields to a Google Sheet or Airtable base
- Renames and moves the PDF to the correct storage folder
- Sends a Slack or email notification to the responsible team member
No code required beyond a few n8n expressions. No manual copy-pasting. The whole setup takes roughly 20 minutes once your tools are connected.
Prerequisites
- An n8n instance (self-hosted or n8n Cloud — free trial available)
- A PDF Agile account for OCR and PDF manipulation
- Access to Google Drive, Dropbox or a local folder as the document inbox
- Optional: a Google Sheets or Airtable account for data logging
- Optional: a Slack workspace or email account for notifications
Step 1 — Prepare Your PDFs with PDF Agile
Before automation can extract data, your PDFs need to be in a consistent, machine-readable state. This is where PDF Agile earns its place in the stack.
OCR for Scanned Documents
Open PDF Agile and use the OCR function on any scanned invoice or contract. OCR converts the image layer into selectable, copyable text. PDF Agile supports batch OCR, so you can process an entire folder in one go before your first workflow run. For ongoing automation, you will trigger OCR via the PDF Agile API or CLI from inside your n8n workflow.
Standardise the Layout
If different suppliers send invoices in wildly different formats, use PDF Agile's editing tools to confirm which text anchors you can rely on — labels like Invoice No.:, Total: or Due Date: that always appear in the same position or with the same prefix. These anchors become your extraction patterns in n8n.
Convert When Needed
Some documents arrive as Word files or images. PDF Agile converts them to PDF with a single click, ensuring every file entering your n8n workflow is in the same format.
Step 2 — Trigger the n8n Workflow
Open your n8n canvas and add a trigger node. The right choice depends on where PDFs arrive:
- Google Drive Trigger — fires when a new file appears in a specific folder
- Email Trigger (IMAP) — fires when an email with a PDF attachment arrives
- Webhook Trigger — fires when an external system posts a file URL to n8n
- Schedule Trigger — polls a folder every X minutes for new files
For most invoice workflows the Google Drive Trigger or IMAP Email Trigger is the simplest starting point. Configure it to filter for .pdf files only.
Step 3 — Extract Text from the PDF
n8n has a built-in Extract from File node (under the Utilities section) that can read text content from PDFs. Connect it to your trigger and pass the binary file data through it.
If the PDF was already OCR-processed by PDF Agile, the extracted text will be clean and structured. If not, you can call the PDF Agile API from an HTTP Request node first to run OCR on the fly, then pass the result to the Extract from File node.
Parse the Extracted Text
Use an n8n Code node (JavaScript) or a Set node with expressions to isolate the fields you need. A simple regex approach works well for labelled fields:
Invoice No\.: (\S+)→ captures the invoice numberTotal[:\s]+([0-9.,]+)→ captures the total amountDue Date[:\s]+(\d{2}[\/\-]\d{2}[\/\-]\d{4})→ captures the due date
Store each captured group as a named variable (e.g. invoiceNumber, totalAmount, dueDate) for use in subsequent nodes.
Step 4 — Write Data to Your Spreadsheet or Database
Add a Google Sheets node (or Airtable, Notion, or any database node) set to Append Row. Map your variables to the correct columns:
- Column A →
{{ $json.invoiceNumber }} - Column B →
{{ $json.totalAmount }} - Column C →
{{ $json.dueDate }} - Column D →
{{ $json.fileName }} - Column E →
{{ $now.toISO() }}(timestamp of processing)
Every processed PDF now creates a clean row in your log, giving you a full audit trail without any manual entry.
Step 5 — Rename and Route the File
Use an HTTP Request node or the Google Drive node to move the PDF to a destination folder and rename it using the extracted data. A reliable naming convention might be:
YYYY-MM-DD_InvoiceNo_Supplier.pdf
For example: 2024-06-15_INV-4821_AcmeCorp.pdf
You can branch the routing with an IF node: invoices above a certain amount go to a Finance Review folder; below the threshold they move straight to Approved. Contracts go to a separate Legal folder. The logic is entirely up to you.
Step 6 — Send a Notification
Add a Slack node or Send Email node at the end of each branch. The message might read:
"📄 New invoice processed: INV-4821 from AcmeCorp — €3,420 due 2024-07-01. File saved to Finance Review."
The responsible person gets the context they need without opening their email client or file manager. Response time drops, errors drop and nobody has to chase a PDF through a shared inbox again.
Extending the Workflow
Automatic Approval Emails
Connect an email node to send a payment-approval request to a manager whenever a high-value invoice is detected. Include a link to the PDF in Google Drive so the approver can review it instantly.
Duplicate Detection
Before writing to the spreadsheet, query the existing rows to check whether the invoice number already exists. If it does, route the file to a Duplicates folder and send an alert instead of creating a second row.
Multi-language OCR
PDF Agile's OCR engine handles multiple languages. If your team receives documents in German, French or Spanish, the same workflow processes them without any additional configuration on the n8n side.
Time Estimate
- OCR setup in PDF Agile: 3 minutes
- n8n trigger and file extraction: 5 minutes
- Text parsing and field mapping: 5 minutes
- Routing logic and notifications: 5 minutes
- Test run and adjustments: 2 minutes
Total: around 20 minutes for a workflow that then runs itself indefinitely.
Summary
PDF automation is one of the highest-ROI workflows you can build. The combination of PDF Agile for reliable OCR and document preparation, and n8n for routing and integration, eliminates a category of repetitive manual work entirely. Once the workflow is live, every incoming document is processed, logged, filed and communicated — in seconds rather than minutes, and without anyone touching a keyboard.
If you handle PDFs manually every day and want to route them automatically, you can build and self-host your first workflow via n8n — including 400+ integrations and a free self-hosting option — to eliminate repetitive document tasks for good.