# PDF Merge — PDF.co

> Merge PDF from two or more PDF files into a new one. See docs here

- Key: `pdf_co-pdf-merge`
- Type: Action (Write)
- 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/pdf-merge
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pdf_co/actions/pdf-merge/pdf-merge.mjs

## Description

Merge PDF from two or more PDF files into a new one. [See docs here](https://apidocs.pdf.co/31-pdf-merge)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `urls` | `string[]` | Yes | Array of urls to the source PDF files in the same order that you want them to be processed. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. |
| `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. |

## 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-pdf-merge",
  arguments: {
    urls: ["URL"],
    name: "Name",
  },
})
```

**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-pdf-merge",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pdf_co: { authProvisionId: "apn_xxxxxxx" },
    urls: ["URL"],
    name: "Name",
  },
})

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-pdf-merge",
    "configured_props": {
      "pdf_co": { "authProvisionId": "apn_xxxxxxx" },
      "urls": ["URL"],
      "name": "Name"
    }
  }'
```

---

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