PDF.co Api icon

PDF.co Api

Generate PDF, extract data from PDF, split PDF, merge PDF, convert PDF. Fill PDF forms, add text and images to pdf and much more with pdf.co!

Overview

This node provides functionality to upload files to PDF.co using two different methods: a standard direct upload via presigned URLs and an upload using base64 encoding. It is useful in scenarios where you need to send files to PDF.co for further processing, such as converting documents, extracting data, or storing files remotely.

  • Standard Upload (presignedUrl): Suitable for larger files up to 2GB. The file can be uploaded either from binary data available in the workflow or from text content.
  • Base64 Upload: Suitable for smaller files where the file content is provided as a base64 encoded string.

Practical examples:

  • Uploading a scanned document stored as binary data in n8n to PDF.co for OCR processing.
  • Sending a small text file encoded in base64 to PDF.co for conversion to PDF format.

Properties

Name Meaning
Upload Method The method used to upload the file. Options:
- Standard Upload (presignedUrl): Direct upload supporting large files up to 2GB.
- Base64: Upload using base64 encoding, suitable for smaller files.
Binary File Boolean flag indicating if the file data should be taken from a binary field (only for Standard Upload).
File Content Text content of the file to upload (used when Binary File is false and Upload Method is Standard Upload).
Input Binary Field The name of the input binary field containing the file to be uploaded (required if Binary File is true).
Base64 Content Base64 encoded content of the file to upload (required if Upload Method is Base64).
File Name The name of the file to upload (required).

Output

The node outputs JSON data representing the result of the upload operation. This typically includes information such as the URL or identifier of the uploaded file on PDF.co. If the node supports binary output, it would represent the uploaded file or related data, but based on the provided code and properties, the main output is JSON metadata about the upload.

Dependencies

  • Requires access to PDF.co API services.
  • Needs an API authentication token or API key credential configured in n8n to authorize requests to PDF.co.
  • No other external dependencies are indicated in the provided source code snippet.

Troubleshooting

  • File size limits: Using the Base64 upload method for large files may cause failures due to size constraints or memory issues. Use the Standard Upload method for larger files.
  • Missing binary data: If "Binary File" is enabled but the specified binary property does not exist or is empty, the upload will fail.
  • Invalid base64 content: Providing malformed or incomplete base64 strings will cause errors during upload.
  • Authentication errors: Ensure that the API key or token is correctly configured and has sufficient permissions.
  • Network issues: Uploads may fail due to connectivity problems; verify network access to PDF.co endpoints.

Links and References

Discussion