Markdown to PDF API
Convert Markdown to a clean A4 / A5 / Letter PDF: headings, bold / italic, links, nested lists, quotes, code blocks, tables, page numbers, full Vietnamese support.
The Markdown to PDF API turns GitHub-flavoured Markdown into a print-ready PDF without a browser. It renders headings with rules, paragraphs with bold, *italic*, inline code and clickable links, ordered, unordered and task lists (nested), blockquotes, fenced code blocks on a tinted background, tables with column alignment and widths based on their content, and horizontal rules. Long content flows over several pages with page numbers and an optional title in the footer.
Text uses Be Vietnam Pro, embedded as a subset, so Vietnamese renders perfectly and files stay small. Choose the page size (a4, a5, letter), the base font_size and the margin; format=json returns the PDF as base64 with the page count.
Images in the Markdown are replaced by their alt text, and raw HTML is reduced to its text. For styled documents such as quotes and receipts, see the invoice PDF API.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
markdown | body | string | yes | Markdown text (max 500,000 characters). | |
title | body | string | no | Document title (metadata, footer). | |
page | body | string | no | a4 | a4, a5 or letter. |
font_size | body | number | no | 10.5 | Base font size (8–16 pt). |
margin | body | number | no | 54 | Page margin in pt (20–100). |
format | body | string | no | pdf | pdf or json (base64). |
Example
curl -X POST "https://apibox.io.vn/v1/md-pdf" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"markdown":"# Hướng dẫn\n\n**Bước 1:** tạo API key.\n\n| Ngân hàng | Mã |\n|---|---|\n| Vietcombank | VCB |","title":"Hướng dẫn"}' \
-o outputconst res = await fetch('https://apibox.io.vn/v1/md-pdf', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"markdown": "# Hướng dẫn\n\n**Bước 1:** tạo API key.\n\n| Ngân hàng | Mã |\n|---|---|\n| Vietcombank | VCB |",
"title": "Hướng dẫn"
}),
});
const blob = await res.blob();import requests
res = requests.post(
"https://apibox.io.vn/v1/md-pdf",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"markdown": "# Hướng dẫn\n\n**Bước 1:** tạo API key.\n\n| Ngân hàng | Mã |\n|---|---|\n| Vietcombank | VCB |", "title": "Hướng dẫn"},
timeout=30,
)
open("output", "wb").write(res.content)<?php
$ch = curl_init('https://apibox.io.vn/v1/md-pdf');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"markdown":"# Hướng dẫn\\n\\n**Bước 1:** tạo API key.\\n\\n| Ngân hàng | Mã |\\n|---|---|\\n| Vietcombank | VCB |","title":"Hướng dẫn"}',
]);
$response = curl_exec($ch);
file_put_contents('output', $response);Response
binary application/pdf
Use cases
- Export documentation, notes and reports as PDF
- Generate contracts and policies from Markdown templates
- PDF downloads of knowledge-base articles
- Printable meeting minutes from chat tools
FAQ
Is a browser used?
No, the PDF is built directly, which is fast and cheap; complex HTML / CSS layouts are therefore not supported.
Are images included?
Not yet: they are replaced by their alt text.
Are links clickable?
Yes, http(s) and mailto links become link annotations in the PDF.
Related APIs
Image Metadata & EXIF
Read image dimensions, format, EXIF camera data, capture settings and GPS location from JPEG, PNG, WebP, HEIC, AVIF, GIF and more – upload or URL.
PDFPDF Metadata
Read PDF metadata: page count, title, author, creator, producer, dates, PDF version, encryption, form fields and the size of each page (A4, Letter…).
PDF₫Quote & Receipt PDF
Generate clean PDF quotations, receipts, orders and simple invoices from JSON, with Vietnamese text, VAT, totals in words and a VietQR code for payment.