---
title: "Documents"
description: "Convert PDF, Word, Excel and CSV files to Markdown and chunks."
---

```sh
webfold convert <document-file>
webfold pdf <file.pdf> [--chunk n]
webfold chunk <html|md|txt|pdf|url> [--size n] [--jsonl]
```

Structured document conversion (PDF, DOCX, XLSX, CSV) delegates to the Superdocuments converter. Legacy `.xls` uses a local Calamine adapter. The `pdf` command uses the in-process Superdocuments parser with an OCR fallback.

## Know the limits

- The CLI expands bounded direct `/ObjStm` members before parsing a PDF. That is not general cross-reference-stream resolution.
- Some fixtures extract their text but still misdecode certain non-ASCII glyphs.
- The PDF adapter is used by the CLI PDF routes. It is not a PDF guarantee of the public `document::convert_path` library API.
- Run untrusted documents with restricted filesystem access. An opt-in Landlock sandbox exists for processing hostile files on Linux 5.13 and newer.

Per-format routes and limits are documented in the repository's `docs/STRUCTURED-CONVERSION.md`.

## Hosted API

`POST /v1/documents/convert` converts a base64 file to Markdown with the same engine, up to 25 MiB per request. Send `filename` (the extension picks the format) or set `format`. See the [API reference](/docs/api-reference) and the [OCR guide](/docs/guides/ocr) for scanned PDFs.
