Markdown & HTML to PDF Converter (+ URL) avatar

Markdown & HTML to PDF Converter (+ URL)

Pricing

from $4.00 / 1,000 pdf generateds

Go to Apify Store
Markdown & HTML to PDF Converter (+ URL)

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

Anthony Crawford

Maintained by Community

Actor 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, domcontentloaded or networkidle waiting.
  • 📄 Paper sizes: A4, US Letter, Legal, A5, A3, Tabloid, portrait or landscape, plus CSS @page sizes.
  • 🔢 Page numbers ("Page X of Y") on by default, or your own header/footer HTML with pageNumber, totalPages, title, date, url placeholders.
  • 🎨 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

  1. Click Try for free (or Start) and sign in to Apify.
  2. 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.
  3. Pick the Paper size, Landscape and Page numbers options.
  4. 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

FieldTypeDefaultNotes
documentsarray of objects–Each object has exactly one of markdown, html, url, plus optional fileName (no .pdf) and title.
markdownstring–Shortcut for a single Markdown doc.
htmlstring–Shortcut for a single HTML doc or fragment.
urlsarray of strings–Shortcut list of web pages.
fileNamestring–File name for the markdown/html shortcut.
formatA4 / Letter / Legal / A5 / A3 / TabloidA4
landscapebooleanfalse
pageNumbersbooleantrue"Page X of Y" footer.
marginTop / marginRight / marginBottom / marginLeftstring15mm (18mm top/bottom with header/footer)mm, cm, in or px.
printBackgroundbooleantrue
headerTemplate / footerTemplateHTML string–Chromium header/footer templates. Set a font-size.
customCssstring–Applied after the default stylesheet.
useDefaultStylesbooleantrueGitHub-like stylesheet for Markdown.
htmlUseDefaultStylesbooleanfalseAlso apply it to HTML input.
scalenumber10.1–2.
preferCSSPageSizebooleanfalseUse the document's @page { size }.
firstPagePngbooleanfalseSave a PNG of page 1.
pngDpiinteger11036–200.
mediaTypeprint / screenprint
waitUntilload / domcontentloaded / networkidleloadURL mode.
waitForMillisinteger0URL mode extra wait, max 15000.
timeoutSecsinteger45Per document.
urlJavaScriptbooleantrueLet web pages run their own JS (never for Markdown/HTML).
allowRemoteResourcesbooleantrueLet Markdown/HTML load public images/fonts/CSS.
maxPdfSizeMbinteger50Larger 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 doPDFsPrice
1 Markdown report1$0.004
25 invoices from HTML25$0.10
1,000 PDFs1,000$4.00
EventPriceWhen
pdf-generated$0.004One document became a downloadable PDF (PNG preview included).
apify-actor-startApify's tiny standard start feeOnce 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 download pdfUrl with 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 pdfUrl in 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 ApifyClient
client = 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

ToolWhat it doesPrice
Website Screenshot to Social ImageScreenshot 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 & ConverterCompress 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.