PDF Generator API icon

PDF Generator API

Generate PDFs, manage templates, convert HTML/URLs to PDF, and perform PDF operations like watermarking, encryption, and optimization

Overview

The "Decrypt Document" operation of the PDF Service resource allows users to decrypt an encrypted PDF document by providing the correct password. This is useful when you have a password-protected PDF and need to remove encryption to access or process its content further.

Common scenarios include:

  • Automating workflows where encrypted PDFs are received and need to be decrypted before further processing.
  • Removing password protection from PDFs for easier sharing or archiving.
  • Integrating with systems that require unencrypted PDFs for data extraction or modification.

Example: You receive a PDF file from a client that is password protected. Using this node, you provide the encrypted PDF (via URL or base64 content) along with the decryption password, and the node returns the decrypted PDF in your chosen format.

Properties

Name Meaning
PDF Source Source of the PDF document to process. Options: "From URL" (use a public URL), "From Base64" (use base64 encoded content).
PDF URL Public URL to the PDF document (required if PDF Source is "From URL").
PDF Base64 Base64 encoded PDF content (required if PDF Source is "From Base64").
Output Format Choose output format:
- Base64 (JSON): Returns JSON response with base64 string.
- File (Binary): Returns binary file data for download/attachment.
- URL (JSON): Returns JSON response with download URL.
Password Password to decrypt the PDF document (required).

Output

The output depends on the selected "Output Format":

  • Base64 (JSON): The node returns a JSON object containing the decrypted PDF as a base64-encoded string.
  • File (Binary): The node outputs the decrypted PDF as binary data suitable for download or attachment in subsequent workflow steps.
  • URL (JSON): The node returns a JSON object containing a URL where the decrypted PDF can be downloaded.

In all cases, the output JSON includes metadata such as success status, operation name, filename, format, and file size (for binary output).

Dependencies

  • Requires an API key credential for the PDF Generator API service.
  • The node makes authenticated HTTP POST requests to the /pdfservices/decrypt endpoint of the external PDF Generator API.
  • The user must supply a valid password to decrypt the PDF.
  • For "From URL" source, the PDF must be publicly accessible via the provided URL.
  • For "From Base64" source, the PDF content must be correctly base64 encoded.

Troubleshooting

  • Invalid or missing password: If the password is incorrect or not provided, the API will fail to decrypt the PDF. Ensure the correct password is entered.
  • Invalid PDF source: If the URL is inaccessible or the base64 content is malformed, the request will fail. Verify the URL is public and reachable or that the base64 string is valid.
  • Unsupported output format: Selecting an unsupported output format may cause errors. Use one of the provided options.
  • API authentication errors: Ensure the API key credential is configured correctly in n8n.
  • Large files: Decrypting very large PDFs might lead to timeouts or memory issues depending on the environment.

Common error messages:

  • "Password to decrypt the PDF document is required": Enter the decryption password.
  • "The operation 'decrypt' is not supported for resource 'pdfServices'": Check that the resource and operation are set correctly.
  • "Failed to fetch PDF from URL": Confirm the URL is correct and publicly accessible.

Links and References


This summary covers the static analysis of the execute() method logic related to the "Decrypt Document" operation under the "PDF Service" resource, based on the provided properties and bundled source code.

Discussion