pdf-to-images

n8n community node: PDF binary → JPEG/PNG per page (Mozilla PDF.js + @napi-rs/canvas, no MuPDF/Poppler)

Package Information

Released: 4 mo ago
Downloads: 44 weekly / 197 monthly
Latest Version: 1.0.33
Author: Kukhta Stepan

Documentation

@kukhta_stepan/n8n-nodes-pdf-to-images

Professional n8n community node for document/image conversion to raster output, powered by pdfjs-dist and @napi-rs/canvas (no MuPDF or Poppler required).

What This Node Does

The node supports three practical workflows:

  1. PDF -> JPG/PNG (page-by-page)
  2. RTF -> JPG/PNG (page-by-page)
  3. Image -> JPG (for PNG/JPEG/GIF/WebP/BMP inputs)

Node Details

  • Display name: PDF to Images
  • Node name: pdfToImagesPdfJs
  • Type version: 3
  • Input: binary data field (configured by Binary Field Name)
  • Output: one or more items with generated image binaries plus metadata in json

Operations

1) PDF/RTF -> images (each page)

This is the main operation for document conversion.

  • Input type is auto-detected inside this mode:
    • %PDF- signature -> handled as PDF
    • {\rtf signature -> handled as RTF
  • Output format:
    • JPEG (smaller files)
    • PNG (lossless)
  • DPI controls page render scale and output size.

If the file is neither valid PDF nor RTF, the node returns a clear validation error.

2) Image -> JPEG

Converts one raster image to one JPEG image.

  • Supported inputs: PNG, JPEG, GIF, WebP, BMP
  • Useful for PNG -> JPG normalization before OCR/storage pipelines.

Output Metadata

For each produced image item, json includes:

  • conversionMode
  • sourceType (pdf, rtf, or image)
  • page, totalPages
  • fileName, format, dpi (when applicable)
  • width, height
  • binaryKey, binaryField, binaryPrefix, binaryPageIndex

Binary Field Naming Rules

Output Binary Field (prefix) controls output key naming in item.binary.

  • Prefix is set
    Keys are always indexed: {prefix}0, {prefix}1, {prefix}2, ...

  • Prefix is empty
    The node preserves the resolved input binary field name (per item).
    Fallback order:

    1. Resolved Binary Field Name value
    2. $json.binaryPropertyName
    3. data

For multi-page PDF/RTF with empty prefix:

  • page 1 keeps the original name, e.g. data0
  • next pages use suffix with underscore: data0_1, data0_2, ...

This avoids accidental renaming like data0 -> data00.

Install in n8n

  1. Open Settings -> Community nodes -> Install
  2. Install package:
    • @kukhta_stepan/n8n-nodes-pdf-to-images
  3. Reload n8n if prompted

Self-hosted environments must allow community packages (for example N8N_COMMUNITY_PACKAGES_ENABLED).

Local Development

npm install
npm run build

The dist/ folder is gitignored; a fresh clone needs npm run build (or npm pack / npm publish, where prepack runs the build).

Publish (Maintainers)

npm login
npm version patch
npm publish --access public

Notes:

  • package is scoped, so --access public is required
  • prepack runs npm run build automatically

License

MIT

Discussion