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
- INPUT: demo.md
- OUTPUT-DEFAULT: output-default.pdf
- OUTPUT-STYLES: output-styles.pdf
Metadata
Release files for md2pdf-python 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| md2pdf_python-1.0.1.tar.gz | 7.2 kB | Without provenance | Details for md2pdf_python-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| md2pdf_python-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for md2pdf_python-1.0.1-py3-none-any.whl |
Total release size: 15.6 kB
Release files / md2pdf_python-1.0.1.tar.gz
| Download URL | md2pdf_python-1.0.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f83e2144f87009e61cfb8cc0342b482f2e09ecf6f784557cf01aaef59b5bd8f
|
|
BLAKE2b-256 checksum How to use checksums |
aacf530089b63e4b247b8b69c18eb851d1c524d39a02ffb6aacce4ff53a3752e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / md2pdf_python-1.0.1-py3-none-any.whl
| Download URL | md2pdf_python-1.0.1-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b357ce03b0ff9280ff28595395bf0f24593fca98672273b885c86a00ce542fe9
|
|
BLAKE2b-256 checksum How to use checksums |
0f00ace48ce381cebcd332edac5dfc7106519c7047bb2bff143b1a7b3073f0b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Security for md2pdf-python 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.