HTML to PDF API Comparison

Compare 10 HTML-to-PDF APIs by rendering engine, CSS support, pricing at volume, and credit systems. Chromium vs Prince vs WeasyPrint. Real costs at 5K and 50K documents.

Vitalii Holben Updated

ScreenshotRun generates PDFs from any URL or raw HTML through a single REST parameter: format=pdf. But it is one option among many. This page compares ten HTML-to-PDF APIs side by side - pricing, rendering engines, CSS support, the trade-offs you actually hit in production.

Why the rendering engine matters more than the feature list

Every HTML-to-PDF API wraps one of four rendering engines. The engine determines what CSS it supports, whether JavaScript runs at all, how fast it converts, how large the output file gets. Two APIs can both advertise "HTML to PDF" and produce wildly different results from the same input.

Engine JavaScript CSS Grid Flexbox @page / Paged Media Speed (median) File size
Chromium (Playwright / Puppeteer) Full Full Full Partial (@page size, margins) ~550 ms (warm) Larger (23-73 KB typical)
Prince XML None Partial Full Full (footnotes, cross-refs, page counters) ~33 ms Medium
WeasyPrint None Partial (improving) Full Full + PDF/A, PDF/UA native ~236 ms Smallest (4-11 KB)
wkhtmltopdf (QtWebKit, archived 2023) Limited None Partial Basic ~150 ms Medium

If your HTML uses a React component, a Chart.js graph, a Vue dashboard, any other client-side rendering, you need a Chromium-based API. Prince and WeasyPrint process static HTML and CSS only - they will not execute your JavaScript. Prince compensates with the best print typography in the market. WeasyPrint produces the smallest PDFs and is the only engine that outputs PDF/A and PDF/UA natively.

wkhtmltopdf was archived in January 2023 with an unpatched SSRF vulnerability (CVE-2022-35583, CVSS 9.8). If you are still running it, the wkhtmltopdf alternatives page covers migration paths in detail.

Ten HTML-to-PDF APIs compared

The table below covers the ten services most likely to show up in your evaluation. Pricing reflects published rates as of late 2026.

API Engine Free tier Entry plan Per-doc cost (entry) JS rendering PDF merge
ScreenshotRun Chromium 200/mo $9/3K $0.003 Yes No
PDFShift Chromium 50/mo $9/500 $0.018 Yes No
DocRaptor Prince XML 5/mo $15/125 $0.120 No No
Api2Pdf Chrome + wkhtmltopdf + LibreOffice None (pay-per-use) ~$1.49/1K ~$0.0015 Yes (Chrome) Yes
PDFMonkey Chromium 20/mo $5/300 $0.017 Yes No
html2pdf.app Chromium 1,000/mo $9/2.5K $0.0036 Yes No
PDFCrowd Chromium Trial only $11/200 $0.055 Yes Yes
Gotenberg Chromium (Docker) Open source $0 + infra $0 (you pay servers) Yes Yes
CloudConvert Chrome Web UI only $8/1K mins Variable Yes Yes
PDFLayer Undisclosed 100/mo $9.99/1K $0.010 Unclear No

A few notes on the per-document cost column. ScreenshotRun and html2pdf.app charge one credit per request regardless of output size. PDFShift burns one credit per 5 MB of output - a 14 MB report costs three credits, not one. PDFCrowd is steeper: one credit per 0.5 MB. Api2Pdf bills by bandwidth plus compute time, so your actual cost depends on page complexity and render duration. CloudConvert charges per conversion-minute, making costs hard to predict for complex pages.

CSS and feature support across engines

This is the matrix that most comparison articles skip. It maps actual rendering capabilities, not marketing checkmarks.

Feature Chromium APIs Prince XML (DocRaptor) WeasyPrint wkhtmltopdf
CSS Grid Full Partial Partial (improving) None
Flexbox Full Full Full Partial
CSS custom properties (--vars) Full Full Full None
calc() with mixed units Full Full Full None
Web fonts (@font-face) Full Full Full Partial (system fonts differ)
@media print Full Full Full Partial
@page (size, margins) Partial (size + margins only) Full (page counters, footnotes, margin boxes) Full (page counters, margin boxes, PDF/A) Basic
JavaScript execution Full (ES2024+) None None Limited (ES5)
SVG rendering Full Full Full Partial
Chart.js / D3 output Yes (requires JS) No No No

The short version: If you control the HTML template and it uses only static HTML and CSS - invoices with Flexbox layout, reports with custom fonts - then Prince or WeasyPrint deliver better typographic quality and smaller files. The moment your templates include JavaScript-rendered charts, dynamically loaded data, framework components, you need Chromium. React, Vue, Svelte, Angular - all of them depend on JavaScript execution that only a browser engine provides.

Pricing at scale: what 5,000 and 50,000 documents actually cost

Entry-tier pricing tells you very little. The interesting question is what happens when your invoice volume doubles or your reporting pipeline scales up. Here is the monthly bill at two realistic volumes.

