# Document Toggle Searchable — PDF.co

> Turn PDF and scanned JPG, PNG images into text-searchable PDF or text-unsearchable. See docs here

- Key: `pdf_co-document-toggle-searchable`
- 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/document-toggle-searchable
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pdf_co/actions/document-toggle-searchable/document-toggle-searchable.mjs

## Description

Turn PDF and scanned JPG, PNG images into text-searchable PDF or text-unsearchable. [See docs here](https://apidocs.pdf.co/11-pdf-make-text-searchable-or-unsearchable)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `url` | `string` | Yes | URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. |
| `setSearchable` | `boolean` | Yes | Select if the document should be searchable. |
| `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. |
| `lang` | `string` | No | Sets language for OCR (text from image) to use for scanned PDF, PNG, JPG documents input when extracting text. Default is “eng”. Other languages are also supported: deu, spa, chi_sim, jpn and many others (full list of supported OCR languages is (here)[https://apidocs.pdf.co/kb/OCR/list-of-supported-languages-for-ocr]. You can also use 2 languages simultaneously like this: eng+deu or jpn+kor (any combination). |
| `pages` | `string` | No | For ALL pages just leave this param empty. Comma-separated list of page indices (or ranges) to process. the very first page starts at 0 (zero). To set a range use the dash -, for example: 0,2-5,7-. To set a range from index to the last page use range like this: 2- (from page #3 as the index starts at zero and till the end of the document). Example: 0,2-5,7- means first page, then 3rd page to 6th page, and then the range from 8th (index = 7) page till the end of the document. |
| `password` | `string` | No | Password of PDF file. |
| `async` | `boolean` | No | Runs processing asynchronously. Returns JobId. |
| `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). |
| `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-document-toggle-searchable",
  arguments: {
    url: "URL",
    setSearchable: true,
  },
})
```

**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-document-toggle-searchable",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pdf_co: { authProvisionId: "apn_xxxxxxx" },
    url: "URL",
    setSearchable: true,
  },
})

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-document-toggle-searchable",
    "configured_props": {
      "pdf_co": { "authProvisionId": "apn_xxxxxxx" },
      "url": "URL",
      "setSearchable": true
    }
  }'
```

---

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