pdf_convert
Convert PDFs to Markdown, HTML, or images, and create PDFs from Markdown, HTML, or images. Transform documents between PDF and other formats with a single operation.
Instructions
Convert between PDF and other formats.
PDF to/from Markdown, HTML, and images.
Return Format
A dict with keys:
success: bool - whether the operation succeeded
message: str - human-readable summary
operation-specific keys:
to_markdown: {markdown, pages}
to_images: {images: [{page, path, width, height}]}
to_html: {html}
from_html/from_markdown/from_images: {path, pages} On failure: {success: False, error, error_type}.
Examples
await pdf_convert(operation="to_markdown", path="report.pdf") {"success": true, "markdown": "# Report...", "pages": 3, "message": "Converted report.pdf to markdown (3 pages)."}
await pdf_convert(operation="from_markdown", markdown="# Hello") {"success": true, "path": ".../output_from_markdown_....pdf", "pages": 1, "message": "Created PDF from markdown (1 pages), saved to output_from_markdown_....pdf."}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dpi | No | DPI for image output. Default 200. | |
| fmt | No | Image format (png, jpeg). Default png. | png |
| html | No | HTML content for from_html operation. | |
| path | No | Path to the PDF file. Required for to_* operations. | |
| paths | No | Image paths for from_images operation. | |
| markdown | No | Markdown content for from_markdown operation. | |
| operation | Yes | ||
| output_dir | No | Output directory for to_images operation. | |
| output_path | No | Output path. Auto-generated if omitted. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| message | No | Human-readable summary | |
| success | No | Whether the operation succeeded |