API 5,000 docs/mo 50,000 docs/mo Notes
ScreenshotRun $29 (Pro) $79 (Growth) Flat per-request. No size penalty.
PDFShift $39 (Growth) $149 (Shift 50K) Assumes docs under 5 MB each.
DocRaptor $149 (Max) $1,000+ (Silver) Per-document. Best typography.
Api2Pdf ~$8 ~$50 Variable (bandwidth + compute). Cheapest at volume.
PDFMonkey $60 (Pro+) $300 (Premium) Template-based workflow. Euro pricing.
html2pdf.app $15 (Standard) Custom No published plan above 10K.
PDFCrowd $35 (Medium) $106+ (Ultimate) Add 50% if average doc exceeds 0.5 MB.
Gotenberg $0 + ~$15 VPS $0 + ~$40-80 infra Open source. You manage the infra.
CloudConvert $40-80 $200-400 Per-minute billing. Complex pages cost more.
PDFLayer $39.99 (Pro) $119.99 (Enterprise) Simple pricing but unclear engine.

Api2Pdf wins on pure cost. ScreenshotRun wins on cost predictability - the bill is the plan price, nothing else. No bandwidth surcharges. No size multipliers. No per-minute billing. No variable line items at all. DocRaptor is the most expensive by a wide margin, but it is the only option with Prince XML typography, which matters for financial statements and legal documents where typographic precision affects trust.

Credit systems and hidden multipliers

The per-document cost in the main table assumes small documents - a one-page invoice, a two-page receipt. Real-world PDFs are rarely that tidy. Here is where credit-based APIs get expensive.

PDFCrowd allocates one credit per 0.5 MB of output. A 10-page report with embedded images might be 3 MB, burning six credits instead of one. At the Small plan ($23/1,000 credits), that report costs $0.138 instead of the advertised $0.023. PDFShift is more generous at one credit per 5 MB, but a 14 MB analytics dashboard still costs three credits.

Api2Pdf bills by compute seconds and bandwidth. A simple HTML page renders in under a second and costs fractions of a cent. A complex dashboard with heavy JavaScript might take 8-10 seconds and cost 10x more. The flexibility is real but the predictability is not.

CloudConvert charges per conversion-minute. Simple pages finish in seconds. Pages that need JavaScript execution, font loading, image downloads, network requests can consume a full minute or more. At $0.008/minute on subscription pricing, one slow conversion costs more than a simple one on a per-request API.

ScreenshotRun and DocRaptor avoid this entirely. One request equals one credit regardless of document size, page count, render time, output complexity. The tradeoff: DocRaptor charges significantly more per credit. ScreenshotRun absorbs the render cost into the plan price.

Self-hosted vs managed: when Gotenberg makes sense

Gotenberg is free and open source. It runs in a Docker container. For teams with existing container infrastructure and DevOps capacity, it is a legitimate alternative to any paid API. The question is whether the operational cost stays below the API bill.

At low volume (under 5,000 documents per month), a $15/month VPS handles Gotenberg comfortably. That undercuts every paid API except Api2Pdf. At 50,000 documents per month, you need dedicated resources - a 4vCPU/8GB server around $40-80/month, plus monitoring, alerting, log rotation, someone to handle Chromium crashes at 2 AM.

The break-even math depends on your team. If you already run Kubernetes and have an on-call rotation, Gotenberg adds minimal overhead. If your backend team is two developers and they are building product features, the $29-79/month for a managed API buys back their time. The self-host vs API cost breakdown goes deeper on the TCO calculation.

One thing Gotenberg does that most managed APIs do not: PDF/A, PDF/UA, e-invoice, tagged-PDF output. If compliance formats are a hard requirement, Gotenberg and DocRaptor are your short list.

Template engines vs bring-your-own HTML

PDFMonkey and CraftMyPDF take a fundamentally different approach. Instead of accepting a URL or raw HTML, they provide a template system - you design the PDF layout in their editor (drag-and-drop or Liquid templates) and push JSON data through the API. The template merges with the data and produces the PDF.

This works well when you generate thousands of identical documents with different data: invoices, certificates, shipping labels, event tickets. The template stays in the platform. Your API call is just a JSON payload.

The downside is lock-in. Your templates live in their system. Migrating to another provider means rebuilding every template from scratch. If your team already has HTML templates - maybe you use Jinja2, Handlebars, EJS, server-side rendering - a template-based API adds an extra layer you do not need.

ScreenshotRun, PDFShift, PDFCrowd, Api2Pdf all accept raw HTML or a URL. No proprietary template language. No visual editor to learn. No migration friction. You render the HTML however you want and hand the final output to the API. For the invoice generation use case, both approaches work - the right choice depends on who owns the template.

How ScreenshotRun handles HTML to PDF

ScreenshotRun is a screenshot API that also produces PDFs. The same endpoint, the same authentication, the same parameters - you change format from png to pdf and get a paginated document instead of an image.

