We run Playwright so you don't have to. REST API, pay per render.
HTML2DocHub's rendering engine is built on Playwright with Chromium — the same technology Microsoft uses for Edge and many CI testing pipelines. Stop managing browser installations and get production-ready PDF generation via a clean REST API.
# BEFORE — Complex Playwright setup
from playwright.async_api import async_playwright
async with async_playwright() as p:
browser = await p.chromium.launch()
page = await browser.new_page()
await page.set_content(html)
await page.wait_for_load_state("networkidle")
pdf_bytes = await page.pdf(
format="A4",
print_background=True,
margin={"top": "2cm", "bottom": "2cm"},
)
await browser.close()
# Then store to S3, serve signed URL, handle errors...# AFTER — One function call
import requests
def html_to_pdf(html: str) -> str:
resp = requests.post(
"https://api.html2dochub.com/v1/render",
headers={"X-API-Key": "sk_live_YOUR_KEY"},
json={
"type": "pdf",
"html": html,
"options": {
"format": "A4",
"print_background": True,
"margin_top": "2cm",
"margin_bottom": "2cm",
},
},
)
return resp.json()["download_url"]Pay only for pages rendered. No subscriptions. No minimum monthly fee.
Free account. No credit card required. API ready in minutes.
Get your free API key