Inkspan › Python

How to generate a PDF from HTML in Python

Use the Inkspan /v1/generate/html endpoint to generate a PDF from HTML in Python. It runs as a managed API — no headless-browser infrastructure, fonts, or scaling to maintain. Authenticate with your API key and send a single POST request.

Python example

import requests
r = requests.post('https://api.inkspan.dev/v1/generate/html',
    headers={'X-API-Key': 'ink_live_...'},
    json={"html":"<h1>Hello</h1>"})
open('out.pdf','wb').write(r.content)

Notes

Get an API key →

Related: generate a PDF from a template · convert Markdown to PDF · merge PDF files