DEV Community

Tech Spyder
Tech Spyder

Posted on • Edited on

Why I built yet another PDF API (and priced it 95% cheaper)

I know. Another PDF API. Bear with me.

The problem I kept running into

Every time I needed HTML-to-PDF conversion in a project, I’d reach for one of the usual suspects: PDFShift, DocRaptor, API2PDF.

They all work. They’re all reasonably well documented.
And they all share the same problem: the free tier is just generous enough to get you started… then runs out before you’re done testing.

PDFShift, for example, gives you 50 credits per month. Each credit covers a single conversion up to 5MB. If your document is larger — a report with charts, an invoice with logos, anything moderately complex — you burn multiple credits per test.

Before I’d finished validating my template, I was already thinking about upgrading to a paid plan I didn’t need yet.

That anxiety — “am I wasting test credits on this iteration?” — is exactly the wrong headspace to be in when you’re trying to build something.


What I shipped

PDFBridge — an HTML-to-PDF API with one differentiator I actually care about:

A generous sandbox environment for every developer, including the free tier.

Here’s how it works:

You sign up → you get an API key → in the dashboard, you toggle between test mode and live mode.

Test mode

  • Conversions are free (uncapped for manual testing)
  • Output PDFs include a “PDFBridge Test” watermark

Live mode

  • Conversions pull from your monthly quota
  • Clean output, no watermark

The result is simple:
You can build and test your entire integration — every template, edge case, and weird CSS layout — before spending a dollar. When you switch to live mode, you already know it works.


The technical choices
Engine: Why Gotenberg

Most HTML-to-PDF APIs are built on raw Chromium. That works, but running Chromium at scale is painful: slow cold starts, memory leaks, zombie processes, and constant babysitting.

PDFBridge is built on Gotenberg 8, an open-source, Docker-native service designed specifically for document conversion.

It:

  • Manages Chromium lifecycles cleanly
  • Handles concurrent jobs efficiently
  • Scales horizontally without drama

Architectural note

Unlike many “simple” wrappers, PDFBridge is asynchronous.

Conversions run on a Redis-backed worker tier. Your app doesn’t sit around waiting 10+ seconds for a heavy render. You trigger a job, then poll for the result (or use webhooks).

It’s built for production stability, not just Hello World demos.


A simple integration

Note: This example is intended for server-side usage (Node.js, serverless functions, or backend services).

async function generatePDF(html, testMode = true) {
  const bridgeUrl = 'https://api.pdfbridge.xyz/v1';
// NOTE: Store your API key in environment variables in production
const apiKey = 'YOUR_API_KEY';



  // 1. Kick off the background job
  const init = await fetch(`${bridgeUrl}/convert`, {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${apiKey}`, 'Content-Type': 'application/json' },
    body: JSON.stringify({ html, testMode })
  });

  const { jobId } = await init.json();

  // 2. Poll for the result
  for (let i = 0; i < 15; i++) {
    const check = await fetch(`${bridgeUrl}/jobs/${jobId}`, {
      headers: { 'Authorization': `Bearer ${apiKey}` }
    });
    const { status, result } = await check.json();

    if (status === 'done') return result.url;
    if (status === 'failed') throw new Error(result.error);

    // Wait 2 seconds between checks
    await new Promise(r => setTimeout(r, 2000));
  }

  throw new Error("Generation timed out");
}

// Usage
const url = await generatePDF('<h1>Invoice #123</h1>');
console.log('Download here:', url);
Enter fullscreen mode Exit fullscreen mode

Rate limiting: protecting the service

Keeping the sandbox open means abuse prevention matters. Protection is layered:

  • Sandbox limits: 50 requests/hour, 5MB document size
  • Watermarks: Test PDFs aren’t usable in production
  • Concurrency caps: Free/Test tiers limited to 2 concurrent jobs

Real developers don’t need infinite credits — they just need to stop counting credits during a 2-hour coding session.


Pricing

PDFBridge is priced for developers who actually want to ship:

  • Free ($0/mo): 5 live conversions + uncapped sandbox testing (5MB limit)
  • Starter ($10/mo): 2,000 live conversions, 25MB limit
  • Pro ($30/mo): 20,000 live conversions, 50MB limit
  • Enterprise: Custom limits, 100MB+ files

At $10/month for 2,000 conversions, you’re paying $0.005 per PDF — roughly 2–5× cheaper than most alternatives.


What I’m looking for

This is a Show Dev post, so I’ll be direct.

I’m looking for early users and honest feedback.
If you’re generating invoices, reports, receipts, or contracts, I’d love for you to try the sandbox.

No credit card required.

👉 https://www.pdfbridge.xyz/

What’s your current PDF generation setup?
What’s working — and what’s frustrating — in the wild?

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.