Skip to main content

Python command line application to convert Markdown to PDF.

Project description

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

Project details


Download files

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

Files for mdpdf, version 0.0.17
Filename, size File type Python version Upload date Hashes
Filename, size mdpdf-0.0.17-py3-none-any.whl (14.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size mdpdf-0.0.17.tar.gz (14.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page