0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

PDF → Remove PDF Pages

AI-generated

Overview

The node provides a utility to remove specified pages from a PDF document. It supports inputting the PDF either via a public URL or as binary buffer data. Users specify which pages to remove using a flexible page range syntax, including support for ranges and negative indexing (e.g., ^1 for the last page). The output can be returned either as a downloadable URL or as raw binary data.

This node is beneficial in scenarios where you need to programmatically edit PDFs by removing unwanted pages without manual intervention. For example:

  • Removing cover pages or appendices from reports before sharing.
  • Excluding confidential pages from documents before distribution.
  • Automating cleanup of large PDF files by removing irrelevant sections.

Properties

Name Meaning
PDF URL Public URL of the PDF file to process.
PDF Buffer Binary buffer data of the PDF file to process.
Pages to Remove Specifies pages to remove from the PDF. Supports single pages, ranges (e.g., 3-5), and negative indexes (e.g., ^1 for last page). Example: 1,3-5,^3-^1.
File Name Desired name for the output PDF file after pages are removed.
Return as URL Boolean flag indicating whether the output PDF should be returned as a downloadable URL (true) or as raw binary data (false).

Output

The node outputs the modified PDF with the specified pages removed. Depending on the "Return as URL" property:

  • If true, the output contains a URL pointing to the downloadable PDF file.
  • If false, the output contains the binary data of the resulting PDF file.

The exact JSON structure of the output includes at least one field holding either the URL string or the binary buffer representing the edited PDF.

Dependencies

  • Requires an API key credential for authentication with the external service at https://prod.0codekit.com.
  • The node sends a POST request to the endpoint /pdf/pages/remove with the provided parameters.
  • No additional environment variables are explicitly required beyond the API key credential.

Troubleshooting

  • Common issues:
    • Invalid page range syntax may cause errors or unexpected results. Ensure page ranges are correctly formatted.
    • Providing both URL and buffer empty or invalid will result in failure to load the PDF.
    • Network or authentication errors if the API key is missing or invalid.
  • Error messages:
    • Errors related to page specification usually indicate malformed input; verify the "Pages to Remove" format.
    • Authentication errors suggest checking the API key credential configuration.
    • File not found or inaccessible URL errors occur if the provided PDF URL is not publicly reachable.

Links and References

  • No direct links available from the source code.
  • For more information, consult the documentation of the external PDF processing service used by this node (likely accessible via the service base URL).

Discussion