Text

Markdown to PDF

0calls
2 credits / call

When your business system needs to provide "Export as PDF" functionality, there's no need to deploy complex layout engines on the backend. Just send the Markdown text to this endpoint, and you can directly obtain print-quality PDF files.

Overview

  • Server-side direct generation: The endpoint directly returns PDF file binary stream, frontend can trigger download without any processing, and backend can easily save for archiving.
  • Multiple beautiful themes and paper sizes: Built-in professional layout themes like GitHub, dark mode, etc., and supports standard papers like A4, Letter. With simple configuration, you can generate professional documents that match business scenarios.
  • Public network images can be directly included in PDF: In addition to plain text and standard Markdown syntax, this endpoint can also handle data URI images, or publicly accessible http, https image links. The server will first fetch images through proxy and inline them into the document before rendering, with timeout control.

Request body

Request body uses application/json. text is required, theme and paper_size are optional.

text
stringrequired

Raw Markdown string, maximum size not exceeding 1MB.

theme
stringoptional

PDF layout theme. Options: github, minimal, light, dark, default is github.

paper_size
stringoptional

PDF paper size. Options: A4 or Letter, default is A4.

Response

200 / OK

Conversion successful. Response body is PDF binary file stream.

application/pdf

400 / Bad Request

Request parameters are invalid, or Markdown content contains currently disallowed content.

Format 1Request body format error
JSON
Format 2Missing Markdown text
JSON
Format 3Theme parameter error
JSON
Format 4Paper size parameter error
JSON
Format 5Contains raw HTML
JSON
Format 6Image address not supported
JSON
Format 7Contains unsafe link protocol
JSON

413 /

Markdown text, or image resources referenced in Markdown exceed current size limit.

Format 1Markdown text too large
JSON
Format 2Image resource too large
JSON

500 / Internal Server Error

PDF generation failed, please try again later.

JSON

502 / Bad Gateway

Image referenced in Markdown failed to download, or remote returned unrecognizable image content.

JSON

503 / Service Unavailable

PDF rendering service is temporarily unavailable.

Format 1Service not ready
JSON
Format 2Renderer temporarily unavailable
JSON

504 / Gateway Timeout

Image referenced in Markdown download timed out.

JSON