Markdown to PDF Converter avatar

Markdown to PDF Converter

Pricing

Pay per event

Go to Apify Store
Markdown to PDF Converter

Markdown to PDF Converter

Convert Markdown documents to beautifully formatted PDFs using three themes: GitHub, clean docs, and minimal. Supports tables, code blocks, images, and syntax highlighting. API-first with ready-made examples for Node.js, Python, and cURL. Ideal for automated report and documentation generation.

Pricing

Pay per event

Rating

0.0

(0)

Developer

Stas Persiianenko

Stas Persiianenko

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

6 days ago

Last modified

Share

Turn any Markdown text into a polished, print-ready PDF — in seconds, without installing anything. Paste your Markdown, pick a theme, and get a download link.

Whether you're generating reports, documentation, invoices, release notes, or beautifully formatted changelogs, Markdown to PDF Converter handles it automatically with headless Chromium rendering for pixel-perfect output.


What does it do?

This actor takes raw Markdown text as input, converts it to HTML using marked, applies a styled theme, and renders it to a PDF via headless Chromium (Playwright). The resulting file is stored in the Apify key-value store and a download URL is returned in the dataset.

Supported Markdown features:

  • Headings (H1–H6)
  • Bold, italic, strikethrough text
  • Ordered and unordered lists (nested supported)
  • Code blocks (inline and fenced)
  • Tables (GitHub-flavored)
  • Blockquotes
  • Horizontal rules
  • Links and images
  • Inline HTML

Who is it for?

  • Developers generating documentation or API references from Markdown
  • Technical writers converting README files or specs to shareable PDFs
  • Bloggers exporting posts as downloadable documents
  • Business users automating report generation from templates
  • DevOps teams generating changelogs or release notes as PDFs
  • No-code users who need quick Markdown-to-PDF without installing tools

Why use it?

Most Markdown-to-PDF tools require local installs (pandoc, wkhtmltopdf, LaTeX) or are limited free-tier SaaS tools. This actor runs on demand via the Apify platform:

  • No install required — fully cloud-hosted
  • API-first — integrate into any workflow, CI/CD pipeline, or no-code tool
  • Multiple themes — GitHub style, clean docs, or minimal
  • PPE billing — pay only for what you generate (no monthly subscriptions)
  • Playwright-powered — uses real Chromium, so tables, code blocks, and styling render exactly as in a browser

Themes

Three built-in themes are available:

GitHub (default)

Mirrors the GitHub Markdown rendering style. Uses the system UI font stack, light gray code block backgrounds, blue links, and horizontal rules under H1/H2. Ideal for README files, technical documentation, and anything that looks good on GitHub.

Clean Docs

A documentation-oriented theme with serif headings (Helvetica Neue for headers, Georgia for body text). Blue accent blockquotes, subtle borders, and generous spacing. Ideal for user manuals, product docs, and professional reports.

Minimal

No-frills, maximum readability. Plain sans-serif font, minimal decorations, tight spacing. Great for internal documents, notes, or anything where content matters more than style.


Output data fields

FieldTypeDescription
pdfUrlstringDirect download URL for the generated PDF (from Apify key-value store)
pageCountnumberEstimated number of pages in the generated PDF
fileSizeBytesnumberSize of the PDF file in bytes
themestringTheme used for rendering (github, clean, or minimal)
pageSizestringPaper size (A4, Letter, or Legal)
convertedAtstringISO 8601 timestamp of when the PDF was generated

Pricing

This actor uses Pay Per Event (PPE) billing — you only pay for actual usage:

EventPrice
Actor start (one-time per run)$0.020
PDF generated$0.005

Typical cost per run: ~$0.025 (start + one PDF).

You can convert hundreds of documents per dollar.


How to use

Via the Apify Console

  1. Go to Markdown to PDF Converter on Apify Store
  2. Click Try for free
  3. Paste your Markdown into the Markdown content field
  4. Choose a Theme, Page size, and whether to include margins
  5. Click Start and wait a few seconds
  6. Download your PDF from the Output tab → click the pdfUrl link

Via the API

See the API usage section below for Node.js, Python, and cURL examples.


Input parameters

ParameterTypeRequiredDefaultDescription
markdownstringYesMarkdown text to convert
themestringNogithubVisual theme: github, clean, or minimal
pageSizestringNoA4Paper size: A4, Letter, or Legal
marginsbooleanNotrueAdd standard page margins (1 cm top/bottom, 1.5 cm sides)

Markdown field

The markdown field accepts any valid Markdown string including GitHub-flavored Markdown (GFM). There is no hard character limit, but very long documents may produce multi-page PDFs which may take slightly longer to render.

Theme field

  • github — GitHub-flavored style with system fonts, gray code blocks, bordered tables
  • clean — Professional docs style with serif body text and blue accents
  • minimal — Stripped-down style for maximum readability

PageSize field

  • A4 — 210 × 297 mm (most common internationally)
  • Letter — 8.5 × 11 inches (North American standard)
  • Legal — 8.5 × 14 inches (for legal and formal documents)

Margins field

When true (default), the PDF includes 1 cm top/bottom margins and 1.5 cm left/right margins. Set to false for full-bleed or banner-style layouts.


Output

The actor produces two outputs:

Dataset item

A single dataset item containing all metadata fields listed in the Output data fields table above.

