Important: Make sure the file sharing setting is set to “Anyone with the link” so that PDF.co can access the file.
Consolidated Invoice Distribution Workflow
What You'll Have When Done: A fully automated system that monitors your Google Drive for consolidated invoices, extracts customer data, and generates separate redacted PDF invoices for each customer with only their information visible.
Prerequisites
Before you begin, make sure you have:
- A PDF.co API Key (Get yours here)
- Google Drive OAuth2 credentials configured in n8n
- An n8n instance (cloud or self-hosted)
- A Google Drive folder for monitoring new consolidated invoices
- A Google Drive folder for storing generated customer-specific invoices
- A custom PDF.co Document Parser Template (Template ID: xxxxx) configured for your invoice format
Quick Start Options
Option A: I Want It Working Now
- Import this workflow template → Download JSON File
- Connect your Google Drive account in n8n
- Add your PDF.co API key to both HTTP Request nodes
- Configure your input folder for consolidated invoices
- Configure your output folder for redacted invoices
- Test with a sample consolidated invoice
- Activate and let it run
Option B: I Want to Build It Step-by-Step
Follow the 6-step guide below to create the automation from scratch.
What This Automation Does (Overview)
- Monitors your Google Drive folder for new consolidated invoices
- Extracts customer/item data from the invoice using the Document Parser
- Identifies all unique customers in the consolidated invoice
- Creates separate PDF copies for each customer with other customer data redacted
- Stores each customer-specific invoice in your designated folder
Real Example: One invoice containing charges for Item 1, Item 2, Item 3, Item 4 → Get 4 separate PDFs where each shows only one item's data with all others blacked out. View Sample Files Here.
Step-by-Step Build Guide
Step 1: Monitor for New Consolidated Invoices
Node: Google Drive Trigger
Settings:
- Trigger On:
Changes Involving a Specific Folder
- Folder to Watch: Select your designated barcode upload folder
- Watch For:
File Created
What This Does: Automatically detects when you upload a new consolidated invoice to your designated Google Drive folder and starts the distribution process.
Success Looks Like: The trigger activates immediately when a consolidated invoice is uploaded, capturing the file information and download link.
Step 2: Extract Customer Data from Invoice
Node: HTTP Request → PDF.co Document Parser
Settings:
- Method:
POST
- URL:
https://api.pdf.co/v1/pdf/documentparser
- Headers:
Content-Type: application/json
x-api-key: YOUR_PDF_CO_API_KEY
- Body Parameters:
url: {{ $json.webContentLink }}
templateId: 1
(Your custom template ID)inline: true
What This Does: Sends your consolidated invoice to PDF.co's document parser, which extracts structured data from the invoice table and identifies all customer/item entries.
Success Looks Like: PDF.co returns parsed table data containing all individual line items with customer information clearly identified.
Note: Learn more about PDF.co Document Parser API
Step 3: Generate Redaction Configurations
Node: Code (JavaScript)
JavaScript Code: Get The Code Here
What This Does: Processes the parsed invoice data to:
- Identify all unique customers/items from the invoice
- Create redaction instructions for each customer (specifying which OTHER customers' data should be hidden)
- Generate regex patterns to find and blackout specific data rows
Key Logic Example: If invoice contains Item 1, Item 2, Item 3:
- Item 1's copy: Hide Item 2 and Item 3 data
- Item 2's copy: Hide Item 1 and Item 3 data
- Item 3's copy: Hide Item 1 and Item 2 data
Success Looks Like: Each unique customer gets their own redaction configuration specifying exactly which data to hide from their personalized invoice.
Step 4: Create Redacted Customer Invoices
Node: HTTP Request → PDF.co Search and Delete Text
Settings:
- Method:
POST
- URL:
https://api.pdf.co/v1/pdf/edit/delete-text
- Headers:
Content-Type: application/json
x-api-key: YOUR_PDF_CO_API_KEY
- Body:
url: {{ $('Google Drive Trigger').item.json.webContentLink }}
searchstrings: {{ JSON.stringify($json.searchStrings) }}
regex: true
profiles: {'UsePatch': true, 'PatchColor': '#000000'}
What This Does: Takes the original consolidated invoice and applies black patches to hide other customers' data, creating a clean, professional invoice showing only the specific customer's information.
Success Looks Like: PDF.co generates a redacted PDF with selected customer data visible and all other customer information professionally blacked out.
Note: Learn more about PDF.co Search and Delete Text API
Step 5: Download the Processed Invoice
Node: HTTP Request
Settings:
- Method:
GET
- URL:
{{ $json.url }} (from the redaction step)
What This Does: Downloads the newly created customer-specific invoice from PDF.co's servers so it can be saved to your Google Drive.
Success Looks Like: The redacted customer invoice is downloaded and ready for storage.
Step 6: Store Customer Invoice in Google Drive
Node: Google Drive → Upload File
Settings:
- Input Data Field Name:
data
- Parent Drive From List:
My Drive
- Parent Folder From List: Select your "Redacted Files" or customer invoice output folder
What This Does: Saves each customer-specific invoice to your designated Google Drive folder with clear naming for easy distribution.
Success Looks Like: Individual customer invoices appear in your output folder, each showing the complete invoice format with only relevant customer data visible.
Congrats! You've created a fully automated invoice distribution system that transforms consolidated billing into professional, privacy-compliant customer invoices. This system scales automatically and eliminates the manual work of creating separate customer invoices.
Built something cool with this workflow? Share it with us @pdfdotco
Related Tutorials



