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, Delete Unwanted Pages From PDF, allows users to remove specific pages from a PDF document. It is useful in scenarios where you have a multi-page PDF but only want to keep certain pages or exclude unwanted ones before further processing or sharing.

Practical examples include:

  • Removing confidential or irrelevant pages from a report before distribution.
  • Extracting only the necessary pages from a scanned document.
  • Cleaning up PDFs by deleting blank or duplicate pages.

The node supports multiple ways to provide the input PDF: as binary data from a previous node, as a base64 encoded string, or via a URL pointing to the PDF file.

Properties

Name Meaning
Input Data Type How the PDF file is provided. Options:
• Binary Data (from previous node)
• Base64 String (directly provide PDF content)
• URL (link to the PDF file)
Input Binary Field The name of the binary property containing the PDF file when using Binary Data input type (usually "data").
Base64 PDF Content The base64 encoded string representing the PDF document content, used if Input Data Type is Base64 String.
PDF URL The URL to the PDF file, used if Input Data Type is URL.
Document Name The desired filename for the output PDF document after pages are deleted. Defaults to "output.pdf".
Page Numbers Specifies which page numbers to delete from the PDF. Supports single pages (e.g., "2"), multiple pages separated by commas (e.g., "1,3,5"), or ranges (e.g., "2-4").
Output Binary Field Name The name of the binary property where the resulting PDF file will be stored. Defaults to "data".
Advanced Options Optional JSON string to specify custom profiles or additional API options for advanced use cases. For example, adjusting output data format or other API-specific settings.

Output

The node outputs the modified PDF document with the specified pages removed. The output is provided as binary data under the configured binary field name (default "data"). This binary data represents the updated PDF file ready for downstream nodes or saving.

The json output typically contains metadata about the operation or the processed document, but the main content is the binary PDF file.

Dependencies

  • Requires access to an external PDF processing API service that performs the actual page deletion.
  • Needs proper API authentication credentials configured in n8n to authorize requests to the PDF processing service.
  • Internet connectivity is required if the input PDF is provided via URL or if the API is cloud-based.

Troubleshooting

  • Common Issues:

    • Incorrect page number format can cause errors. Ensure page numbers are valid and formatted correctly (e.g., "1,3,5" or "2-4").
    • Providing an invalid or inaccessible URL will result in failure to fetch the PDF.
    • If the binary input field name does not match the actual binary property from the previous node, the PDF will not be found.
    • Missing or invalid API credentials will cause authorization errors.
  • Error Messages:

    • "Invalid page numbers" — Check the page numbers input for correct syntax and valid page references.
    • "Failed to fetch PDF from URL" — Verify the URL is correct and accessible.
    • "No PDF file found in binary property" — Confirm the binary property name matches the input data.
    • "Authentication failed" — Ensure API credentials are properly set up in n8n.

Resolving these usually involves verifying inputs, credentials, and network accessibility.

Links and References

Discussion