# Anything to PDF Converter — PDF.co

> Convert CSV, XLS, XLSX, DOC, DOCX, RTF, TXT, XPS, JPG, PNG, TIFF, URL, EMAIL to PDF. See docs here

- Key: `pdf_co-anything-to-pdf-converter`
- Type: Action (Read-only)
- Version: 0.0.2
- App: PDF.co (`pdf_co`) — https://pipedream.com/apps/pdf-co.md
- This page (HTML): https://pipedream.com/apps/pdf-co/actions/anything-to-pdf-converter
- Hints: read-only · open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pdf_co/actions/anything-to-pdf-converter/anything-to-pdf-converter.mjs

## Description

Convert CSV, XLS, XLSX, DOC, DOCX, RTF, TXT, XPS, JPG, PNG, TIFF, URL, EMAIL to PDF. [See docs here](https://apidocs.pdf.co/22-pdf-from-csv-csv-to-pdf)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `httpusername` | `string` | No | HTTP auth user name if required to access source url. |
| `httppassword` | `string` | No | HTTP auth password if required to access source url. |
| `name` | `string` | No | File name for generated output. |
| `expiration` | `integer` | No | Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). |
| `async` | `boolean` | No | Runs processing asynchronously. Returns JobId. |
| `profiles` | `any` | No | Use this parameter to set additional configuration for fine tuning and extra options. Explore PDF.co for profile examples. |
| `url` | `string` | Yes | URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. |
| `sourceType` | `string` | Yes | Select the type of the source file. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "pdf_co",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "pdf_co-anything-to-pdf-converter",
  arguments: {
    httpusername: "HTTP Username",
    httppassword: "HTTP Password",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "pdf_co-anything-to-pdf-converter",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pdf_co: { authProvisionId: "apn_xxxxxxx" },
    httpusername: "HTTP Username",
    httppassword: "HTTP Password",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "pdf_co-anything-to-pdf-converter",
    "configured_props": {
      "pdf_co": { "authProvisionId": "apn_xxxxxxx" },
      "httpusername": "HTTP Username",
      "httppassword": "HTTP Password"
    }
  }'
```

---

- App: https://pipedream.com/apps/pdf-co.md · All apps: https://pipedream.com/apps
