# fs.pdf.convert

Breaks a PDF into page-level files

# fs.pdf.convert

```
fs.pdf.convert --from PDF [--include text|image|raster…] [--dpi N] [--store TEXT] [--folder TEXT] [--on-conflict error|skip|overwrite] → pdf
```

Breaks a PDF into page-level files. The PDF is the one `--from` names — a FileRef, an upload or a store key — into page-level files under `--folder` (default `pdf/<file stem>`). `--include text|image|raster` (repeat; default all three) picks what each page yields: `text.md`, its embedded images, a PNG at `--dpi` (default 144). Every page also gets `page.json` and the folder a `manifest.json`. A folder that is not empty is an error unless `--on-conflict` says otherwise. Adds `pdf: { folder, items, count, page_count, manifest_path, pages }` — `items` a durable FileRef per file written — and keeps the rest of the payload.

## Flags

- `--from` (required): The PDF: a FileRef, an upload or a store key.
- `--include`: What each page yields (repeat; default: text, image and raster).
- `--dpi`: Page raster resolution, 36–600 (default: 144).
- `--store`: The project store to write to: `local`, or the id of an `s3` credential. Saved explicitly when the pipeline is registered (default: the project's default store at that moment)
- `--folder`: The folder the export goes into (default: pdf/<file stem>).
- `--on-conflict`: When the target already exists: overwrite, skip or error (default: error)

## Examples

### Text and page images from an uploaded PDF

```
| fs.pdf.convert --from "{{ input.file }}" --include text --include raster --folder pdf/brief --dpi 110
```

Each page's text is `pdf/brief/<page>/text.md`; read one back with `fs.file.get --from pdf/brief/1/text.md`.

Input:

```json
{
  "file": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "uploads/brief.pdf",
    "filename": "brief.pdf",
    "mime": "application/pdf",
    "kind": "pdf",
    "size": 182331,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.file.put",
    "trust": "untrusted"
  }
}
```

It answers:

```json
{
  "file": {
    "__zf_type": "file_ref",
    "backend": "zebfs",
    "store": "local",
    "ref": "uploads/brief.pdf",
    "filename": "brief.pdf",
    "mime": "application/pdf",
    "kind": "pdf",
    "size": 182331,
    "sha256": "sha256:…",
    "lifecycle": "durable",
    "origin": "fs.file.put",
    "trust": "untrusted"
  },
  "pdf": {
    "folder": "pdf/brief",
    "count": 9,
    "page_count": 4,
    "manifest_path": "pdf/brief/manifest.json",
    "items": [
      "…a FileRef per file"
    ],
    "pages": [
      "…"
    ]
  }
}
```
