n8n-nodes-json-to-pdf-invoice
v1.0.1
Published
n8n community node to convert JSON to professional PDF invoices with blue theme and logo support
Maintainers
Readme
n8n-nodes-json-to-pdf-invoice
This is an n8n community node that converts JSON data into beautifully formatted PDF invoices with a modern, elegant design.

✨ NEW: Professional Blue Theme & Logo Support!
Your invoices now feature a professional design with:
- 🔵 Blue table headers - Material Design blue theme
- 💙 Alternating blue/white rows for easy reading
- 🖼️ Company Logo Support - Add your logo to invoices!
- 📦 Styled totals boxes with blue backgrounds
- 📄 Clean receipt layout with modern spacing
- ⏰ Automatic timestamps (Receipt No., Date, Time)
See BLUE_THEME_AND_LOGO.md for details!
Features
- 📄 Professional Invoice Generation: Create polished PDF invoices from JSON data
- 🎨 Modern Design: Blue-themed receipt style with elegant spacing
- 🖼️ Logo Support: Add your company logo to every invoice
- 🎨 Customizable Branding: Add your company name, address, and invoice details
- 📊 Automatic Calculations: Handles subtotals, VAT/discounts, and final totals
- 💾 Flexible Output: Export as base64 or binary data for easy saving/sharing
- 🔄 Seamless Integration: Works perfectly in n8n workflows
Installation
Follow the installation guide in the n8n community nodes documentation.
Option 1: Install via n8n UI
- Go to Settings > Community Nodes
- Click Install
- Enter
n8n-nodes-json-to-pdf-invoice - Click Install
Option 2: Install via npm
Navigate to your n8n installation directory and run:
npm install n8n-nodes-json-to-pdf-invoiceOption 3: Manual Installation (Development)
- Clone this repository
- Navigate to the directory
- Run
npm install - Run
npm run build - Link the package:
npm link - In your n8n directory:
npm link n8n-nodes-json-to-pdf-invoice - Restart n8n
Usage
Input Data Format
The node expects JSON input with the following structure:
[
{
"Items": [
{
"Item": "plot",
"Quantity": 23,
"Price": 200
},
{
"Item": "milk",
"Quantity": 2,
"Price": 900
},
{
"Item": "bird",
"Quantity": 2,
"Price": 200
}
],
"Discount": 2317.4,
"TotalAfterDiscount": 20856.6
}
]Node Parameters
| Parameter | Description | Default | Required |
|-----------|-------------|---------|----------|
| Invoice Title | Title displayed at the top | INVOICE | No |
| Company Name | Your company name | Your Company Name | No |
| Company Address | Your company address (use \n for line breaks) | 123 Business Street... | No |
| Invoice Number | Unique invoice number | Auto-generated | No |
| Invoice Date | Invoice date | Current date | No |
| Customer Name | Customer's name | From JSON or default | No |
| Customer Address | Customer's address | From JSON or default | No |
| Items Field Name | JSON field containing items array | Items | Yes |
| Discount Field Name | JSON field containing discount value | Discount | Yes |
| Total After Discount Field Name | JSON field containing final total | TotalAfterDiscount | Yes |
| Currency Symbol | Currency symbol to display | $ | No |
| Output Format | base64 or binary | binary | No |
Example Workflow
- HTTP Request Node: Fetch invoice data from your API
- JSON to PDF Invoice Node: Configure parameters and generate PDF
- Write Binary File Node: Save the PDF to disk or send via email
Output
The node outputs:
Binary Format (default):
- Binary data ready to be saved as a PDF file
- Can be used with "Write Binary File" node or email attachments
Base64 Format:
- JSON object with
pdfBase64field containing the encoded PDF - Useful for API responses or database storage
Example Configuration
// In the JSON to PDF Invoice node:
Company Name: "Acme Corporation"
Company Address: "123 Main Street\nNew York, NY 10001\nUSA"
Invoice Number: INV-{{$now.format("yyyyMMdd")}}-{{$runIndex}}
Invoice Date: {{$now.format("yyyy-MM-dd")}}
Customer Name: {{$json["customerName"]}}
Items Field Name: Items
Discount Field Name: Discount
Total After Discount Field Name: TotalAfterDiscount
Currency Symbol: $
Output Format: binaryGenerated Invoice Features
The generated PDF includes:
- ✅ Professional header with invoice title
- ✅ Company information block
- ✅ Invoice number and date
- ✅ Customer billing information
- ✅ Itemized table with:
- Item names
- Quantities
- Individual prices
- Line totals
- ✅ Automatic calculations:
- Subtotal
- Discount amount
- Final total
- ✅ Color-coded header and totals
- ✅ Zebra-striped table rows for readability
- ✅ Professional footer message
Technical Details
Dependencies
- pdfkit: Open-source PDF generation library
- n8n-workflow: n8n core workflow functionality
Node Type
- Type: Transform
- Inputs: 1
- Outputs: 1
Troubleshooting
Issue: Field not found error
Solution: Ensure your JSON field names match the configured parameters (e.g., "Items", "Discount", "TotalAfterDiscount")
Issue: PDF not displaying correctly
Solution:
- Check that quantity and price values are numbers, not strings
- Verify all required fields are present in the input JSON
Issue: Special characters not rendering
Solution: PDFKit supports Unicode. Ensure your input data is properly UTF-8 encoded
Development
# Install dependencies
npm install
# Build the node
npm run build
# Watch for changes during development
npm run dev
# Lint the code
npm run lint
# Format the code
npm run formatLicense
MIT
Resources
Support
For issues, questions, or contributions, please open an issue in the GitHub repository.
Version History
1.0.0
- Initial release
- JSON to PDF invoice conversion
- Customizable company and customer information
- Automatic calculations
- Multiple output formats (base64 and binary)
