0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

PDF → Resize PDF Pages

AI-generated

Overview

The "Resize PDF Pages" operation in the PDF resource allows users to resize pages of a PDF document to a specified target size. This node is useful when you need to standardize or adjust the page dimensions of PDFs for printing, presentation, or compliance with specific format requirements.

Typical use cases include:

  • Resizing scanned documents to common paper sizes like A4 or Letter.
  • Preparing PDFs for different print formats by resizing pages accordingly.
  • Adjusting only selected pages within a PDF rather than the entire document.

For example, you might input a PDF from a URL or binary buffer, specify that only pages 1 and 3 to 5 should be resized to A4 size, and choose how the content fits on the new page (fit inside, fill, or stretch). The output can be returned as a downloadable URL or as binary data.

Properties

Name Meaning
PDF URL Public URL of the PDF file to be resized.
PDF Buffer Binary buffer data of the PDF file to be resized.
Target Size The desired page size to resize to. Options: A3, A4, A5, Legal, Letter, Tabloid.
Pages to Resize Specifies which pages to resize. Supports ranges (e.g., "1,3-5,^3-^1"), where 1 is first page and ^1 last page. Leave empty to resize all pages.
Fit Mode How to fit the existing content into the new page size. Options: Fit Inside (content fits within page), Fill (content fills page, possibly cropping), Stretch (content stretched to fill page).
File Name Desired name for the output PDF file.
Return as URL Boolean flag indicating whether to return the resized PDF as a downloadable URL (true) or as binary data (false).

Output

The node outputs the resized PDF either as:

  • A downloadable URL if "Return as URL" is set to true. This URL points to the processed PDF file.
  • Binary data representing the resized PDF file if "Return as URL" is false.

The output JSON will contain the relevant link or binary data depending on the chosen option.

Dependencies

  • Requires an API key credential for authentication with the external 0CodeKit service.
  • The node sends a POST request to the endpoint /pdf/pages/resize on the 0CodeKit API.
  • The user must provide either a public URL or binary buffer of the PDF to process.
  • Network access to the 0CodeKit API endpoint is required.

Troubleshooting

  • Invalid PDF input: If neither a valid URL nor a binary buffer is provided, the operation will fail. Ensure one of these inputs is correctly set.
  • Page range errors: Incorrectly formatted page ranges (e.g., invalid syntax) may cause errors or unexpected behavior. Use correct syntax like "1,3-5,^1".
  • API authentication errors: Missing or invalid API credentials will prevent the node from working. Verify the API key configuration.
  • Network issues: Connectivity problems to the external API will cause failures. Check network and firewall settings.
  • File naming: If the output filename is not set, the system may assign a default name; ensure the filename is valid and includes .pdf extension if needed.

Links and References

Discussion