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

# PDF4me plugin

> PDF4me is a PDF and document processing SaaS. This plugin merges, splits, compresses and organizes PDFs, converts them to Word and renders HTML to PDF, runs OCR, reads PDF metadata, extracts tables and form data, and polls asynchronous processing jobs. File answers come back base64-encoded.

Use **PDF4me** through Corsair: one client, typed API calls.

Authenticate with the API key from the PDF4me dashboard; the plugin sends it as the raw value of the Authorization header, without a Bearer prefix, as the API expects. File payloads go in the docContent field as base64, a pdf4meblobid:// reference or an https URL, with docName always set — the API dispatches on the extension.
PDF-producing actions answer the raw file or a JSON file shape; the plugin returns either as fileContent (base64), and the parts of a split as documents. With isAsync: true, and always for PDF-to-Word and OCR, the API answers a job (jobId, statusUrl) instead: poll jobs.status, which answers the produced file once the job has finished. Every processing call uses one PDF4me API call from the plan, so the file-producing operations are marked destructive.
Checked live (2026-11-21): the docs' GetPdfInformation route answers 404, so pdf.getInfo uses GetPdfMetadata; table and form extraction answer tableList and formData, not the tables and formFields the docs show.
This plugin covers a working subset: merge, split, compress, page organization, metadata, PDF-to-Word, HTML-to-PDF, OCR, and table and form extraction. The barcode, Excel, image, Word-suite, generate and signature families are documented by PDF4me but not part of this plugin.
Every operation is described in the official docs: [https://docs.pdf4me.com/pdf4me-api/](https://docs.pdf4me.com/pdf4me-api/)

**What you get:**

* 12 typed API operations

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/pdf4me better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/pdf4me better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/pdf4me better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/pdf4me better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { pdf4me } from '@corsair-dev/pdf4me';

export const corsair = createCorsair({
	plugins: [
		pdf4me(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> Store the PDF4me API key before the first call: `pnpm corsair setup --plugin=pdf4me --tenant=acme api_key=<your-key>` (leave out `--tenant` without `multiTenancy`), or pass it as `key` in the plugin options. With Hub, each tenant enters their own key on the connect page. See [API key auth](https://docs.corsair.dev/concepts/api-key).
>
> ```ts theme={null}
> pdf4me()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'pdf4me',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**Read PDF metadata**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.pdf4me.api.pdf.getInfo({ docContent: 'JVBERi0=', docName: 'document.pdf' });
```

**Compress a PDF**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.pdf4me.api.pdf.compress({ docContent: 'JVBERi0=', docName: 'document.pdf', optimizeProfile: 'Web' });
```

See the full list on the [API](https://docs.corsair.dev/plugins/pdf4me/api.md) page.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/pdf4me/api.md)
>
> Every `pdf4me.api.*` operation with input and output types.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.