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

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.1.10.tar.gz (4.7 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.1.10-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for markdown2pdf_python-0.1.10.tar.gz
Algorithm Hash digest
SHA256 05b045d566225de82077bc73013d57aa32f402b25909ee6af6544aa39eea70ad
MD5 bce4e9e328575680df6e7fd5b65319d7
BLAKE2b-256 6dc227af304a380ada5180dac18c83361582037c522c88ddf3709e030f1d40e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown2pdf_python-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 bf8a73420972016d541a62a77f37319839d5784c0765dc091bf5c57e9ccf9ca5
MD5 21cb4b3ddf1de6a867def2a8779ea7d7
BLAKE2b-256 6b89b49578f5168cedc4ae91b2bb04d42510582bd21a26aa15bb8b8bb30cc474

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