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 as part of a broader PDF and image processing toolset. Specifically, the "Compress PDF" operation reduces the file size of PDF documents to optimize them for different use cases such as web publishing, printing, or screen viewing.

Common scenarios where this node is beneficial include:

  • Reducing PDF file sizes before sending via email or uploading to websites.
  • Optimizing PDFs for faster loading on web pages.
  • Preparing PDFs for high-quality print with balanced compression.
  • Archiving large numbers of PDFs efficiently by compressing them.

Practical example: You have scanned contracts saved as large PDFs and want to reduce their size for easier sharing without losing too much quality. Using this node's Compress PDF operation, you can input the original PDF (via binary data, base64 string, or URL), select an optimization profile, and get a compressed PDF output 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 Name of the binary property containing the PDF file (used if Input Data Type is Binary Data).
Base64 PDF Content Base64 encoded PDF content (used if Input Data Type is Base64 String).
PDF URL URL to the PDF file to compress (used if Input Data Type is URL).
Output File Name Name for the output compressed PDF file.
Optimize Profile Optimization profile for compression. Options: Web, Print, Screen.
Async Enable asynchronous processing (true/false).

Output

The node outputs JSON data representing the compressed PDF file. The main output includes:

  • A binary property containing the compressed PDF file data, named according to the workflow's conventions.
  • The JSON output may also include metadata about the compression process or file details depending on implementation.

If the node supports binary data output, it will provide the compressed PDF in binary form suitable for saving or passing to subsequent nodes.

Dependencies

  • Requires access to an external PDF processing service or API capable of compressing PDF files.
  • Needs appropriate API authentication credentials configured in n8n to authorize requests.
  • Network access to fetch PDFs from URLs if that input method is used.
  • No additional environment variables are explicitly required beyond standard API credential setup.

Troubleshooting

  • Common issues:

    • Providing an invalid or inaccessible URL for the PDF file will cause errors fetching the document.
    • Incorrectly specifying the binary property name when using binary input will result in missing input data.
    • Using an unsupported or corrupted PDF file format may cause compression failures.
    • Insufficient permissions or invalid API credentials will lead to authorization errors.
  • Error messages and resolutions:

    • "Input binary property not found": Verify the binary field name matches the previous node's output.
    • "Failed to fetch PDF from URL": Check the URL is correct, publicly accessible, and uses HTTPS if required.
    • "Compression service authorization failed": Confirm API credentials are valid and properly configured.
    • "Unsupported PDF format": Ensure the input PDF is not corrupted and conforms to standard PDF specifications.

Links and References

Discussion