curl "https://api.screenshotrun.com/v1/screenshots/capture?url=https://example.com&format=pdf&pdf_page_format=A4&pdf_landscape=false&pdf_margin_top=15&pdf_margin_bottom=15" \
  -H "Authorization: Bearer YOUR_API_KEY"

The rendering runs on Chromium through Playwright. JavaScript executes fully - React dashboards, Chart.js graphs, dynamically loaded tables all render before the PDF is generated. You can inject custom CSS to fix print styles, add delay or wait_for_selector to handle async content, use stealth mode to bypass bot detection on pages that block headless browsers.

Parameters specific to PDF output:

  • pdf_page_format - A4, Letter, Legal, Tabloid, A3, A5
  • pdf_landscape - portrait or landscape orientation
  • pdf_margin_top, pdf_margin_bottom, pdf_margin_left, pdf_margin_right - margins in millimeters

Beyond PDF, the same API call with format=png or format=webp produces a screenshot. Teams that need both outputs - a thumbnail for the dashboard and a downloadable PDF for the user - make two API calls to the same endpoint instead of integrating two separate services. The website-to-PDF feature page covers the full parameter reference.

What ScreenshotRun does not do

No PDF merge or concatenation. If you need to combine multiple HTML pages into one multi-section PDF, you will need a second tool or handle it client-side. No built-in watermark parameter either, though you can inject a watermark via the css parameter as a positioned overlay. No template system - you bring your own HTML. And no PDF/A or PDF/UA compliance output. For archival or accessibility-mandated formats, Gotenberg or DocRaptor is the right fit.

Choosing the right API for your use case

The right choice depends on what you are building. Here is a shortcut through the decision:

Invoices, receipts, reports, certificates, contracts from HTML templates. If your templates use JavaScript-rendered content (charts, dynamic tables): ScreenshotRun, PDFShift, Api2Pdf, PDFCrowd. If the templates are pure HTML/CSS and typographic quality matters: DocRaptor. If you want a managed template system with a visual editor: PDFMonkey.

High volume at low cost. Api2Pdf is the cheapest at every volume tier with pay-per-use pricing. ScreenshotRun is the cheapest with predictable flat-rate billing - $79/month covers 50,000 documents with no size surcharges.

Both screenshots and PDFs from one API. Only ScreenshotRun does this natively. Everyone else is PDF-only (or in Browserless's case, requires you to write Puppeteer code yourself).

Compliance documents (PDF/A, PDF/UA). Gotenberg (self-hosted, free) or DocRaptor (managed, expensive). No other managed API in this list produces standards-compliant output.

Maximum control, zero vendor lock-in. Gotenberg. Free, open source, runs in your infrastructure. You trade operational simplicity for complete independence.

wkhtmltopdf replacement. Any Chromium-based API on this list handles everything wkhtmltopdf did, with full modern CSS support and without the unpatched vulnerabilities. ScreenshotRun and PDFShift are the simplest drop-in replacements. Api2Pdf works too if you want pay-per-use pricing. See the full migration guide.

FAQ#

It depends on the input. For JavaScript-heavy pages (React apps, chart libraries, SPAs, dynamic dashboards), Chromium-based APIs like ScreenshotRun, PDFShift, and PDFCrowd produce the most accurate output because they run a real browser. For static HTML with demanding typographic requirements (financial statements, legal contracts), DocRaptor with Prince XML delivers the best print-quality typography, including proper footnotes, page counters, margin boxes, and cross-reference links. For the smallest file sizes and PDF/A compliance, WeasyPrint (available through Gotenberg) is the strongest option.

Yes. ScreenshotRun accepts the same URL or HTML input and returns either an image or a PDF depending on the format parameter. The rendering pipeline is identical -- Chromium loads the page, executes JavaScript, applies CSS, then either captures a screenshot or prints to PDF. Teams that need both a visual thumbnail and a downloadable document can use one API for both instead of maintaining two integrations.

Legacy dependencies. wkhtmltopdf was the default HTML-to-PDF tool for over a decade and is baked into many frameworks -- Laravel Snappy, Python PDFKit, Ruby wicked_pdf, Django WeasyPrint wrappers. The library was archived in January 2023, and an unpatched SSRF vulnerability (CVE-2022-35583) makes it a security risk on any server processing untrusted HTML. Replacing it with a Chromium-based API typically takes a single afternoon of integration work.

At raw per-document cost, Api2Pdf is the cheapest at every volume level with pay-per-use pricing around $0.0015 per small document. The tradeoff: your bill varies with document complexity and render time, so predicting monthly spend is harder. For predictable billing, ScreenshotRun covers 50,000 documents at $79/month ($0.00158/doc) with no size surcharges. Self-hosting Gotenberg is free apart from infrastructure, which typically runs $15-80/month depending on volume.

Written by

Vitalii Holben

Co-founder and CEO of ScreenshotRun. Full-stack developer building screenshot API tools that help developers capture, automate, and monitor web pages at scale. Based in Europe, shipping code since 201...

Screenshot API in a few clicks

Free plan includes 200 screenshots every month. No credit card required.

Sign up → copy your key → make your first call