--- id: md2pdf version: "3.1.1" license: MIT license_treatment: permissive maintenance: active --- # md2pdf — The Markdown to PDF conversion tool with styles License: permissive · Maintenance: active · Downloads: 204.9K/mo ## What it is and what it does md2pdf is a Markdown-to-PDF converter that bridges markdown source files and styled PDF output. It accepts markdown input (from files or raw strings), applies optional CSS stylesheets, and renders the result as a PDF using weasyprint as its rendering engine. The tool supports Jinja2 templating within markdown, allowing dynamic content injection via frontmatter or programmatic context variables, and integrates markdown extensions from pymdown-extensions for features like syntax highlighting and emoji support. You can use it as a command-line tool for one-off conversions or batch processing (with parallel workers), or embed it in Python code as a library function. It's designed for developers who need to generate styled PDF documentation from markdown sources—common in technical writing, report generation, and documentation pipelines. The package supports Python 3.10 through 3.14 and is actively maintained. Use it for: - Generate styled PDF documentation from markdown README files with custom CSS branding. - Batch convert multiple markdown files to PDF with parallel processing using the --workers option. - Create dynamic PDF reports by embedding Jinja2 templates and frontmatter variables in markdown source. - Integrate markdown-to-PDF conversion into a Python application or documentation build pipeline. - Render markdown with syntax-highlighted code blocks using pymdown-extensions and custom CSS. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts Markdown files to PDF with custom CSS styling, Jinja templating, and syntax highlighting support via a CLI tool or Python library. Yes, if you need to convert markdown to styled PDFs. The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. The main condition is ensuring weasyprint's system dependencies are available on your platform—check the weasyprint installation guide before installing. For markdown-to-PDF workflows, this is a solid, production-ready choice. ## Install pip install md2pdf uv add md2pdf poetry add md2pdf ## Installing md2pdf Before you install: Low friction: pure Python wheel with six runtime dependencies (jinja2, markdown, pygments, pymdown-extensions, python-frontmatter, weasyprint). Active maintenance with last commit 2026-08-14. Requires weasyprint to be fully functional on your system before use, per the documentation. License in practice: MIT license (permissive) means you can use, modify, and distribute md2pdf freely in commercial and private projects with minimal restrictions. Quickstart: pip install md2pdf[cli] md2pdf -i README.md Or as a library: from md2pdf.core import md2pdf md2pdf('output.pdf', md='input.md', css='style.css') Weasyprint must be fully functional on your system; see https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation for platform-specific setup. Verify before relying: - Whether weasyprint's system dependencies (e.g., Cairo, Pango) are easily available on all target platforms or represent a common installation barrier. - Performance characteristics when processing large markdown files or batch conversions with the --workers parameter. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 204.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags markdown to pdf conversion, md to pdf cli tool, markdown pdf generator, convert markdown documents pdf, markdown with css styling pdf, jinja markdown templates pdf, syntax highlighting markdown pdf, markdown-to-pdf, document-generation, cli-tool [View on SkillFed](https://skillfed.io/packages/md2pdf) · [View on PyPI](https://pypi.org/project/md2pdf/)