Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

n8n-nodes-pdf-png-converter

haotian25460MIT1.0.4TypeScript support: included

n8n node package for converting PDF files to PNG images with support for file upload and URL input

n8n-community-node-package, pdf, png, converter, image, document

readme

n8n-nodes-pdf-png-converter

n8n community node package for converting PDF files to PNG images with support for separate pages or combined long image.

Features

  • Multiple Input Sources: Support for binary field input or URL download
  • Export Modes:
    • Separate images (each page as individual PNG)
    • Combined image (all pages in one long PNG)
  • Flexible Page Range: Convert specific pages or entire document
  • Quality Control: Adjustable DPI for output images (72-600 DPI)
  • Error Handling: Robust error handling with continue-on-fail option
  • n8n Integration: Full integration with n8n workflow system

Installation

Prerequisites

This node requires the following system dependencies:

  • poppler-utils: For PDF to image conversion
    • Ubuntu/Debian: sudo apt-get install poppler-utils
    • CentOS/RHEL: sudo yum install poppler-utils
    • macOS: brew install poppler
    • Windows: Download from poppler-windows

Install the Plugin

  1. Clone this repository
  2. Install dependencies:

    npm install
  3. Build the project:

    npm run build
  4. Install the package in your n8n instance:

    npm install /path/to/n8n-nodes-pdf-png-converter

Usage

Basic Usage

  1. Add the "PDF to PNG Converter" node to your workflow
  2. Configure the input source:
    • Binary Field: Use binary data from previous nodes
    • URL: Download PDF from a URL
  3. Choose export mode:
    • Separate Images: Each page as a separate PNG file
    • Combined Image: All pages in one long PNG
  4. Set image quality (DPI)
  5. Optionally specify page range (e.g., "1-3,5,7-9")
  6. Connect to other nodes or use as workflow output

Input Examples

Binary Field Input

{
  "binary": {
    "data": {
      "data": "base64-encoded-pdf-data",
      "mimeType": "application/pdf"
    }
  }
}

URL Input

Provide a direct URL to a PDF file in the node configuration.

Output Examples

Separate Images Mode

{
  "json": {
    "success": true,
    "totalPages": 3,
    "convertedPages": 3,
    "exportMode": "separate",
    "quality": 200,
    "images": [
      {
        "pageNumber": 1,
        "filename": "page_1.png",
        "size": 123456
      }
    ]
  },
  "binary": {
    "page_1": {
      "data": "base64-encoded-png-data",
      "mimeType": "image/png",
      "fileExtension": "png",
      "fileName": "page_1.png"
    },
    "page_2": { ... },
    "page_3": { ... }
  }
}

Combined Image Mode

{
  "json": {
    "success": true,
    "totalPages": 3,
    "convertedPages": 3,
    "exportMode": "combined",
    "quality": 200,
    "image": {
      "filename": "combined_3_pages.png",
      "size": 456789
    }
  },
  "binary": {
    "combined_image": {
      "data": "base64-encoded-png-data",
      "mimeType": "image/png",
      "fileExtension": "png",
      "fileName": "combined_3_pages.png"
    }
  }
}

Node Parameters

Parameter Type Description Default
Input Source Options Binary field or URL binary
Binary Field String Name of binary field (for binary input) data
PDF URL String URL of PDF file (for URL input) -
Export Mode Options Separate or combined images separate
Image Quality Number Output DPI (72-600) 200
Page Range String Pages to convert (e.g., 1-3,5) -

Page Range Syntax

The page range parameter supports the following formats:

  • 1,3,5 - Specific pages
  • 1-3 - Range of pages
  • 1-3,5,7-9 - Combination of ranges and specific pages
  • Empty string - All pages

Error Handling

The node includes robust error handling:

  • Invalid PDF files
  • Network timeouts for URL downloads
  • Missing binary fields
  • Invalid page ranges
  • System dependency issues

When "Continue on Fail" is enabled, errors will be passed to the output with error details.

Development

Building

npm run build

Development Mode

npm run dev

Linting

npm run lint
npm run lintfix

Formatting

npm run format

Example Workflows

Workflow 1: Convert Uploaded PDF

  1. HTTP Request Node - Receive file upload
  2. PDF to PNG Converter - Convert to separate images
  3. Email Node - Send converted images

Workflow 2: URL-based Conversion

  1. Webhook Node - Receive URL in request
  2. PDF to PNG Converter - Convert from URL
  3. Google Drive Node - Save converted images

License

MIT License - see LICENSE.md file for details.

Support

For issues and support, please create an issue in the repository.