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 "Rotate Page" allows users to rotate specific pages within a PDF document. It supports multiple input methods for the PDF file, including binary data from a previous node, base64 encoded string, or a URL pointing to the PDF. Users can specify which pages to rotate and choose the rotation direction (clockwise, counter-clockwise, upside down, or no rotation). This is useful in scenarios where scanned documents or PDFs have pages oriented incorrectly and need adjustment without reprocessing the entire document.

Practical examples:

  • Rotating scanned pages that were scanned sideways.
  • Adjusting orientation of specific pages in a multi-page PDF before further processing or archiving.
  • Preparing documents for printing by ensuring all pages have correct orientation.

Properties

Name Meaning
Input Data Type Choose how to provide the PDF file: "Binary Data" (from previous node), "Base64 String" (base64 encoded PDF content), or "URL" (link to PDF file).
Input Binary Field Name of the binary property containing the PDF file when using "Binary Data" input type (usually "data").
Base64 PDF Content Base64 encoded string of the PDF document content, used if "Base64 String" input type is selected.
PDF URL URL to the PDF file, used if "URL" input type is selected.
Document Name Name for the output PDF document after rotation (default "output.pdf").
Rotation Type Type of rotation to apply to specified pages: "No Rotation", "Clockwise" (90° clockwise), "Counter Clockwise" (90° counter-clockwise), or "Upside Down" (180° rotation).
Page Numbers Pages to rotate, specified as a string with single pages ("1"), comma-separated list ("1,3,5"), or ranges ("2-4").
Advanced Options Optional JSON string to set custom profiles or additional API options for advanced use cases.

Output

The node outputs the rotated PDF document in the json output field along with binary data representing the modified PDF file. The binary data contains the actual PDF file after page rotation, ready for download, further processing, or passing to subsequent nodes.

If the input was binary, the output will include updated binary data with the rotated PDF. If the input was base64 or URL, the output similarly provides the rotated PDF content in binary form.

Dependencies

  • Requires access to an external PDF processing API service capable of rotating PDF pages.
  • Needs an API authentication token or key configured in n8n credentials to authorize requests to the PDF processing service.
  • Internet access may be required if providing PDF via URL or if the API is cloud-based.

Troubleshooting

  • Common issues:

    • Incorrect page numbers format can cause errors; ensure pages are specified correctly (e.g., "1", "1,3,5", or "2-4").
    • Providing an invalid or inaccessible URL will result in failure to fetch the PDF.
    • Missing or incorrect binary property name when using binary input will cause the node to fail to find the PDF file.
    • Invalid base64 string input will cause decoding errors.
  • Error messages:

    • "Failed to fetch PDF from URL": Check the URL accessibility and correctness.
    • "Invalid page numbers format": Verify the page numbers string syntax.
    • "Missing binary data": Ensure the binary property name matches the input data.
    • API authentication errors: Confirm API key/token is correctly configured in n8n credentials.

Resolving these typically involves verifying input parameters, ensuring proper credential setup, and confirming network connectivity.

Links and References

Discussion