Skip to main content

PyPI - Version PyPI - Status


A user-friendly tool for converting Markdown to PDF

Installation

pip install md2pdf-python

Usage

Use in CMD

md2pdf --help

md2pdf tests/demo.md -o tests/output-default.pdf
md2pdf tests/demo.md -o tests/output-default.pdf --html
md2pdf tests/demo.md -o tests/output-styles.pdf --css-file tests/demo.css --mermaid-config tests/demo.json

Use in Python

from md2pdf.core.converter import MD2PDF

md2pdf(input_file='input.md', output_file='output.pdf')
md2pdf(input_file='input.md', output_file='output.pdf', html=True)
md2pdf(input_file='input.md', output_file='output.pdf', css_file='custom.css')
md2pdf(input_file='input.md', output_file='output.pdf', css_file='custom.css', mermaid_config='custom-config.json')

Customize CSS

body {
    font-family: Arial, sans-serif;
    font-size: 12pt;
}
h1 {
    color: red;
}
h2 {
    color: blue;
}
h3 {
    color: green;
}
p {
    color: black;
}
table {
    border-collapse: collapse;
    width: 100%;
}

Customize Mermaid Config

{
  "theme": "default",
  "themeVariables": {
    "fontFamily": "Times New Roman, serif"
  },
  "backgroundColor": "#F2F2F2"
}

Support Features

  • TOC
  • Table
  • Quote
  • Code Block
  • Inline Code
  • Image
  • Checkbox
  • Mermaid

mermaid render is based on Mermaid-CLI (mmdc), install it with: npm install -g @mermaid-js/mermaid-cli


Demo

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

md2pdf_python-1.0.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

md2pdf_python-1.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file md2pdf_python-1.0.1.tar.gz.

File metadata

  • Download URL: md2pdf_python-1.0.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for md2pdf_python-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8f83e2144f87009e61cfb8cc0342b482f2e09ecf6f784557cf01aaef59b5bd8f
MD5 1ca3867dd7d480d89706e8f23859357b
BLAKE2b-256 aacf530089b63e4b247b8b69c18eb851d1c524d39a02ffb6aacce4ff53a3752e

See more details on using hashes here.

File details

Details for the file md2pdf_python-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: md2pdf_python-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for md2pdf_python-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b357ce03b0ff9280ff28595395bf0f24593fca98672273b885c86a00ce542fe9
MD5 a3120fbb359d354c8068ff106fb5ad1a
BLAKE2b-256 0f00ace48ce381cebcd332edac5dfc7106519c7047bb2bff143b1a7b3073f0b2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page