Note: Install the PDF.co node before importing the workflow.
The downloadable JSON workflow uses the PDF.co community node. n8n cannot display or run its PDF.co steps unless that node is already installed.
By the end of this tutorial, you’ll have a fully automated workflow that:
This automation eliminates manual invoice handling, saves time, and ensures all invoices are centralized in Google Drive.
Before you begin, make sure you have:
Option A: I Want It Working Now
Note: Install the PDF.co node before importing the workflow.
The downloadable JSON workflow uses the PDF.co community node. n8n cannot display or run its PDF.co steps unless that node is already installed.
Option B: I Want to Build It Step-by-Step Follow the 7-step guide below to create the automation from scratch.
Node: Email Trigger (IMAP)
Settings:
INBOXMark as ReadTrue["UNSEEN", ["SUBJECT", "Invoice Package"]]Success Looks Like: The workflow is triggered when a new or unread email with the subject “Invoice Package” arrives, and attachments are pulled into the workflow.
Node: Code (JavaScript)
Settings: Use the provided JavaScript code to process each attachment and extract metadata (filename, type, etc.). This ensures invoices are properly structured for PDF.co. (Download sample JavaScript code here.)
Success Looks Like: Each document is transformed into a structured workflow item, ready for upload.
Node: PDF.co API → Upload File
Settings:
TruefileSuccess Looks Like: All invoice image attachments are uploaded to PDF.co, returning secure file URLs for further processing.
Node: Code (JavaScript)
Settings: Use a collector function after upload to gather all returned URLs into a single files array JSON object that PDF.co’s Merge endpoint expects. (Download sample collector code here.)
Success Looks Like: All invoice image URLs are collected and formatted in the correct array structure for merging.
Node: PDF.co API → Merge PDF
Settings:
Input Links: Map the ordered URLs array
={{ $json.urls[0] }}
={{ $json.urls[1] }}
={{ $json.urls[2] }}
={{ $json.urls[3] }}
Success Looks Like: All uploaded invoice images are merged into a single clean PDF document.
Note: Visit the API docs: PDF Merge Endpoint for more options.
Node: HTTP Request
Settings:
GET{{ $json.url }} (from PDF.co output)NoneSuccess Looks Like: The merged PDF is downloaded as binary data, ready to be stored.
Node: Google Drive → Upload
Settings:
dataMy DriveOUTPUT1Success Looks Like: The final PDF appears neatly in your designated Google Drive folder
You’ve successfully built an end-to-end automation that:
No more manual downloads, merges, or uploads.
Built something cool? Share it with us on Twitter @pdfdotco!


