Document to PDF API#

The Documents to PDF endpoints convert office and document files (Microsoft Word, Excel, and PowerPoint, Apple iWork Pages and Numbers, OpenDocument formats, plus HTML and Markdown) into high-quality PDFs through a single REST API. Every endpoint accepts a multipart/form-data upload and converts synchronously, returning raw PDF bytes by default or JSON metadata with a presigned download URL. Office and iWork formats are rendered server-side by LibreOffice with the document's own formatting, fonts, and layout preserved, while HTML and Markdown are rendered with WeasyPrint and support custom page sizes, margins, headers, and footers via pdf_options.

Supported conversions#

Conversion Endpoint Description
Anything to PDF POST /v1/convert/anything-to-pdf Catch-all: accepts 36 file extensions (Office, iWork, OpenDocument, RTF, CSV, HTML, Markdown, text, EPUB, images, SVG, PDF) and always returns a PDF.
Anything to Markdown POST /v1/convert/anything-to-markdown Catch-all: accepts 22 file extensions and always returns one UTF-8 Markdown file. No OCR, so image input returns 400.
HTML to PDF POST /v1/convert/html-to-pdf Renders .html or .htm files to PDF with WeasyPrint, with page size, margins, orientation, headers, and footers controlled via pdf_options.
Markdown to PDF POST /v1/convert/markdown-to-pdf Converts .md or .markdown files to styled PDFs with tables, syntax-highlighted code blocks, and an optional [TOC] table of contents.
Word to PDF POST /v1/convert/doc-to-pdf Converts Microsoft Word .doc and .docx documents to PDF with LibreOffice, preserving fonts, formatting, and page layout.
Excel to PDF POST /v1/convert/excel-to-pdf Converts Microsoft Excel .xlsx and .xls spreadsheets to PDF with LibreOffice's high-fidelity rendering.
PowerPoint to PDF POST /v1/convert/ppt-to-pdf Converts Microsoft PowerPoint .ppt and .pptx presentations to PDF while preserving slide formatting and fonts.
Pages to PDF POST /v1/convert/pages-to-pdf Converts Apple iWork Pages .pages documents to PDF with server-side LibreOffice rendering.
Numbers to PDF POST /v1/convert/numbers-to-pdf Converts Apple iWork Numbers .numbers spreadsheets to PDF with formatting and layout preserved.
ODT to PDF POST /v1/convert/odt-to-pdf Converts OpenDocument Text .odt files (the native LibreOffice/OpenOffice Writer format) to PDF.
ODS to PDF POST /v1/convert/ods-to-pdf Converts OpenDocument Spreadsheet .ods files from LibreOffice or OpenOffice Calc to PDF.
ODP to PDF POST /v1/convert/odp-to-pdf Converts OpenDocument Presentation .odp files from LibreOffice or OpenOffice Impress to PDF.
OTS to PDF POST /v1/convert/ots-to-pdf Converts OpenDocument Spreadsheet Template .ots files to PDF with LibreOffice rendering.

Shared conventions#

  • Authentication: Every endpoint requires either a private API key via the X-API-Key header or a JWT from a public key via Authorization: Bearer. See Authentication.
  • Request format: All endpoints accept multipart/form-data with the document in the file field, plus optional output_filename, direct_download, and pdf_options fields. See Sync and Async Jobs.
  • Synchronous responses: Conversions run synchronously and return raw PDF bytes (application/pdf) by default; set direct_download=false to receive JSON metadata with a presigned_url, object_key, filename, file_size, and conversion_time_seconds instead.
  • PDF options: HTML and Markdown (WeasyPrint-rendered) support full pdf_options including page size, margins, orientation, headers, and footers; the LibreOffice-backed office formats take page layout from the source document and support only grayscale. See Sync and Async Jobs.
  • Errors and limits: Endpoints share the same error semantics: 400 for wrong file type or failed conversion, 401 for missing/invalid credentials, 402 when the monthly ops allowance or storage limit is reached, and 413 when the file exceeds the plan's size limit. See Error codes.

Frequently asked questions#

Which document formats can I convert to PDF with the API?#

Eleven input formats are supported: HTML (.html, .htm), Markdown (.md, .markdown), Word (.doc, .docx), Excel (.xlsx, .xls), PowerPoint (.ppt, .pptx), Apple Pages (.pages), Apple Numbers (.numbers), and the OpenDocument formats .odt, .ods, .odp, and .ots. Each has its own dedicated POST /v1/convert/* endpoint.

Can I control page size, margins, headers, and footers in the PDF output?#

Only on the WeasyPrint-rendered endpoints (HTML to PDF and Markdown to PDF), where pdf_options accepts page_size, custom width/height in millimeters, orientation, margins, and header/footer with template variables like {{page}} and {{total_pages}}. The LibreOffice-backed office endpoints preserve the source document's own page layout and support only the grayscale option.

How do I get a download URL instead of raw PDF bytes?#

Set direct_download=false on any endpoint. Instead of the PDF body, the response is JSON metadata containing a presigned_url for downloading the file, along with the object_key, filename, file_size, and conversion_time_seconds.