> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pdf.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Convert Anything to PDF

> This operation allows you to convert a variety of file types into PDF format. It supports transforming CSV, document (RTF, DOC, DOCX, TXT), email (MSG or EML), image (JPG, PNG, and TIFF), and spreadsheet (XLS or XLSX) into high-quality PDF files easily.

<img src="https://mintcdn.com/pdfco/tXGo3rbTS_pEF5es/images/integrations/n8n/convert-to-pdf.png?fit=max&auto=format&n=tXGo3rbTS_pEF5es&q=85&s=80bd58094fbeea8ad022e9996735d24b" alt="Convert To Pdf Pn" width="886" height="1038" data-path="images/integrations/n8n/convert-to-pdf.png" />

## Input

| Name                          | Description                                                                                                                                                                                                                                                                                                                                                                                                                               | Required |
| :---------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------- |
| **PDF URL**                   | Provide the URL to the source PDF document, or a `filetoken://` link from [PDF.co Built-In Files Storage](https://app.pdf.co/tools/files). If you use another cloud service such as **Google Drive** or **Dropbox** ensure the link is publicly accessible.                                                                                                                                                                               | Yes      |
| **Conversion Type**           | Choose from which document you want to convert to PDF, such as **CSV**, **Document** (RTF, DOC, DOCX, TXT), **Email** (MSG or EML), **Image** (JPG, PNG, TIFF), or **Spreadsheet** (XLS and XLSX).                                                                                                                                                                                                                                        | Yes      |
| **Auto Size**                 | Set to true to adjust page dimensions to content with automatic page sizing. If `false`, uses worksheet’s page setup.                                                                                                                                                                                                                                                                                                                     | No       |
| **Embed Attachment**          | Set to `false` if you don’t want to convert attachments from the original email and want to embed them as original files (as embedded PDF attachments). Converts attachments that are supported by the PDF.co API (DOC, DOCx, HTML, PNG, JPG etc.) into PDF format and then merges into output final PDF. Non-supported file types are added as PDF attachments (Adobe Reader or another viewer may be required to view PDF attachments). | No       |
| **Convert Attachment to PDF** | Set to `true` to automatically embeds all attachments from original input email `MSG` or `EML` files into the final output PDF. Set it to `false` if you don’t want to embed attachments so it will convert only the body of the input email. True by default.                                                                                                                                                                            | No       |
| **Margins**                   | Set custom margins, overriding CSS default margins. Specify the margins in the format `{top} {right} {bottom} {left}`. You can use`px`,`mm`,`cm`or`in`units. Also, you can set margins for all sides at once using a single value.                                                                                                                                                                                                        | No       |
| **Orientation**               | Set the document orientation. Options: `Portrait` for vertical layout, and `Landscape` for horizontal layout.                                                                                                                                                                                                                                                                                                                             | No       |
| **Paper Size**                | Specifies the paper size. Accepts standard sizes like `Letter`, `Legal`,`Tabloid` , `Ledger`, `A0` - `A6`.                                                                                                                                                                                                                                                                                                                                | No       |
| **Custom Paper Size**         | You can custom paper size by providing width and height separated by a space, with optional units:  `px`  (pixels),  `mm` (millimeters),  `cm`  (centimeters), or `in`  (inches). Examples: ‘`200 300`’, ‘`200px 300px`’, ‘`200mm 300mm`’, ‘`20cm 30cm`’, ‘`6in 8in`’.                                                                                                                                                                    | No       |
| **File Name**                 | File name for the generated output, the input must be in string format.                                                                                                                                                                                                                                                                                                                                                                   | No       |
| **Webhook URL**               | The callback URL or Webhook used to receive the output data.                                                                                                                                                                                                                                                                                                                                                                              | No       |
| **HTTP Username**             | HTTP auth user name if required to access source URL.                                                                                                                                                                                                                                                                                                                                                                                     | No       |
| **HTTP Password**             | HTTP auth password if required to access source URL.                                                                                                                                                                                                                                                                                                                                                                                      | No       |
| **Custom Profiles**           | Use JSON to customize PDF processing with options like output resolution, OCR settings, text extraction methods, encryption, and image handling. Check our [Custom Profile](#custom-profiles) section to see all available parameters for your current endpoint.                                                                                                                                                                          | No       |

## Custom Profiles

You can set additional options for the operation used in the PDF.co node by using **Custom Profiles**. A custom profile is a string in **JSON-like format** containing predefined parameters.

Here’s an example of a Custom Profiles input:

```
{ "outputDataFormat": "base64" }
```

With this input, the PDF.co operation will return the output in `base64` format. You can find the list of available parameters for customizing profiles in the PDF.co operation documentation below:

<Tip>
  You can use any regular API parameter from the [API Reference](/api-reference) within n8n using the `std_params` feature in profiles. The `std_params` enables the definition of regular API parameters in a JSON format, See [Standard Parameters](/api-reference/profiles#standard-parameters) for detailed documentation and examples.
</Tip>

| Parameter                 | Type   | Default | Description                                                                                                                                                                                                                   |
| :------------------------ | :----- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `outputDataFormat`        | string | -       | If you require your output as `base64` format, set this to `base64`                                                                                                                                                           |
| `DataEncryptionAlgorithm` | string | -       | Controls the encryption algorithm used for data encryption. See [**User-Controlled Encryption**](/knowledgebase/user-controlled-encryption) for more information. The available algorithms are: `AES128`, `AES192`, `AES256`. |
| `DataEncryptionKey`       | string | -       | Controls the encryption key used for data encryption. See [**User-Controlled Encryption**](/knowledgebase/user-controlled-encryption) for more information.                                                                   |
| `DataEncryptionIV`        | string | -       | Controls the encryption IV used for data encryption. See [**User-Controlled Encryption**](/knowledgebase/user-controlled-encryption) for more information.                                                                    |
| `DataDecryptionAlgorithm` | string | -       | Controls the decryption algorithm used for data decryption. See [**User-Controlled Encryption**](/knowledgebase/user-controlled-encryption) for more information. The available algorithms are: `AES128`, `AES192`, `AES256`. |
| `DataDecryptionKey`       | string | -       | Controls the decryption key used for data decryption. See [**User-Controlled Encryption**](/knowledgebase/user-controlled-encryption) for more information.                                                                   |
| `DataDecryptionIV`        | string | -       | Controls the decryption IV used for data decryption. See [**User-Controlled Encryption**](/knowledgebase/user-controlled-encryption) for more information.                                                                    |

## Output

| Name                  | Description                                                                                                                      |
| :-------------------- | :------------------------------------------------------------------------------------------------------------------------------- |
| `jobId`               | Unique identifier for the background job.                                                                                        |
| `pageCount`           | Number of pages in the PDF document.                                                                                             |
| `error`               | Indicates whether an error occurred (`false` means success)                                                                      |
| `status`              | Status code of the request (200, 404, 500, etc.). For more information, see [**Response Codes**](/api-reference/response-codes). |
| `credits`             | Number of credits consumed by the request                                                                                        |
| `remainingCredits`    | Number of credits remaining in the account                                                                                       |
| `duration`            | Time taken for the operation in milliseconds                                                                                     |
| `url`                 | Direct URL to the final PDF file stored in S3.                                                                                   |
| `name`                | Name of the output file                                                                                                          |
| `outputLinkValidTill` | Timestamp indicating when the output link will expire                                                                            |
