# Markdown to PDF

Turn Markdown into a tidy PDF with headings, tables and coloured code, in a choice of page sizes and styles.

Converts Markdown to a PDF with real, selectable text. Standard Markdown (CommonMark) with tables, ~~strikethrough~~, task lists and fenced code blocks. Nothing outside the Markdown is ever loaded.

- Endpoint: `POST https://setget.net/v1/tools/markdown-to-pdf` with JSON `{"input": {...}}` (add `"wait": 30` to hold the reply until the job finishes)
- MCP: `run_tool` with `slug` = `markdown-to-pdf`
- Page: https://setget.net/tools/markdown-to-pdf

## Files in, files out

This is a file tool. Its file inputs take file references, not file contents and not web addresses.

- Get a reference by uploading: `curl -T FILE https://setget.net/drop/` prints a line `ref  <id>/f1`. Or `POST https://setget.net/v1/drops` with `{"files":[{"name","size"}]}`, PUT the bytes to the returned `upload.url` with the listed headers, and use the file's `ref`. Over MCP use the `drop` tool. A file under about 700 KB can also be sent in place as a `data:<type>;base64,<content>` URI.
- Uploads are at most 100 MB per file, are readable by anyone with the link, and expire (one hour by default). Programs are refused.
- The tool runs as a job. The reply is `{"tool", "ms", "result", "files", "job"}`: `result` is JSON, and every result file comes back in `files` as `{"name", "size", "content_type", "kind", "url", "ref"}`. Download it from `url`, or pass `ref` as the input of another file tool.
- A job still running when the wait ends answers 202 with `job`. Follow it with `GET https://setget.net/v1/jobs/<id>?wait=30`, or stream progress from `GET https://setget.net/v1/jobs/<id>/events` (over MCP: the `job` tool). A person can watch it at `job.url`.

## Inputs

- `markdown` (required, string): The Markdown to convert.
- `page_size` (optional, string, one of `A4`, `Letter`, `A5`, `Legal`, default `"A4"`): Paper size.
- `margin` (optional, integer, default `20`, range 5..50): Empty space around the text on every page, in millimetres.
- `font_size` (optional, integer, default `11`, range 6..24): Size of the body text in points.
- `theme` (optional, string, one of `clean`, `serif`, `compact`, default `"clean"`): Look of the document: clean is sans-serif, serif is a book-like face with justified text, compact fits more on a page.
- `title` (optional, string, default `""`): Title stored in the PDF, shown by viewers in the window title. Defaults to the first heading.
- `page_numbers` (optional, boolean, default `false`): Print "page / pages" at the bottom of every page.
- `allow_html` (optional, boolean, default `false`): Keep harmless HTML tags written in the Markdown, such as <br>, <sub> and <div style="page-break-after: always">. Scripts, style sheets and frames are always removed. When off, HTML is shown as text.

## Example 1: A short report on A4

```json
{"input":{"markdown":"# Report\n\nSales rose **12%** this quarter.\n\n| Region | Sales |\n|--------|------:|\n| North | 420 |\n| South | 380 |"},"wait":30}
```

## Example 2: US Letter, serif, with page numbers

```json
{"input":{"markdown":"# Notes\n\n- [x] Draft\n- [ ] Review\n\n```python\nprint(\"hello\")\n```","page_size":"Letter","theme":"serif","font_size":12,"page_numbers":true},"wait":30}
```

**Which Markdown is supported?** Standard Markdown (CommonMark) with tables, ~~strikethrough~~, task lists and fenced code blocks. Code blocks marked with a language are coloured.

**Why is my picture missing?** Pictures are never downloaded, and files cannot be attached to this tool. A picture appears only when it is written into the Markdown itself as a data: address (PNG, JPEG, GIF or WebP). Otherwise its description is printed in its place and the result lists how many were left out.

**How do I start a new page?** Turn on "allow_html" and put <div style="page-break-after: always"></div> where the page should end.

**Which characters can be printed?** Latin with accents, Greek, Cyrillic and many symbols. Chinese, Japanese, Korean and emoji are not in the fonts on this server and come out as empty boxes.

**How long can the document be?** Up to 100,000 characters of Markdown, roughly 60 to 100 pages.
