npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

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

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.

n8n.io - Workflow Automation

✨ 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

  1. Go to Settings > Community Nodes
  2. Click Install
  3. Enter n8n-nodes-json-to-pdf-invoice
  4. Click Install

Option 2: Install via npm

Navigate to your n8n installation directory and run:

npm install n8n-nodes-json-to-pdf-invoice

Option 3: Manual Installation (Development)

  1. Clone this repository
  2. Navigate to the directory
  3. Run npm install
  4. Run npm run build
  5. Link the package: npm link
  6. In your n8n directory: npm link n8n-nodes-json-to-pdf-invoice
  7. 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

  1. HTTP Request Node: Fetch invoice data from your API
  2. JSON to PDF Invoice Node: Configure parameters and generate PDF
  3. 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 pdfBase64 field 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: binary

Generated 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 format

License

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)