PDF Tools

Manipulate PDF files with various operations

Overview

The "Delete Pages" operation of the PDF Tools node allows users to remove specific pages from a PDF document. This is useful when you want to discard unwanted or sensitive pages from a PDF before further processing or sharing.

Common scenarios include:

  • Removing cover pages or blank pages from reports.
  • Deleting confidential pages before sending a document externally.
  • Cleaning up scanned PDFs by removing unnecessary pages.

For example, if you have a 10-page PDF and want to delete pages 2, 4 to 6, you can specify "2,4-6" as the pages to delete. The node will output a new PDF without those pages.

Properties

Name Meaning
PDF Binary Field Name of the binary field containing the input PDF file to process.
Pages Pages to delete from the PDF. Accepts single pages (e.g., "1"), ranges (e.g., "3-5"), or "all".

Output

The node outputs a single PDF file in binary format with the specified pages removed. The output binary data has:

  • data: Base64-encoded PDF content after page deletion.
  • fileName: Defaults to "output.pdf".
  • mimeType: Always "application/pdf".

This output can be used downstream in workflows for further PDF manipulation, storage, or sending.

Dependencies

  • Requires the pdf-lib library for PDF manipulation.
  • Uses n8n-workflow utilities for error handling.
  • No external API calls or services are required.
  • Input PDF must be provided as binary data within the workflow.

Troubleshooting

  • Error: No binary data found for [field name]
    Ensure that the specified binary field containing the PDF exists on the input item and contains valid PDF data.

  • Error: The file must be in PDF format (MIME type: application/pdf). Received: [type]
    Verify that the binary data's MIME type is exactly application/pdf. Other formats are not supported.

  • Error: Invalid page numbers. Pages must be between 1 and [total pages]
    Check that the pages string only references existing pages within the PDF. Page numbering starts at 1.

  • Error: Pages to delete are required
    Make sure the "Pages" property is set and not empty.

Links and References

Discussion