Custom PDF to Images

Converts PDF pages to images

Overview

This node converts each page of a specified PDF file into separate JPEG images. It reads the PDF from a given file path, processes all pages, and saves the resulting images into a designated output folder. This is useful in scenarios where you need to extract visual content from PDFs for further processing, previewing, or integration with image-based workflows.

Practical examples include:

  • Extracting pages from a PDF report as individual images for use in presentations.
  • Converting scanned documents into images for OCR or archival purposes.
  • Generating thumbnails or previews of PDF pages for web applications.

Properties

Name Meaning
PDF File Path The full path to the PDF file that will be converted into images.
Output Folder Path The directory path where the generated JPEG images of each PDF page will be saved.

Output

The node outputs the original input data unchanged. The actual image files are saved directly to the specified output folder on the filesystem. There is no JSON output containing image data or metadata; instead, the output folder contains JPEG files named sequentially as page_1.jpg, page_2.jpg, etc., corresponding to each page of the PDF.

Dependencies

  • Requires the external command-line tool pdftocairo (part of the Poppler utilities) installed at /usr/bin/pdftocairo.
  • Uses Node.js modules: fs for filesystem operations, path for path manipulations, pdf-lib for reading PDF page count, and child_process to execute the external conversion command.
  • The environment running this node must have access rights to read the PDF file and write to the output folder.

Troubleshooting

  • Missing pdftocairo executable: If the tool is not installed or not located at /usr/bin/pdftocairo, the node will fail. Install Poppler utilities and ensure the path is correct.
  • File path errors: Incorrect or inaccessible PDF file paths or output folders will cause errors. Verify paths exist and have proper permissions.
  • Permission issues: Lack of write permission in the output folder will prevent image saving.
  • Large PDFs or high resolution: Processing large PDFs or using high scale values may consume significant resources or time.
  • Error messages typically come from the child process execution and indicate problems with the external tool or file access. Checking the exact error message can guide fixing path or permission issues.

Links and References

Discussion