Generate an invoice PDF in Python (fpdf2, no browser)

Two clean ways to generate an invoice PDF in Python: build it yourself with fpdf2 (no headless Chromium, no system libraries), or POST JSON to a hosted endpoint and get the PDF back. Here's both.

Try it now — free, no signup:

Open the live playground →   see a sample PDF

Option A — one HTTP call

import requests
pdf = requests.post('https://invoicepdf-app.azurewebsites.net/invoice', json={
    'number': 'INV-1', 'currency': 'USD',
    'seller_name': 'Me', 'buyer_name': 'You',
    'items': [{'description': 'Work', 'quantity': 1, 'unit_price': 100}],
}).content
open('invoice.pdf', 'wb').write(pdf)

Option B — build it yourself with fpdf2

fpdf2 is pure Python — no Chromium, no OS packages, so it deploys on any free tier. Keep money as integer cents to avoid float drift, render line items in a table, and call pdf.output(). The hosted API above is exactly this, productised, if you'd rather not maintain it.