PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

This node operation "Create Images From PDF" converts pages of a PDF document into image files. It supports various input methods for the PDF, including binary data from a previous node, a base64 encoded string, or a URL to the PDF file. Users can specify which pages to convert (all, specific pages, or a range) and configure output image settings such as format and width.

This node is beneficial in scenarios where you need to extract visual representations of PDF pages for previews, thumbnails, or further image processing workflows. For example, converting an invoice PDF into JPEG images for display on a website or extracting certain pages as PNG images for archival purposes.

Properties

Name Meaning
Input Data Type Method to provide the PDF file:
- Binary Data: Use PDF file from previous node
- Base64 String: Provide PDF content as base64 encoded string
- URL: Provide URL to PDF file
Input Binary Field Name of the binary property containing the PDF file (used when Input Data Type is Binary Data). Usually "data" for file uploads.
Base64 PDF Content Base64 encoded string of the PDF document content (used when Input Data Type is Base64 String).
PDF URL URL pointing to the PDF file to convert (used when Input Data Type is URL).
Document Name Reference name for the source PDF file, e.g., "original-file.pdf".
Image Settings Settings for output images:
- Image Width (pixels): Width of output images, between 100 and 4000 pixels.
- Image Format: Output image format options include JPG, JPEG, BMP, GIF, JB2, JP2, JPF, JPX, PNG, TIF, TIFF.
Page Selection Which pages to convert:
- All Pages
- Specific Pages
- Page Range
Page Numbers Comma-separated list or range of page numbers to convert, e.g., "1,3,5" or "1-5" (shown if Page Selection is Specific Pages or Page Range).
Output File Name Prefix Prefix for naming output image files, e.g., "page" will produce files like page_1.jpg, page_2.jpg, etc.
Output Binary Field Name Name of the binary property to store the output image files.

Output

The node outputs an array of items, each representing one converted image from the PDF pages. Each item contains:

  • A json object with metadata about the image (such as page number).
  • A binary property (name configurable by "Output Binary Field Name") containing the image file data in the selected format.

If multiple pages are converted, multiple output items are produced, one per image.

Dependencies

  • Requires access to the PDF file either via binary input, base64 string, or URL.
  • No explicit external API keys or credentials are indicated in the code snippet; however, the node likely depends on an underlying PDF processing library or service integrated within the n8n environment.
  • Proper configuration of the workflow to supply the PDF input correctly is necessary.

Troubleshooting

  • Common issues:

    • Incorrect input data type or missing PDF content will cause failures.
    • Invalid page numbers or ranges may result in errors or no output.
    • Unsupported image formats or invalid width values outside allowed range could cause errors.
    • Network issues when providing a PDF URL might prevent fetching the file.
  • Error messages:

    • Errors related to missing binary data or invalid base64 strings indicate incorrect input setup.
    • Page selection errors usually stem from malformed page number strings.
    • If the node throws errors about unsupported formats or sizes, verify the image settings inputs.
  • Resolutions:

    • Ensure the PDF input matches the selected input data type.
    • Validate page numbers and ranges carefully.
    • Use supported image formats and widths within specified limits.
    • Confirm network accessibility if using a URL input.

Links and References

Discussion