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.1.11.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.11-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for markdown2pdf_python-0.1.11.tar.gz
Algorithm Hash digest
SHA256 e5567cb1b5fe2ff2e731f44acccd2b9950eaf381453defda322b1f7d97596d61
MD5 0d2ea505204e7c3193b873c0378a2b6a
BLAKE2b-256 20f82d6341f59a7dcef6c8e25ffbd6ef47e5771689dd26d3c98d4ece03028329

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for markdown2pdf_python-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 fa570e27d82a1e177e4450369b04fe877204cd7b0b14427e1337b03ff41f2e16
MD5 2836ad81109836dc745478bdcc2d876a
BLAKE2b-256 61690b0ad4c49509a80f648e4464a63175ab808124620eebc80fb801aaee91f5

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