Overview
This node converts PDF files into PNG images. It takes a PDF file from the input binary data, processes it, and outputs one or more PNG images corresponding to the pages of the PDF. This is useful in scenarios where you need to generate image previews or thumbnails of PDF documents, or when you want to extract visual content from PDFs for further processing or display.
Practical examples include:
- Generating preview images of uploaded PDF reports.
- Converting multi-page PDFs into individual PNG images for use in web galleries.
- Creating thumbnails for document management systems.
Properties
Name | Meaning |
---|---|
Property Name In | The name of the binary property that contains the input PDF file. |
Property Name Out | The base name for the binary property where the output PNG images will be stored. |
Viewport Scale | The scale factor for rendering the PDF pages to PNG images; controls the resolution size. |
Output
The node outputs an array of items, each containing the original JSON data plus new binary properties holding the PNG images generated from the PDF pages.
- The binary output properties are named by appending an index to the "Property Name Out" value (e.g.,
data0
,data1
, etc.). - Each binary property contains a PNG image representing one page of the PDF.
- The MIME type for these binary outputs is
image/png
.
Dependencies
- Requires the PDF processing utility functions imported from a local module (
PdfToPngUtils
), which handle PDF validation and conversion. - Uses n8n helper methods for binary data handling.
- No external API keys or services are required.
Troubleshooting
- Input is not a PDF: If the input binary data is not a PDF file, the node throws an error specifying the expected and actual MIME types. Ensure the input binary property contains a valid PDF.
- Binary property not found: If the specified input binary property does not exist on an item, the node will fail. Verify the correct property name is set.
- Large PDFs or many pages: Processing large PDFs or those with many pages may consume significant memory or time. Consider limiting input size or scaling down the viewport scale.
- Continue on Fail: If enabled, the node will skip failed items and continue processing others, preserving their original data.
Links and References
- PDF.js library — underlying technology often used for PDF rendering in JavaScript environments.
- n8n Documentation - Working with Binary Data
- PNG Image Format