Markdown & HTML to PDF Converter (+ URL)
Pricing
from $4.00 / 1,000 pdf generateds
Markdown & HTML to PDF Converter (+ URL)
Convert Markdown to PDF, HTML to PDF or any web page URL to PDF via API. GitHub-style tables, code and task lists; A4, Letter, Legal, landscape, margins, page numbers, headers, custom CSS, PNG preview. Batch up to 200 docs. $0.004 per PDF, failures free. For AI agents, MCP, n8n, Make.
Pricing
from $4.00 / 1,000 pdf generateds
Rating
0.0
(0)
Developer
Anthony Crawford
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
an hour ago
Last modified
Categories
Share
Convert Markdown to PDF, HTML to PDF, or any web page URL to PDF with one API call. Markdown & HTML to PDF Converter renders your document in a real Chrome browser and returns a clean, print-ready PDF with a direct download link. Markdown is styled like GitHub (tables, task lists, syntax-highlighted code), and you control paper size (A4, Letter, Legal…), landscape, margins, page numbers, headers/footers and custom CSS. Built for AI agents, LLM apps and n8n/Make/Zapier automations that write reports, invoices or summaries and need a real PDF file. $0.004 per PDF, failed documents are free.
What can this Markdown & HTML to PDF converter do?
- 📝 Markdown to PDF with GitHub Flavored Markdown: tables, task lists
- [x], fenced code blocks with syntax highlighting, strikethrough, autolinks, block quotes, images. - 🧾 HTML to PDF for full documents or fragments: invoices, receipts, reports, certificates, tickets, contracts. Your HTML is printed exactly as written, or with the clean stylesheet if you want it.
- 🌐 URL to PDF: print any public web page (archive an article, save a receipt page, snapshot docs) with
load,domcontentloadedornetworkidlewaiting. - 📄 Paper sizes: A4, US Letter, Legal, A5, A3, Tabloid, portrait or landscape, plus CSS
@pagesizes. - 🔢 Page numbers ("Page X of Y") on by default, or your own header/footer HTML with
pageNumber,totalPages,title,date,urlplaceholders. - 🎨 Custom CSS, margins, background printing, scale, Google Fonts.
- 🖼️ PNG preview of page 1 for thumbnails, chat apps and vision-capable AI agents (same price).
- 📦 Batch: up to 200 documents per run, one PDF and one dataset row each.
- 🛡️ Safe by default: JavaScript never runs for Markdown/HTML input; URL mode only fetches public http(s) addresses (private, loopback, link-local and cloud-metadata IPs are blocked, DNS is resolved and every redirect is checked).
Who is it for?
- AI agents and LLM apps (via the Apify MCP server or API) that produce Markdown and need to hand back a PDF link.
- No-code automations in n8n, Make and Zapier that generate PDFs from templates, form data or Google Sheets rows.
- Developers who need an HTML to PDF API without running headless Chrome, Puppeteer or Gotenberg themselves.
How to convert Markdown to PDF
- Click Try for free (or Start) and sign in to Apify.
- Paste your Markdown into Markdown (single document shortcut), or HTML into the HTML field, or a link into Web page URLs. For many files at once, use Documents.
- Pick the Paper size, Landscape and Page numbers options.
- Click Start. The Output tab shows each document with its
pdfUrl; click to download.
Input example
The simplest possible call:
{ "markdown": "# Hello\n\nThis becomes a PDF.", "format": "Letter" }
A batch with Markdown, HTML and a URL:
{"documents": [{ "fileName": "weekly-report", "markdown": "# Weekly Report\n\n| Item | Qty |\n| --- | ---: |\n| Widgets | 3 |\n\n- [x] Shipped\n- [ ] Invoice sent" },{ "fileName": "invoice-1042", "html": "<h1>Invoice #1042</h1><table><tr><th>Item</th><th>Total</th></tr><tr><td>Design</td><td>$300</td></tr></table>" },{ "url": "https://example.com" }],"format": "Letter","landscape": false,"pageNumbers": true,"customCss": "h1 { color: #0b5394; }","firstPagePng": true}
This creates 3 PDFs = $0.012.
Main input fields
| Field | Type | Default | Notes |
|---|---|---|---|
documents | array of objects | – | Each object has exactly one of markdown, html, url, plus optional fileName (no .pdf) and title. |
markdown | string | – | Shortcut for a single Markdown doc. |
html | string | – | Shortcut for a single HTML doc or fragment. |
urls | array of strings | – | Shortcut list of web pages. |
fileName | string | – | File name for the markdown/html shortcut. |
format | A4 / Letter / Legal / A5 / A3 / Tabloid | A4 | |
landscape | boolean | false | |
pageNumbers | boolean | true | "Page X of Y" footer. |
marginTop / marginRight / marginBottom / marginLeft | string | 15mm (18mm top/bottom with header/footer) | mm, cm, in or px. |
printBackground | boolean | true | |
headerTemplate / footerTemplate | HTML string | – | Chromium header/footer templates. Set a font-size. |
customCss | string | – | Applied after the default stylesheet. |
useDefaultStyles | boolean | true | GitHub-like stylesheet for Markdown. |
htmlUseDefaultStyles | boolean | false | Also apply it to HTML input. |
scale | number | 1 | 0.1–2. |
preferCSSPageSize | boolean | false | Use the document's @page { size }. |
firstPagePng | boolean | false | Save a PNG of page 1. |
pngDpi | integer | 110 | 36–200. |
mediaType | print / screen | print | |
waitUntil | load / domcontentloaded / networkidle | load | URL mode. |
waitForMillis | integer | 0 | URL mode extra wait, max 15000. |
timeoutSecs | integer | 45 | Per document. |
urlJavaScript | boolean | true | Let web pages run their own JS (never for Markdown/HTML). |
allowRemoteResources | boolean | true | Let Markdown/HTML load public images/fonts/CSS. |
maxPdfSizeMb | integer | 50 | Larger PDFs fail with OUTPUT_TOO_LARGE (free). |
Output example
Each PDF (and optional PNG) is saved to the run's default key-value store, with one dataset row per document:
{"index": 0,"sourceType": "markdown","source": "362 chars","fileName": "weekly-report.pdf","title": "Weekly Report","status": "ok","pages": 1,"bytes": 61683,"format": "Letter","landscape": false,"pdfKey": "001-weekly-report.pdf","pdfUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/001-weekly-report.pdf","pngUrl": "https://api.apify.com/v2/key-value-stores/<storeId>/records/001-weekly-report-page1.png","errorCode": null,"error": null,"charged": true}
Failed rows have status: "error", a machine-readable errorCode (INVALID_INPUT, INVALID_URL, BLOCKED_URL, DNS_FAILED, HTTP_ERROR, FETCH_FAILED, NAVIGATION_FAILED, TIMEOUT, TOO_LARGE, OUTPUT_TOO_LARGE, RENDER_FAILED), a readable error, and charged: false.
How much does it cost to convert HTML or Markdown to PDF?
| What you do | PDFs | Price |
|---|---|---|
| 1 Markdown report | 1 | $0.004 |
| 25 invoices from HTML | 25 | $0.10 |
| 1,000 PDFs | 1,000 | $4.00 |
| Event | Price | When |
|---|---|---|
pdf-generated | $0.004 | One document became a downloadable PDF (PNG preview included). |
apify-actor-start | Apify's tiny standard start fee | Once per run. |
Failed documents, blocked URLs and invalid input are free, and the run stops cleanly before going over your maximum charge per run. Apify's free plan includes monthly platform credit, enough to try it many times.
Use with AI agents (Apify MCP server)
Let Claude, ChatGPT, Cursor, VS Code or any MCP client make PDFs. Load just this tool from the hosted Apify MCP server:
https://mcp.apify.com?tools=bigaceboy/markdown-html-to-pdf
{"mcpServers": {"markdown-to-pdf": { "url": "https://mcp.apify.com?tools=bigaceboy/markdown-html-to-pdf" }}}
Then ask: "Turn this Markdown report into a Letter-size PDF with page numbers and give me the link." The agent calls the Actor with {"markdown": "...", "format": "Letter"} and reads pdfUrl from the result. Pay-per-event pricing also works with Apify's agentic payments.
Use with n8n, Make and Zapier
- n8n: add the Apify node → Actors → Run an Actor and Get Dataset → Actor
bigaceboy/markdown-html-to-pdf. In Custom input use an expression such as{ "markdown": {{ JSON.stringify($json.report) }}, "format": "A4" }. Then downloadpdfUrlwith an HTTP Request node (response format File) and attach it to Gmail, upload to Google Drive, post to Slack… - Make: Apify → Run an Actor (wait for finish) → Get Dataset Items → HTTP: Get a file from
pdfUrl. - Zapier: Apify → Run Actor (synchronous), then use
pdfUrlin the next step.
Use with the API (curl, JavaScript, Python)
curl -X POST "https://api.apify.com/v2/acts/bigaceboy~markdown-html-to-pdf/run-sync-get-dataset-items" \-H "Authorization: Bearer $APIFY_TOKEN" \-H 'Content-Type: application/json' \-d '{"markdown":"# Hello\n\nFrom curl","format":"A4"}'
The response is the dataset rows; download the file from pdfUrl.
import { ApifyClient } from 'apify-client';const client = new ApifyClient({ token: process.env.APIFY_TOKEN });const run = await client.actor('bigaceboy/markdown-html-to-pdf').call({ markdown: '# Report\n\nHello', format: 'Letter' });const { items } = await client.dataset(run.defaultDatasetId).listItems();console.log(items[0].pdfUrl);
from apify_client import ApifyClientclient = ApifyClient("YOUR_APIFY_TOKEN")run = client.actor("bigaceboy/markdown-html-to-pdf").call(run_input={"markdown": "# Report\n\nHello", "format": "Letter"})print(next(client.dataset(run["defaultDatasetId"]).iterate_items())["pdfUrl"])
FAQ
How do I convert Markdown to PDF without installing anything?
Paste the Markdown into the input and click Start, or send it to the API. You get a GitHub-styled PDF back. No Pandoc, LaTeX or wkhtmltopdf needed.
Is there an HTML to PDF API for n8n?
Yes. Use the Apify node's Run an Actor and Get Dataset operation with this Actor, then fetch pdfUrl. See the n8n section above.
Does it support US Letter, landscape and page numbers?
Yes: format: "Letter", landscape: true, pageNumbers: true (on by default). Custom header and footer HTML is supported too.
How do I add a page break?
Insert <div style="break-after: page"></div> in Markdown or HTML.
Can I use custom fonts and colors?
Yes. Put CSS in customCss, e.g. @import url('https://fonts.googleapis.com/css2?family=Inter&display=swap'); body { font-family: Inter; }.
My wide table is cut off
Set landscape: true or scale: 0.8.
Does JavaScript run in my HTML?
No, never for Markdown/HTML input (safer and predictable). For web page URLs, page scripts run by default (urlJavaScript).
Can it print pages behind a login?
No. URL mode only prints public pages. For private content, send the HTML itself.
Other tools by this developer
| Tool | What it does | Price |
|---|---|---|
| Website Screenshot to Social Image | Screenshot any URL into Instagram, Pinterest or OG 1200×630 images | $0.004 / image |
| Social Image Resizer (No Crop) | Fit photos into Instagram/Pinterest/Story sizes without cropping | $0.005 / image |
| Image Optimizer & Converter | Compress images to WebP/AVIF/JPG, target KB size, strip GPS | $0.002 / image |
Limits
Max 200 documents per run, 5 million characters per Markdown/HTML document, 25 MB per fetched resource, PDF size up to 100 MB (default limit 50 MB), 180 s timeout per document. Header/footer templates can't load external images; use inline data: images. Questions or feature requests: use the Issues tab.