n8n-nodes-pdfconvert
v0.1.0
Published
n8n node for converting PDF files to images
Maintainers
Readme
n8n-nodes-pdfconvert
This package contains the PDF Convert node for n8n. It provides functionality to convert PDF files into individual page images (PNG/JPG format).
Features
- ✅ Convert PDF files to images (PNG or JPG)
- ✅ Process all pages or specific page ranges
- ✅ Configurable image quality (DPI settings)
- ✅ Support for binary data input
- ✅ Reliable implementation using pdf2pic + GraphicsMagick
- ✅ Perfect for document processing workflows
System Requirements
This node requires the following system dependencies to be installed on your n8n host:
- GraphicsMagick - for image processing
- Ghostscript - for PDF parsing
For Docker installations:
# Install system dependencies
docker exec -it --user root n8n apk add --no-cache graphicsmagick ghostscript
# Then install the node via n8n UI or:
docker exec -it n8n sh -c "cd /home/node/.n8n/nodes && npm install n8n-nodes-pdfconvert"For Ubuntu/Debian:
sudo apt-get update
sudo apt-get install graphicsmagick ghostscriptFor CentOS/RHEL:
sudo yum install GraphicsMagick ghostscriptInstallation
To install this community node, follow the installation guide in the n8n docs.
Manual Installation
npm install n8n-nodes-pdfconvertUsage
Node Configuration
The PDF Convert node provides the following configuration options:
Input Type
- Binary Data: Use PDF data from file uploads or previous nodes
- Base64: Use base64-encoded PDF string
Output Options
- Output Format: Choose PNG or JPG for resulting images
- Scale: Control image resolution (0.5x to 5x, default 2x)
- Pages: Specify pages to convert (e.g., "1,2,3" or "1-5" or leave empty for all)
Input/Output Properties
- Binary Property: Name of input property containing PDF data (default: "data")
- Output Property Name: Name for output property containing converted images (default: "images")
Examples
Example 1: Convert all PDF pages to PNG
Input: PDF file via HTTP Request or File node
Configuration:
- Input Type: Binary Data
- Output Format: PNG
- Scale: 2
- Pages: (empty - converts all pages)Example 2: Convert specific pages to high-res JPG
Input: PDF file
Configuration:
- Input Type: Binary Data
- Output Format: JPG
- Scale: 3
- Pages: 1,3-5,10Example 3: Convert base64 PDF to images
Input: Base64 PDF string
Configuration:
- Input Type: Base64
- Base64 Data: {{$json.pdfBase64}}
- Output Format: PNG
- Scale: 2Output Format
The node outputs:
- JSON Data: Metadata about converted images
- Binary Data: Individual page images as binary data
JSON output structure:
{
"images": [
{
"data": Buffer,
"mimeType": "image/png",
"fileName": "page_1.png",
"fileExtension": "png",
"pageNumber": 1
}
],
"totalPages": 3,
"outputFormat": "png",
"scale": 2
}Binary output: Each page is also available as binary data with property names like images_page_1, images_page_2, etc.
Use Cases
- Extract pages from scanned documents
- Convert PDF presentations to image slides
- Generate thumbnails from PDF files
- Process invoices/receipts for OCR workflows
- Archive PDF content as individual images
Technical Details
- Built with TypeScript for n8n
- Uses pdf-img-convert library (lightweight, PDF.js-based)
- No external dependencies (GraphicsMagick, Ghostscript)
- Supports Node.js 20.15+
Development
Prerequisites
- Node.js >= 20.15
- n8n installed globally:
npm install n8n -g
Setup
- Clone the repository
- Install dependencies:
npm install - Build the node:
npm run build - Link for development:
npm link
Testing
npm run lint # Check code quality
npm run build # Build the project
npm run dev # Watch mode for developmentLicense
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions:
- Check the n8n documentation
- Open an issue on GitHub
Made with ❤️ for the n8n community
