Skip to main content

⚡ Python client for markdown2pdf.ai - Convert markdown to PDF with Lightning payments

Project description

⚡ Markdown to PDF conversion, for agents. ⚡

Agents speak Markdown. Humans prefer PDF. Bridge the gap for the final stage of your agentic workflow. No sign-ups, no credit cards, just sats for bytes.

Read the full documentation at markdown2pdf.ai

Here’s the output of a markdown file converted to PDF format, showing cover page, table of contents and table support. Our engine is powered by LaTeX rather than HTML to PDF conversion as many other libraries and services use, which results in a much higher quality, print-ready output.

This package provides a python client for the markdown2pdf.ai service. You can read full instructions in our documentation.

Installation

pip install markdown2pdf-python

Usage

from markdown2pdf import MarkdownPDF

def pay(offer):
    print("⚡ Lightning payment required")
    print(f"Amount: {offer['amount']} {offer['currency']}")
    print(f"Description: {offer['description']}")
    print(f"Invoice: {offer['payment_request']}")
    input("Press Enter once paid...")

client = MarkdownPDF(on_payment_request=pay)
path = client.convert(markdown="# Save this one", title="My document title", download_path="output.pdf")
print("Saved PDF to:", path)

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

markdown2pdf_python-0.2.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

markdown2pdf_python-0.2.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file markdown2pdf_python-0.2.0.tar.gz.

File metadata

  • Download URL: markdown2pdf_python-0.2.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.5

File hashes

Hashes for markdown2pdf_python-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7fd6d3a2de93c223860279d516987a3fe230287ac0af17d5296100da3c013975
MD5 085d966fbe636a404aba16d6974852be
BLAKE2b-256 82d44b39e21c473e1c90264d5a600e0be4fa276463a4bdaa54bb3f848e3b2524

See more details on using hashes here.

File details

Details for the file markdown2pdf_python-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for markdown2pdf_python-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7793364d5ea3b8173df86fc720efebb854b83e899de38f5a658b6d88876ef4a
MD5 aa647d971c8c72bd807fc1b31a54b9f0
BLAKE2b-256 1201512f6c4415e8d6d38704ae194f2f10bae5355e2025c501cf4c3ab6a65a73

See more details on using hashes here.

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