Skip to main content

mdpdf

License: MIT Code style: black

Python command line application to convert Markdown to PDF.

Project Features

  • Bare-bones: Only supports basic CommonMark
  • "One-size-fits-all" style: Left-aligned, PDF-base14 fonts. Reasonably pretty, but if you want more control, see alternatives below.
  • Headings are transformed to PDF bookmarks.
  • File links are transformed into attachments with PDF links.
  • Images links are transformed into embedded images with optional captions and width specifier.
  • Minimal requirements

Alternatives

There are several projects that can be considered if you need something with more features. Of note:

Installation

$ pip install mdpdf

Usage

$ mdpdf [OPTIONS] [INPUTS]...

Options:

  • -o, --output FILE Destination for file output. [required]
  • -h, --header <template> Sets the header template.
  • -f, --footer <template> Footer template.
  • -t, --title TEXT PDF title.
  • -s, --subject TEXT PDF subject.
  • -a, --author TEXT PDF author.
  • -k, --keywords TEXT PDF keywords.
  • -p, --paper [letter|A4] Paper size (default letter).
  • --version Show the version and exit.
  • --help Show this message and exit.

Templates:

The <template> is a quoted, comma- delimited string, containing the left, centre, and right, fields for the header/footer. Format is "[left],[middle],[right]".

Possible values to put here are:

  • Empty string
  • Arbitrary text
  • Special variables:
    • {page} current page number
    • {header} current top-level body text heading
    • {date} current date

Example:

$ mdpdf -o article.pdf article.md

$ mdpdf -o article.pdf --footer "{date},{heading},{page}" article.md

Metadata

Release files for mdpdf 0.0.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mdpdf 0.0.18
File Size Uploaded
mdpdf-0.0.18.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mdpdf 0.0.18
File Interpreter ABI Platform
mdpdf-0.0.18-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / mdpdf-0.0.18.tar.gz

Download URL mdpdf-0.0.18.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2465e47ef772554f09662ce359ac5924eddce1564cb4df685f7bf3ca8d0e6a7c
BLAKE2b-256 checksum
How to use checksums
994f90d6dd1276e9726f59c4efccb12782eef2b125610f5a7f766938d1880316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Release files / mdpdf-0.0.18-py3-none-any.whl

Download URL mdpdf-0.0.18-py3-none-any.whl
Size 14.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be135cfca4a0c4fde86004670b06780744432671c3272e4ff064790e2e572665
BLAKE2b-256 checksum
How to use checksums
ed2a1be7477288707b4cd3e25a53c05c87adc62fb8658cfbb3178d39fd5172d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.0.18 This release

2 release files

0.0.15

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page