Key-value store

The PDF binary is stored as output.pdf in the default key-value store. The pdfUrl in the dataset item is a direct link to this file.


Tips

  • Long documents: For very long Markdown files (10,000+ characters), the actor handles them gracefully but rendering may take a few extra seconds.
  • Images in Markdown: External images (![alt](https://...)) are rendered if they are publicly accessible. Local file paths will not work in the cloud environment.
  • Code syntax highlighting: The actor does not currently apply syntax-colored code highlighting. Code blocks are rendered in a monospace font with a light background. Full syntax highlighting may be added in a future version.
  • Custom fonts: All three themes use web-safe system fonts to avoid font loading issues in the headless browser.
  • Multi-page documents: Long Markdown documents automatically flow across multiple pages. The pageCount field in the output tells you how many pages were generated.
  • Repeated runs: Each run generates a fresh output.pdf in the key-value store. If you need to keep multiple PDFs, download them before starting a new run.

Integrations

Zapier / Make / n8n

Use the Apify integration in your automation platform to call this actor via its API. Pass the markdown input field with your dynamic content from the previous step, then use the pdfUrl from the output to send the PDF via email, save to Google Drive, or attach to a Slack message.

GitHub Actions

Add a step in your CI/CD workflow to generate release notes as a PDF on every tag push:

- name: Generate release notes PDF
run: |
curl -X POST "https://api.apify.com/v2/acts/automation-lab~markdown-to-pdf/runs?token=$APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"markdown\": \"$(cat CHANGELOG.md | jq -Rs .)\"}"

Webhooks

Configure a webhook on the actor run to receive the pdfUrl immediately after generation completes, then trigger downstream processing automatically.


API usage

Node.js (apify-client)

import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('automation-lab/markdown-to-pdf').call({
markdown: '# Hello World\n\nThis is my **first PDF**.\n\n- Item 1\n- Item 2',
theme: 'github',
pageSize: 'A4',
margins: true,
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log('PDF URL:', items[0].pdfUrl);

Python (apify-client)

from apify_client import ApifyClient
client = ApifyClient(token="YOUR_APIFY_TOKEN")
run = client.actor("automation-lab/markdown-to-pdf").call(run_input={
"markdown": "# Hello World\n\nThis is my **first PDF**.\n\n- Item 1\n- Item 2",
"theme": "clean",
"pageSize": "Letter",
"margins": True,
})
dataset_items = client.dataset(run["defaultDatasetId"]).list_items()
print("PDF URL:", dataset_items.items[0]["pdfUrl"])

cURL

# Start the run
curl -X POST "https://api.apify.com/v2/acts/automation-lab~markdown-to-pdf/runs?token=YOUR_APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"markdown": "# My Document\n\nHello **world**!",
"theme": "github",
"pageSize": "A4",
"margins": true
}'
# Get results (replace RUN_ID with the id from the response above)
curl "https://api.apify.com/v2/datasets/DEFAULT_DATASET_ID/items?token=YOUR_APIFY_TOKEN"

Use with Claude AI (MCP)

This actor is available as a tool in Claude AI through the Model Context Protocol (MCP). Add it to Claude Desktop, Cursor, Windsurf, or any MCP-compatible client.

Setup for Claude Code

$claude mcp add --transport http apify "https://mcp.apify.com"

Setup for Claude Desktop, Cursor, or VS Code

Add this to your MCP config file:

{
"mcpServers": {
"apify": {
"url": "https://mcp.apify.com"
}
}
}

Example prompts

  • "Convert this Markdown to a PDF using the GitHub theme on A4 paper and give me the download link: [markdown]."
  • "Take my README.md content and generate a clean PDF document I can share with stakeholders."
  • "Convert these release notes to a Letter-size PDF using the minimal theme."

Learn more in the Apify MCP documentation.


Legality

This actor converts text you provide — it does not scrape or access any external websites. There are no legal concerns with converting your own Markdown content to PDF format.

Ensure you have rights to any content you convert (e.g., do not convert copyrighted documents without permission).


FAQ

Q: How long does conversion take? A: Typically 5–15 seconds for standard-length documents. The browser launch takes the majority of the time, not the conversion itself.

Q: Is there a maximum Markdown length? A: No hard limit is enforced. Documents up to hundreds of kilobytes work fine. Extremely long documents (500KB+) may approach the 300-second timeout.

Q: Can I embed images in my Markdown? A: Yes, images referenced by public HTTP/HTTPS URLs will be embedded. Data URIs (base64) also work. Local file paths do not work in the cloud environment.

Q: Can I use HTML in my Markdown? A: Yes, inline HTML is supported by marked. You can use <div>, <span>, <table>, custom styles, etc.

Q: Why is my page count 1 even for long documents? A: The page count is estimated from the PDF structure. It may occasionally under-count for complex layouts. The file size and visual output are always accurate.

Q: Can I add headers and footers? A: Not yet supported in the current version. This is planned for a future update.

Q: What if I need custom CSS? A: The current version uses built-in themes. Custom CSS injection is planned for a future version.

Q: Does it support Mermaid diagrams or LaTeX math? A: Not in the current version. These require additional rendering libraries and are under consideration for future releases.



Support

If you encounter any issues or have feature requests, please use the Apify community forum or open an issue on the actor page.

Built and maintained by automation-lab.