Skip to main content

Convert Markdown files to well-formatted PDF documents

Project description

Markdown to PDF Converter

A pip-installable Markdown to PDF converter with a command-line interface built on ReportLab and Matplotlib.

Features

  • Converts Markdown files to styled PDF documents
  • Supports headings, lists, block quotes, code blocks, tables, images, and math
  • CLI with required input and optional output
  • Configurable font family
  • Configurable color scheme
  • Configurable page size

Installation

Install from this project directory:

pip install .

After installation, the CLI command is available as:

md-to-pdf

CLI Usage

md-to-pdf INPUT [OUTPUT] [--font FONT] [--color-scheme {classic,mono,warm}] [--page-size {A4,LETTER,LEGAL}]

Argument Behavior

  1. INPUT is required.
  2. OUTPUT is optional. If omitted, output is created next to the input file with .pdf suffix.
  3. --font can be passed.
  4. --color-scheme can be passed.
  5. --page-size can be passed.

Examples

Convert with default output path:

md-to-pdf Docs/initial_proposal_v2.md

Convert with explicit output path:

md-to-pdf Docs/initial_proposal_v2.md Docs/initial_proposal_v2_custom.pdf

Convert with custom font:

md-to-pdf Docs/initial_proposal_v2.md --font "Times New Roman"

Convert with warm color scheme and LETTER page size:

md-to-pdf Docs/initial_proposal_v2.md --color-scheme warm --page-size LETTER

Python API Usage

from pathlib import Path
from md_to_pdf import markdown_to_pdf

markdown_to_pdf(
    Path("Docs/initial_proposal_v2.md"),
    Path("Docs/initial_proposal_v2.pdf"),
    font="serif",
    color_scheme="classic",
    page_size_name="A4",
)

Notes

  • Dependencies are installed automatically through pip: reportlab, matplotlib
  • Image paths in Markdown are resolved relative to the input Markdown file

GitHub Repo

Project details


Download files

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

Source Distribution

md_to_pdf_converter-0.1.1.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

md_to_pdf_converter-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file md_to_pdf_converter-0.1.1.tar.gz.

File metadata

  • Download URL: md_to_pdf_converter-0.1.1.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for md_to_pdf_converter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b25f50c004296b81fc29408fdd6b302301646a692e38b2ed6e6c735b7d14c207
MD5 300270b04ac463617bc79133e22861ae
BLAKE2b-256 a7d4224e2a281ef1fa5a753e308683c84d41325d00a51ceeb2bc9926930319af

See more details on using hashes here.

Provenance

The following attestation bundles were made for md_to_pdf_converter-0.1.1.tar.gz:

Publisher: publish-pypi.yml on hoseinmrh/Markdown-to-PDF-Converter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file md_to_pdf_converter-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for md_to_pdf_converter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b8f9b496d8c23517bf331602913717a7f3dfcb7135d60336e258652e639ea2cf
MD5 693b7add11ff9b912e8cdf919a361953
BLAKE2b-256 5475748cdbd18e36f57d02854b4963fcdd5b0c662d4c130690576428126264a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for md_to_pdf_converter-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on hoseinmrh/Markdown-to-PDF-Converter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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