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

The node provides a "Linearize PDF" operation that optimizes PDF files for faster and more efficient web viewing or printing. Linearization rearranges the internal structure of a PDF to enable progressive loading, meaning users can start viewing the first pages before the entire file is downloaded. This is especially useful for large PDFs accessed over the internet.

Common scenarios include:

  • Preparing PDFs for online distribution where quick preview and access are important.
  • Optimizing PDFs for printing with specific quality or compression profiles.
  • Reducing file size while maintaining usability for web or print.

Practical example: A user uploads a scanned PDF document and wants to linearize it for embedding in a website so visitors can quickly view the content without waiting for full download.

Properties

Name Meaning
Input Data Type Choose how to provide the PDF file to linearize. Options: Binary Data (from previous node), Base64 String (direct base64 encoded content), URL (link to PDF file).
Input Binary Field Name of the binary property containing the PDF file when using Binary Data input type. Default is "data".
Base64 PDF Content Base64 encoded string of the PDF document content, used if Input Data Type is Base64 String.
PDF URL URL to the PDF file to linearize, used if Input Data Type is URL.
Output File Name Desired name for the output linearized PDF file. Default is "linearized_document.pdf".
Document Name Name of the source PDF file for reference purposes. Default is "document.pdf".
Optimization Profile Selects the optimization profile for linearization. Options include: Web (fast loading, progressive display), Max (maximum compression), Print (optimized for printing), Default (balanced), WebMax, PrintMax, PrintGray, Compress, CompressMax.
Advanced Options Collection for additional custom options via JSON profiles to fine-tune the linearization process. Users can specify custom API call properties here.
Binary Data Output Name Custom name for the binary data field in the node's output. Default is "data".

Output

The node outputs the linearized PDF as binary data under the specified binary data output name (default "data"). The output includes:

  • json: Metadata about the processed file, typically including the output file name.
  • binary: The actual linearized PDF file content, ready for further use or saving.

This allows subsequent nodes to easily consume the optimized PDF either by referencing the binary data or exporting it.

Dependencies

  • Requires an external PDF processing service accessible via API to perform the linearization.
  • Needs proper API authentication configured in n8n credentials (an API key or token).
  • Network access to fetch PDF from URL if URL input type is selected.

Troubleshooting

  • Common issues:

    • Invalid or inaccessible PDF URL leading to fetch errors.
    • Incorrect base64 content format causing decoding failures.
    • Missing binary data in the specified input field.
    • API authentication errors due to invalid or missing credentials.
    • Unsupported PDF formats or corrupted files causing processing failures.
  • Error messages and resolutions:

    • "Failed to fetch PDF from URL": Check URL correctness and network accessibility.
    • "Invalid base64 content": Verify the base64 string is properly encoded.
    • "Binary data not found": Ensure the binary property name matches the input data.
    • "Authentication failed": Confirm API credentials are correctly set up in n8n.
    • "PDF processing error": Validate the PDF file integrity and supported format.

Links and References


This summary is based on static analysis of the node's execute method and provided property definitions.

Discussion