Replace your self-hosted Puppeteer with a clean REST API.
Running Puppeteer in production is painful: memory leaks, zombie Chrome processes, Docker configuration, ARM compatibility issues. HTML2DocHub runs Puppeteer (Playwright/Chromium) in production-hardened infrastructure and exposes it as a simple REST API. Pay per render, not per server hour.
// BEFORE — Self-hosted Puppeteer (all this complexity)
const puppeteer = require("puppeteer");
const browser = await puppeteer.launch({
executablePath: "/usr/bin/chromium",
args: ["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"],
headless: "new",
});
const page = await browser.newPage();
await page.setContent(html, { waitUntil: "networkidle0" });
const pdf = await page.pdf({ format: "A4", printBackground: true });
await browser.close();
// Then upload to S3, generate signed URL, handle errors...// AFTER — One fetch call
const { download_url } = await fetch(
"https://api.html2dochub.com/v1/render",
{
method: "POST",
headers: {
"X-API-Key": "sk_live_YOUR_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
type: "pdf",
html,
options: { format: "A4", print_background: true },
}),
}
).then((r) => r.json());
// download_url is a signed S3 URL — done.# Before: pyppeteer / puppeteer-python
# (broken on many systems, memory issues, no M1 support)
# After: HTML2DocHub API — works everywhere
import requests
resp = requests.post(
"https://api.html2dochub.com/v1/render",
headers={"X-API-Key": "sk_live_YOUR_KEY"},
json={
"type": "pdf",
"url": "https://yourapp.com/report/42",
"options": {"format": "A4"},
},
timeout=30,
)
pdf_url = 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