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 multiple input methods for the PDF file: binary data from a previous node, a base64 encoded string, or a URL pointing to the PDF. Users can specify which pages to convert (all pages, specific pages, or a range), and configure output image settings such as format and width.

This functionality is useful in scenarios where you need to extract visual representations of PDF pages for previews, thumbnails, or further image processing workflows. For example, generating page thumbnails for a document management system, converting reports into images for embedding in presentations, or extracting pages as images for OCR or annotation.

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 (usually "data") — used when Input Data Type is Binary Data
Base64 PDF Content Base64 encoded PDF document content — used when Input Data Type is Base64 String
PDF URL URL to the PDF file to convert — used when Input Data Type is URL
Document Name Name of the source PDF file for reference (e.g., "original-file.pdf")
Image Settings Settings for output images:
- Image Width (pixels): Width of output images (100–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 of page numbers or ranges (e.g., "1,3,5" or "1-5") — used when Page Selection is Specific Pages or Page Range
Output File Name Prefix Prefix for output image files (e.g., "page" will create files like page_1.jpg, page_2.jpg, etc.)

Output

The node outputs an array of JSON objects, each representing one converted image page. Each item typically contains:

  • json: Metadata about the image, including page number and possibly other details.
  • binary: The actual image data in the specified format (e.g., JPEG, PNG) for each converted page.

Thus, the output provides both metadata and the binary image content for each page converted from the PDF.

Dependencies

  • Requires access to the PDF file either as binary data, base64 string, or via a URL.
  • Likely depends on an external PDF processing service or library capable of rendering PDF pages to images (not explicitly shown in the code but implied by the action call).
  • No explicit API keys or credentials are visible in the provided code snippet, but typical usage may require configuration of authentication if URLs point to protected resources or if the underlying PDF processing service requires it.

Troubleshooting

  • Common Issues:

    • Providing an invalid or inaccessible PDF URL will cause failures in fetching the PDF.
    • Incorrect base64 encoding or corrupted binary data will result in errors during conversion.
    • Specifying page numbers or ranges outside the actual page count of the PDF may cause errors or empty results.
    • Unsupported image formats or widths outside allowed ranges may cause validation errors.
  • Error Messages:

    • Errors related to "file not found" or "unable to fetch PDF" indicate issues with the URL or network.
    • "Invalid PDF content" or "corrupted file" suggests problems with the input data.
    • "Page number out of range" indicates incorrect page selection parameters.
  • Resolutions:

    • Verify the accessibility and correctness of the PDF URL or input data.
    • Ensure base64 strings are properly encoded without extra characters.
    • Double-check page selection inputs against the actual PDF page count.
    • Use supported image formats and valid width values.

Links and References

Discussion