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

@hichamchar/n8n-nodes-pdflib

v0.4.1

Published

n8n community node for filling and manipulating PDF documents using pdf-lib. Perfect for generating tax receipts, invoices, and forms.

Readme

n8n PDF-lib Custom Node

A custom n8n node for working with PDF documents using the pdf-lib library. This node allows you to fill PDF forms, create new PDFs, and merge multiple PDFs directly in your n8n workflows.

🎯 Features

  • Fill PDF Forms - Add text overlays to existing PDF documents with full positioning control
  • Fill Form Fields - Fill actual interactive PDF form fields (text, checkboxes, radio buttons)
  • Extract Form Fields - Discover all form fields, types, values, and properties from PDFs ✨ NEW in v0.4.0
  • Add Images - Embed PNG and JPEG images into PDFs with positioning and rotation
  • Create PDFs - Generate new PDF documents from scratch
  • Merge PDFs - Combine multiple PDF files into one with support for multiple sources
  • JavaScript Code Mode - Programmatically define fields using JavaScript code
  • French Character Support - Full UTF-8 support for international characters
  • Flexible Input - Works with URLs or binary data
  • Customizable - Configure fonts, colors, positions, sizes, and rotations

📦 Installation

Follow the detailed instructions in SETUP.md to install this custom node in your n8n instance.

Quick Start:

cd ~
wget https://github.com/n8n-io/n8n-nodes-starter/archive/refs/heads/master.zip
unzip master.zip
mv n8n-nodes-starter-master n8n-nodes-pdflib
cd n8n-nodes-pdflib

# Clean up examples
rm -rf nodes/ExampleNode nodes/HttpBin credentials/*

# Copy the PDF-lib node files into nodes/PdfLib/

# Update package.json with the provided version

# Build and link
npm install
npm run build
npm link

# Link to n8n
cd ~/.n8n/custom
npm link n8n-nodes-pdflib
docker restart n8n

🚀 Usage

Fill PDF Form

Perfect for filling tax receipts, invoices, or any form-based PDFs:

  1. Select Fill PDF Form operation
  2. Choose PDF source (URL or Binary Data)
  3. Add text fields with coordinates and styling
  4. Output as binary data

Example Use Case: French Tax Receipt (Reçu Fiscal)

  • Load template PDF from URL
  • Add donor name, address, amount, date
  • Generate personalized receipt

Create PDF

Create new PDF documents from scratch:

  1. Select Create PDF operation
  2. Choose page size (A4, Letter, or Custom)
  3. Add text fields with positions and styling
  4. Output as binary data

Extract Form Fields ✨ NEW

Discover all form fields in a PDF before filling:

  1. Select Extract Form Fields operation
  2. Choose PDF source (URL or Binary Data)
  3. Get JSON output with all field information

Returns:

  • Field names and types (text, checkbox, radio, dropdown, list, button, signature)
  • Current values and properties
  • Max lengths, options, read-only status
  • PDF metadata (page count, title, author)

Perfect for:

  • Finding exact field names before filling forms
  • Validating PDF form structure
  • Building dynamic form-filling workflows
  • Documenting form fields

Merge PDFs

Combine multiple PDF files:

  1. Select Merge PDFs operation
  2. Add multiple PDF sources (URL or Binary Data)
  3. Get combined PDF as output

📋 Sample Workflow

A sample workflow for French tax receipts is included in sample-workflow.json. Import it into n8n to see the node in action.

The workflow:

  1. Takes donation data (name, address, amount, date)
  2. Fills a PDF template
  3. Saves the result
  4. Optionally emails it to the donor

🛠️ Files Included

  • nodes/PdfLib/PdfLib.node.ts - Main node implementation
  • nodes/PdfLib/PdfLib.node.json - Node metadata
  • nodes/PdfLib/logo-full.svg - PDF-lib logo icon
  • package.json - Package configuration
  • SETUP.md - Detailed setup instructions
  • PUBLISHING.md - Guide to publish to npm
  • CHANGELOG.md - Version history
  • sample-workflow.json - Example workflow
  • README.md - This file

🔧 Configuration

Text Field Parameters

  • Text - The text content to add
  • X Position - Horizontal position from left (in points)
  • Y Position - Vertical position from bottom (in points)
  • Font Size - Text size (default: 12)
  • Page Number - Which page to add text to (0-indexed)
  • Color - Text color in hex format (e.g., #000000)

Coordinate System

PDFs use a coordinate system where:

  • (0, 0) is at the bottom-left corner
  • X increases to the right
  • Y increases upward
  • A4 page is approximately 595 x 842 points

🎨 Customization

You can extend this node by:

  • Adding more PDF operations (rotate, extract, compress)
  • Supporting more fonts (embed custom TTF fonts)
  • Adding image support
  • Creating credential support for authenticated sources

📚 Resources

🐛 Troubleshooting

Node doesn't appear:

  • Verify npm link worked: ls -la ~/.n8n/custom/node_modules
  • Check Docker logs: docker logs n8n
  • Restart n8n: docker restart n8n

Build errors:

  • Delete node_modules and reinstall: rm -rf node_modules package-lock.json && npm install
  • Ensure TypeScript is installed: npm install -g typescript

PDF operations fail:

  • Check URL accessibility from Docker container
  • Verify coordinates are within page bounds
  • Check n8n execution logs for details

📄 License

MIT

🤝 Contributing

This is a custom node for personal/organizational use. Feel free to modify and extend it for your needs!

✨ Advantages

Permanent - Survives n8n updates
Local - No external API dependencies
Fast - Runs directly in n8n
Flexible - Full control over PDF operations
Reusable - Works across all workflows
Team-Friendly - Easy for others to use