Render a PDF with PaperType
render_pdfConvert Markdown, HTML, or a filled template into a PDF saved to disk. Returns the file path and page count, with hosted templates for invoices, certificates, and reports.
Instructions
Render a PDF from Markdown, HTML, or a hosted template (invoice, certificate, report) using the PaperType API, and save it to disk. Returns the absolute file path, page count and remaining quota; the PDF bytes are never returned inline. Provide exactly one source: markdown, html, or template + data. Each call uses one document of the account's monthly quota.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| css | No | Extra CSS appended after the theme (markdown/html). May include @page rules, e.g. '@page { margin: 2cm }'. | |
| toc | No | Add a table of contents built from headings. Markdown input only. Default false. | |
| data | No | JSON object of fields for the chosen template (required when template is set). Shape per template is shown by list_templates. | |
| date | No | Date text shown on the cover page, e.g. '2026-10-18' or 'October 2026'. | |
| html | No | HTML document or fragment to render. A theme wraps it in page styles unless theme is 'none'. Provide exactly one of markdown, html, or template+data. | |
| cover | No | Add a cover page with title, author and date (markdown/html). Default false. | |
| theme | No | Page style for markdown/html input. 'clean' (default, general documents), 'report' (formal, good with cover+toc), 'minimal' (plain), 'letter' (correspondence), 'none' (HTML only: no theme, just your own CSS). Ignored for templates. | |
| title | No | Document title: used for the PDF metadata, the cover page, and the default output filename. | |
| author | No | Author shown on the cover page and in PDF metadata. | |
| footer | No | Footer text printed bottom-left on every page (e.g. a confidentiality note). | |
| header | No | Running header text printed top-right on every page. | |
| filename | No | Suggested file name (e.g. 'invoice-014.pdf'). Used for the saved file's name when output_path is not given. | |
| markdown | No | Markdown source for the document (GitHub-flavoured: headings, lists, tables, fenced code, footnotes, admonitions). Provide exactly one of markdown, html, or template+data. | |
| template | No | Name of a hosted template to fill with `data` instead of writing markdown/html: 'invoice', 'certificate' or 'report'. Call list_templates to see each template's fields and sample data. | |
| page_size | No | Paper size. Default A4. Use 'Letter' for US documents. | |
| output_path | No | Where to save the PDF. Omit to get a unique file named after the title under the server's output directory (PAPERTYPE_OUTPUT_DIR, default <tmp>/papertype). An existing directory (or a path ending in '/') saves a uniquely named file inside it. Any other path is used as the exact file name ('.pdf' appended if missing; an existing file is overwritten). Relative paths resolve against the output directory. | |
| page_numbers | No | Print page numbers in the footer. Default true. |