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 convert various file types into PDF format. It supports converting CSV files, documents (RTF, DOC, DOCX, TXT), emails (MSG or EML), images (JPG, PNG, TIFF), and Excel spreadsheets (XLS, XLSX) into PDFs. This is useful in scenarios where users need to standardize different document formats into a universally accessible PDF format for sharing, archiving, or further processing.

Practical examples include:

  • Converting a CSV report into a PDF for easy distribution.
  • Transforming Word documents or text files into PDFs for consistent formatting.
  • Archiving emails as PDFs including their attachments.
  • Creating PDFs from images for presentations or documentation.
  • Converting Excel sheets into PDFs for reporting purposes.

Properties

Name Meaning
Convert Type The type of conversion to perform. Options: CSV to PDF, Document to PDF, Email to PDF, Image to PDF, XLS to PDF, XLSX to PDF.
Url The URL of the source file to convert. Required.
Worksheet Index (For XLS/XLSX only) The index of the worksheet to convert, starting at 0. Optional.
Advanced Options (Common) Additional options applicable to Document, XLS, XLSX, and Image conversions:
- File Name: name of the output PDF file.
- Webhook URL: callback URL to receive output data.
- Output Links Expiration: link expiry time in minutes.
- HTTP Username/Password: credentials if source URL requires authentication.
- Custom Profiles: JSON string to customize API call properties.
Advanced Options (CSV) Additional options specific to CSV conversion:
- File Name
- Auto Size: whether to auto-size pages.
- Webhook URL
- Output Links Expiration
- HTTP Username/Password
- Custom Profiles.
Advanced Options (Email) Additional options specific to Email conversion:
- File Name
- Embed Attachments: whether to embed email attachments in the PDF.
- Convert Attachments to PDF: whether to convert attachments themselves.
- Margins: margins of the PDF.
- Orientation: portrait or landscape.
- Paper Size: predefined sizes or custom.
- Custom Paper Size: dimensions if custom size selected.
- Webhook URL
- Output Links Expiration
- Custom Profiles.

Output

The node outputs JSON data containing information about the converted PDF file. Typically, this includes links or base64 encoded content of the generated PDF. If a webhook URL is provided, the output may be delivered asynchronously via that callback.

Binary data output is not explicitly detailed but can be assumed to represent the PDF file content when returned directly.

Dependencies

  • Requires access to an external PDF conversion API service.
  • Needs an API key credential configured in n8n to authenticate requests to the PDF conversion service.
  • Source files must be accessible via the provided URLs; HTTP authentication credentials can be supplied if needed.
  • Optional webhook URLs can be used to receive asynchronous callbacks with conversion results.

Troubleshooting

  • Invalid URL or inaccessible source file: Ensure the URL is correct and publicly accessible or provide valid HTTP authentication credentials.
  • Unsupported file format: Verify that the input file matches one of the supported types for the chosen conversion type.
  • API authentication errors: Confirm that the API key credential is correctly set up and has necessary permissions.
  • Webhook failures: Check that the webhook URL is reachable and properly handles incoming POST requests.
  • Custom profiles JSON errors: Validate JSON syntax when using custom profiles to avoid malformed requests.

Links and References

Discussion