How to Generate PDFs at Scale Without Managing a Browser Farm
Running a headless browser fleet in production is expensive, fragile, and often over-engineered for teams whose core product isn't document generation.
The common mistake
Most teams start with Puppeteer or Playwright running on a VM. It works for the first hundred documents. Then:
- Memory leaks start accumulating after extended runs
- Browser crashes take down the entire generation queue
- CSS rendering differs across Chrome versions
- Cold starts spike latency unpredictably
- Scale means more VMs, more ops, more cost
By the time a team reaches 10,000+ PDF renders per month, they're spending more engineering time on infrastructure than on their actual product.
A better model: externalise the browser fleet
API-based PDF generation separates the rendering concern entirely. You send a POST request with a URL or HTML template. The API returns a PDF URL or binary. No Chromium to manage, no memory to tune, no scaling event to handle.
What to look for in a PDF API
1. **Full JavaScript execution** — your invoice templates use React or chart libraries. A pure HTML-to-PDF converter won't cut it. 2. **Async mode with webhooks** — for bulk generation, you don't want to block on synchronous responses. 3. **S3 auto-upload** — direct delivery to your storage layer without a second API call. 4. **Wait-for selectors** — wait until your JS renders before capture to avoid empty PDF sections. 5. **Configurable delivery and retention** — choose direct delivery or stored output depending on your workflow and data-handling requirements.
Implementation in under 10 minutes
Using ProdaDoc, generating a PDF from a live URL takes a single POST request:
const pdf = await fetch('https://api.scaleapis.com/v1/pdf', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_KEY' },
body: JSON.stringify({
url: 'https://yourapp.com/invoice/INV-1042',
format: 'A4',
wait_for: '#invoice-rendered',
print_background: true,
}),
});
That's it. No browser management, no memory tuning, no ops burden.