0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions132

PDF → Convert PDF to Base64

AI-generated

Overview

This node provides a utility to convert PDF files into Base64-encoded strings. It accepts a PDF file either as a URL or as binary buffer data and outputs the Base64 representation of that PDF. This is useful in scenarios where you need to embed PDF content directly into JSON payloads, transmit PDFs over text-based protocols, or store PDFs in systems that require Base64 encoding.

Practical examples include:

  • Embedding a PDF document within an email body or API request.
  • Storing PDF content in databases or cloud storage services that accept Base64 strings.
  • Passing PDF data between different systems without dealing with file handling.

Properties

Name Meaning
PDF Source The source of the PDF file. Can be a URL pointing to the PDF or binary buffer data.
File Name Optional name for the output file. Useful for identification or downstream processing.

Output

The node outputs a JSON object containing the Base64-encoded string of the provided PDF file. The exact structure is not fully detailed in the source, but typically it will have a field holding the Base64 string representing the entire PDF content.

If the input was binary data, the output Base64 string corresponds to that binary content encoded in Base64.

No binary output is indicated; the output is purely JSON with Base64 data.

Dependencies

  • Requires an API key credential for authentication to the external service at https://prod.0codekit.com.
  • The node sends a POST request to the endpoint /pdf/base64 with the PDF data and optional filename.
  • No other external dependencies are indicated.

Troubleshooting

  • Common issues:

    • Providing an invalid or inaccessible PDF URL may cause the conversion to fail.
    • Supplying malformed binary data instead of a valid PDF can result in errors or invalid Base64 output.
    • Missing or incorrect API credentials will prevent successful requests.
  • Error messages:

    • Authentication errors due to missing or invalid API keys.
    • HTTP errors if the PDF URL is unreachable or the server returns an error.
    • Validation errors if required parameters like the PDF source are empty.

To resolve these:

  • Ensure the PDF URL is accessible and points to a valid PDF file.
  • Verify the binary data input is correctly formatted.
  • Confirm the API key credential is properly configured in n8n.

Links and References

Discussion