# Capture Screenshot — PolyDoc

> Capture a screenshot of a URL, inline HTML, or a saved template. See the documentation.

- Key: `polydoc-convert-screenshot`
- Type: Action (Write)
- Version: 0.0.2
- App: PolyDoc (`polydoc`) — https://pipedream.com/apps/polydoc.md
- This page (HTML): https://pipedream.com/apps/polydoc/actions/convert-screenshot
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/polydoc/actions/convert-screenshot/convert-screenshot.mjs

## Description

Capture a screenshot of a URL, inline HTML, or a saved template. [See the documentation](https://docs.polydoc.tech).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `sourceType` | `string` | Yes | Where the content to render comes from. |
| `url` | `string` | No | The web page to render. Used when Source Type is url. |
| `html` | `string` | No | Inline HTML to render. Used when Source Type is html. |
| `templateId` | `string` | No | ID of a template saved in PolyDoc (for example jlE-whg). Used when Source Type is template. |
| `templateData` | `object` | No | Key-value data passed to the Liquid template renderer. Example: { "customerName": "Ada Lovelace", "invoiceNumber": "INV-1001" }. Used when Source Type is template. |
| `imageType` | `string` | No | Screenshot image format. |
| `fullPage` | `boolean` | No | Capture the entire scrollable page. |
| `quality` | `integer` | No | Compression quality 0-100 for JPEG / WebP. |
| `viewportWidth` | `integer` | No | Viewport width in pixels. |
| `viewportHeight` | `integer` | No | Viewport height in pixels. |
| `devicePixelRatio` | `integer` | No | Device pixel ratio (0-10). |
| `outputEncoding` | `string` | No | Return the screenshot as a binary file or a base64 string. |
| `filename` | `string` | No | Output filename, used in the file written for download delivery. |
| `tag` | `string` | No | A short label (max 30 chars) for logging and analytics. |
| `timeout` | `integer` | No | Conversion timeout in milliseconds. The free tier is capped at 30000. |
| `deliveryMode` | `string` | Yes | How the result is delivered. |
| `presignedUrl` | `string` | No | A presigned upload URL (S3 / GCS / Azure). Used when Delivery Mode is cloudStorage. |
| `webhookUrl` | `string` | No | The URL the file is delivered to. Used when Delivery Mode is webhook. |
| `webhookOptions` | `object` | No | Optional webhook settings. Example: { "async": true, "method": "POST", "headers": { "X-Signature": "abc123" }, "retries": 3, "retryDelay": 1000, "timeout": 10000 }. |
| `advanced` | `object` | No | Raw object deep-merged into the request body for any API field not exposed above (for example pdf.watermark, pdf.pdfa, render, request). Advanced values win on conflict. |
| `syncDir` | `dir` | Yes | SyncDir |

## 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": "polydoc",
      },
    },
  },
)

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: "polydoc-convert-screenshot",
  arguments: {
    sourceType: "Source Type",
    url: "URL",
  },
})
```

**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: "polydoc-convert-screenshot",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    polydoc: { authProvisionId: "apn_xxxxxxx" },
    sourceType: "Source Type",
    url: "URL",
  },
})

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": "polydoc-convert-screenshot",
    "configured_props": {
      "polydoc": { "authProvisionId": "apn_xxxxxxx" },
      "sourceType": "Source Type",
      "url": "URL"
    }
  }'
```

---

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