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 provides PDF compression functionality, allowing users to reduce the file size of PDF documents. It supports multiple input methods for providing the PDF file: as binary data from a previous node, as a base64 encoded string, or via a URL pointing to the PDF file. Users can specify an optimization profile tailored for different use cases such as web display, printing, or screen viewing. The node also supports asynchronous processing to handle potentially long-running compression tasks efficiently.

Common scenarios where this node is beneficial include:

  • Reducing PDF file sizes before sending them via email or uploading to cloud storage.
  • Optimizing PDFs for faster loading on websites or mobile devices.
  • Preparing PDFs for printing with higher quality settings.
  • Automating document workflows that require compressed PDFs to save bandwidth and storage.

Practical example:

  • A user receives large PDF reports from various sources and wants to compress them automatically before archiving or sharing. They can feed the original PDFs into this node, select the "Web" optimize profile for smaller size, and output compressed PDFs ready for distribution.

Properties

Name Meaning
Input Data Type Choose how to provide the PDF file to compress. Options: Binary Data, Base64 String, URL
Input Binary Field (If using Binary Data) Name of the binary property containing the PDF file
Base64 PDF Content (If using Base64 String) Base64 encoded content of the PDF file
PDF URL (If using URL) URL pointing to the PDF file to compress
Output File Name Desired name for the output compressed PDF file
Optimize Profile Compression optimization profile. Options: Web, Print, Screen
Async Enable asynchronous processing (true/false)
Binary Data Output Name Custom name for the binary data in the node's output (default is "data")

Output

The node outputs the compressed PDF file as binary data under the specified binary data output name (default "data"). The JSON output contains metadata about the operation and references to the binary data. The binary data represents the compressed PDF file ready for further use or download.

Dependencies

  • Requires access to an external PDF compression service or API (implied by the imported action module for compressing PDFs).
  • Needs appropriate API credentials configured in n8n to authenticate requests to the PDF compression service.
  • Network access to fetch PDFs if using the URL input method.

Troubleshooting

  • Common issues:

    • Providing an invalid or inaccessible URL will cause failures when fetching the PDF.
    • Incorrect base64 encoding or corrupted binary data may result in errors during compression.
    • Missing or misnamed binary property fields can lead to the node not finding the input PDF.
    • API authentication failures due to missing or incorrect credentials.
  • Error messages and resolutions:

    • "Failed to fetch PDF from URL": Check the URL validity and network connectivity.
    • "Invalid PDF content": Verify the input data format and encoding.
    • "Authentication error": Ensure API credentials are correctly set up in n8n.
    • "Binary property not found": Confirm the binary field name matches the input data.

Links and References

Discussion