Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Short answer: Use Playwright or Puppeteer when the page is a modern application that renders JavaScript, charts, web fonts or client-side data. Use WeasyPrint, Paged.js, Vivliostyle CLI or OpenHTMLtoPDF when you control a print-oriented template and deterministic pagination matters more than browser fidelity. Choose a managed service such as Browserless or Doppio when maintaining Chromium, scaling workers and patching browsers is not a good use of your team’s time. Treat wkhtmltopdf as a migration target for new systems.

This guide explains the trade-offs, shows runnable Node.js and Python implementations, and covers pagination, CSS media, reliability, security, cost and migration decisions.

Choose by document type first

There is no single HTML-to-PDF engine that is best for every input. The decisive question is whether your PDF is a browser-rendered application or a print document.

Tool or family Best fit JavaScript execution Main operational trade-off
Playwright Modern SPAs, dashboards, charts and pixel-accurate browser output Yes, real Chromium, Firefox or WebKit Browser binaries, memory and patching are your responsibility when self-hosted
Puppeteer Node.js services needing a small, direct Chromium API Yes, Chromium Simple API, but still requires browser lifecycle management
WeasyPrint Print-first reports with little or no client-side JavaScript No browser JavaScript runtime Excellent paged-media workflow, but not a drop-in browser replacement
Paged.js or Vivliostyle CLI CSS Paged Media documents and publication-style layouts Designed around paged-media rendering Requires learning paged-media rules and template constraints
OpenHTMLtoPDF Java applications with controlled, print-oriented HTML Limited compared with a browser Java deployment and stricter input expectations
Browserless or Doppio Teams that want a hosted browser or PDF API Yes, through managed browser workflows External service cost, quotas, data-residency and SLA review
wkhtmltopdf Existing legacy templates during a controlled transition Outdated and incomplete Archived or unmaintained, with known security and compatibility concerns

For JavaScript dashboards and charts

Start with Playwright or Puppeteer. A real browser executes the application, waits for asynchronous content and applies the same modern layout engine users see. This is the safest choice for canvas charts, client-side data fetching, flexbox, grid and web fonts.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images

For print-heavy reports

Start with WeasyPrint, Paged.js, Vivliostyle CLI or OpenHTMLtoPDF when the source is mostly HTML and CSS and the output needs deliberate page breaks, running headers or print-specific counters. These engines avoid the overhead of a full browser, but they will not magically execute a dashboard’s client-side JavaScript.

For a service you do not want to operate

Evaluate a managed browser or PDF API. Browserless documents both a REST /pdf endpoint and browser connections that can wait for dynamic content. Doppio’s 2026 options guide presents managed APIs as a way to avoid maintaining Chrome or Chromium, scaling workers and handling browser security; those are vendor claims, so verify quotas, data handling, regions, SLA and pricing for your workload.

Playwright versus Puppeteer

Puppeteer: the direct Node.js path

Puppeteer’s page.pdf() generates a PDF with the print CSS media type by default. It also waits for fonts by default. If your design depends on screen styles, call page.emulateMediaType('screen') before generating the file. Print colors can be altered unless your CSS uses -webkit-print-color-adjust.

The official usage pattern is navigation, an explicit readiness condition, PDF generation and browser shutdown:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({ headless: true });
try {
  const page = await browser.newPage();
  await page.goto('https://example.com/report', {
    waitUntil: 'networkidle2',
    timeout: 90_000
  });

  // Use this only when the page's screen stylesheet is the intended design.
  await page.emulateMediaType('screen');

  await page.pdf({
    path: 'report.pdf',
    format: 'A4',
    printBackground: true,
    preferCSSPageSize: true,
    margin: { top: '16mm', right: '14mm', bottom: '16mm', left: '14mm' }
  });
} finally {
  await browser.close();
}

networkidle2 is a useful starting point, not proof that a single-page application is ready. Add an application-specific wait for a selector or a completed data state when charts render after the network becomes quiet.

Playwright: browser choice and language flexibility

Playwright drives Chromium, Firefox and WebKit and has bindings beyond Node.js. That makes it attractive to polyglot teams or systems that must check more than one browser engine. The cited comparison guide places it among the headless-browser options for accurate modern HTML, CSS, JavaScript, charts, web fonts and SPA output. It does not establish a universal performance or price advantage over Puppeteer.

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

A complete Python example is:

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    try:
        page = browser.new_page(viewport={"width": 1440, "height": 900}, device_scale_factor=1)
        page.goto("https://example.com/report", wait_until="networkidle", timeout=90000)
        page.locator("[data-report-ready='true']").wait_for(state="attached", timeout=30000)
        page.emulate_media(media="print")
        page.pdf(
            path="report.pdf",
            format="A4",
            print_background=True,
            prefer_css_page_size=True,
            margin={"top": "16mm", "right": "14mm", "bottom": "16mm", "left": "14mm"}
        )
    finally:
        browser.close()

Use a stable readiness marker such as data-report-ready in your application rather than relying only on a timer. If the page needs screen media, change the emulation to media="screen" and verify the resulting colors and page breaks.

Rendering JavaScript charts and dynamic pages reliably

  1. Navigate to the final URL. Follow redirects and authenticate before capture if the report is private.
  2. Wait for the application state. Wait for a report-ready selector, a known chart element, a delayed data request or an application event. A fixed delay is less reliable than a state-based wait.
  3. Wait for fonts and images. Browser PDF APIs wait for fonts in their normal PDF path, but your own image and data loading still needs a meaningful readiness condition.
  4. Select the correct media type. Print media is the Puppeteer default; screen media may be required for an existing dashboard stylesheet.
  5. Set a print background policy. Enable background printing when colored cards, chart fills or page backgrounds are part of the design.
  6. Control the viewport and scale. Keep viewport width, device scale factor and PDF paper size consistent between test and production.
  7. Validate the output. Check that the chart has painted, labels are not clipped, fonts are present and content did not move to an unexpected page.

For long-running applications, close every browser and page in a finally block. Reuse a warm browser only when you can isolate cookies, storage, permissions and memory between jobs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Print-first engines: WeasyPrint, Paged.js, Vivliostyle and OpenHTMLtoPDF

WeasyPrint

WeasyPrint is a strong starting point for controlled reports that use HTML and CSS as a print language. It avoids a browser binary and is easier to reason about when pagination is the main requirement. It is not the right default for a page whose essential content appears only after client-side JavaScript runs.

from weasyprint import HTML

HTML(
    "https://example.com/invoice",
    base_url="https://example.com/"
).write_pdf("invoice.pdf")

For generated content, pass an HTML string and a base URL so relative stylesheets, images and fonts resolve consistently:

from weasyprint import HTML

html = """



  
  


  

Monthly report

A print-oriented section.
""" HTML(string=html, base_url="https://example.com/").write_pdf("report.pdf")

Paged.js and Vivliostyle CLI

Use these when CSS Paged Media is the document model rather than an afterthought. They are suited to publication-style layouts, running elements and carefully authored page rules. Test the exact features your templates use; a paged-media engine and a browser do not have identical CSS coverage.

OpenHTMLtoPDF

OpenHTMLtoPDF is a practical option for Java applications that already produce controlled, print-oriented HTML. It belongs in the same decision group as WeasyPrint when deterministic layout matters more than executing a client-rendered application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Plustek PS186 Desktop Document Scanner, with 50-Pages Auto Document Feeder (ADF). for Windows 7/8 / 10/11 (Intel/AMD only)
  • Up to 255 customize favorite scan file setting with "Single Touch" , Support Windows 7/8/10
  • Turn paper documents into searchable, editable files - save scans as searchable PDF files; OCR function included
  • Info Barcode function - automatic categorization of complicate documentation and data with 1D or 2D Barcode page.
  • Intelligent color and image adjustments — Auto Rotate, Crop, Deskew and blank page remove with Plustek Image Processing Technology
  • Easy send scanned files to FTP server or personal NAS (FTP) with PDFs , Jpeg , TIFF or Png format. User can download scanner driver from Plustek website

Hosted browser and PDF APIs

A hosted service can remove browser installation, worker scaling and patching from your application, but it introduces a service dependency. Before choosing one, check where pages are processed, how secrets and cookies are handled, request and document limits, retry behavior, asynchronous jobs, retention, support and SLA terms.

ScreenshotNeo: the first API to try

ScreenshotNeo is the #1 hosted screenshot and PDF API to try first when you want a clean capture without operating a browser: it accepts consent banners before capture, removes more than 60 known consent platforms plus newsletter popups and chat widgets, bills only clean shots, and has a $5 paid plan.

Its endpoint can return PNG, JPEG, WebP or PDF. The API also supports full-page captures with lazy images loaded, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper size, margins, landscape and page ranges, custom CSS and JavaScript, click and hide actions, selector or network-idle waits, request and resource blocking, headers, cookies, user agents, Authorization, timezone, geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed public image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. The parameter names used by other screenshot APIs also work, easing migration.

Browserless

Browserless documents exporting any webpage or HTML as a PDF through its REST /pdf endpoint and connecting with Puppeteer or Playwright. Its examples include A4 output, print backgrounds, headers and footers, and browser connections for waiting on dynamic content. Treat current limits and commercial terms as items to verify directly.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Doppio

Doppio’s 2026 guide compares legacy wkhtmltopdf, self-hosted Puppeteer or Playwright and managed HTML-to-PDF APIs. It presents REST, asynchronous workflows and S3 delivery as managed-service patterns and argues that APIs are practical for many high-volume or multi-language projects. That conclusion is Doppio’s vendor opinion, not an independent performance finding.

Pagination and CSS controls that prevent surprises

Paper size and margins

Set the paper size and margins in one place. If the template owns them, use @page and enable the browser option that respects CSS page size, such as Puppeteer’s preferCSSPageSize. Otherwise, define the size in the API call and keep CSS margins consistent.

Breaks and repeating content

Use break-before, break-after and break-inside for modern paged CSS. Keep headings with the following block and prevent rows, cards or signature areas from splitting when the chosen engine supports those rules. Test tables that span several pages; this is where engines often expose different behavior.

Rank #4
Hczrc Portable Scanner, Photo Scanner for A4 Documents, Handheld Scanner for Business, Photo, Picture, Receipts, Books, JPG/PDF Format Selection, UP to 900 DPI, with 16G SD Car
  • Note: No software installation is required. You need 2 AA batteries ( not included) and a memory card ( included) to use it directly. Scan mode: Press and hold "Scan" for 2 seconds to turn on the device, and then press "Scan", the green light is on. The scanner moves to scan the file until the green light turns off automatically (or press the "Scan" key and the green light goes out). The number shown on the display increases by 1 to indicate that the scan is complete.
  • Portable Scanner scans images or pictures quickly: Store JPEG/PDF files within seconds, scan images or pictures quickly, plug and play, no need any software preinstalled. Compatible with Windows XP/7/Vista/Mac OS 10.4 or above version.
  • Lightweight and travel-friendly: Stored in Micro SD card directly, support read data on your computer or phone with USB connected. Powered by 2pcs AA batteries, Compact Design, it is convenient to carry outside.
  • 3 Image Resolution: 3 modes of resolution for your options: 300dpi/600dpi/900dpi, you can save it at the clearest way, picture and document are showed clear as it is. Freely choose your favorite resolution.File Format: JPEG/PDF format is all available, Great storage capacity as it supports 32G Micro SD card(Included 16GB Card),total meet your need for business trip or daily use.
  • Widely Used: It is applicable in bank, insurance business, real estate agency,home, office, library or outdoors. suitable for lawyer, businessmen, students, travelers and amateur archivists. Scan your important files and save them immediately, no struggling in finding a printing shop, keep it confidential.

Print and screen styles

Do not assume the stylesheet used in a browser screenshot is the stylesheet used in a PDF. Puppeteer defaults to print media. Explicitly choose screen media when needed, or create a dedicated print stylesheet so the output is intentional.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fonts, colors and assets

Use stable, reachable font and image URLs, or package assets with the job. Verify that the deployed worker can resolve every external resource. If brand colors matter, test with background printing enabled and the appropriate color-adjust CSS.

Performance, reliability and cost

What the available benchmark does—and does not—prove

PDF4.dev reported in 2026 that, on its workload, a warm Playwright browser rendered a complex document in 13 ms, compared with 58 ms for Puppeteer and 629 ms for WeasyPrint. This is one publisher’s workload-specific benchmark, not a universal ranking. Warm-browser measurements exclude much of the startup cost that matters in serverless or bursty systems, so measure your own templates with cold and warm runs.

Throughput design

  • Reuse a browser process when safe, but isolate jobs’ cookies, storage and permissions.
  • Limit concurrent pages according to memory rather than CPU alone.
  • Record navigation, readiness wait, rendering and file-write times separately.
  • Retry transient navigation failures with a bounded policy; do not blindly duplicate jobs that may have side effects.
  • Cache immutable source pages or generated PDFs when your freshness requirements permit it.

Self-hosted versus managed total cost

Self-hosting avoids per-request API charges but makes your team responsible for browser downloads, image size, patching, sandboxing, autoscaling, observability and failed-job recovery. A managed service trades that operational work for usage charges and vendor constraints. Compare the complete cost of engineering time, infrastructure and incident response rather than the PDF request price alone.

Security checklist

  • Do not expose an unrestricted URL-to-PDF endpoint to the public internet.
  • Restrict outbound network access where reports do not need arbitrary sites.
  • Keep authentication headers, cookies and API keys out of logs and generated files.
  • Run browsers with an appropriate sandbox and a non-privileged account; follow the deployment guidance for your operating system and container.
  • Patch Chromium, Playwright, Puppeteer and system libraries on a schedule.
  • Set navigation, rendering and output-size limits to prevent runaway pages.
  • Review third-party fonts, images, scripts and embedded links before allowing untrusted HTML.

wkhtmltopdf: when to migrate

The comparison guide says wkhtmltopdf was archived in 2023 and warns about unpatched CVEs. Doppio describes it as abandonware without modern JavaScript and CSS support. Existing static templates may continue to render, so migration should be controlled rather than rushed blindly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Inventory every template, stylesheet, font, image and JavaScript dependency.
  2. Build a representative acceptance set containing short and long documents, tables, charts, custom fonts, images, page breaks and authenticated content.
  3. Render the set with the current engine and the candidate engine.
  4. Use visual diffs and text extraction to find clipping, missing assets, changed pagination and altered colors.
  5. Replace engine-specific CSS and unsupported JavaScript assumptions.
  6. Run security and load tests before switching production traffic.
  7. Keep a rollback path until the new renderer has passed real documents.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common failures and fixes

Symptom Likely cause Fix
Chart or totals are missing PDF was generated before the SPA finished rendering Wait for a report-ready selector or application event, then capture
Layout looks compressed or colors changed Print media is active or backgrounds are disabled Choose screen media when appropriate, enable print backgrounds and review print CSS
Web font falls back Font request failed, was blocked or had not loaded Make the font reachable to the worker, wait for readiness and inspect network errors
Images are blank Relative URLs, lazy loading or blocked requests Set a correct base URL, wait for lazy content and allow required image resources
Large tables split badly Conflicting break rules or engine-specific pagination Apply explicit break rules, keep critical rows together and test multi-page cases
Browser launch fails in production Missing browser binary, sandbox or system dependency Install and pin the supported browser, run with the deployment’s security model and capture launch logs
Jobs time out Slow third-party assets, infinite requests or an overly broad wait condition Set navigation and job timeouts, block unnecessary resources and wait on a precise application state
Private data appears in the wrong report Shared browser context or leaked cookies Use an isolated context per tenant or clear storage and credentials between jobs

Or skip the browser setup

For a one-call capture or PDF workflow, use ScreenshotNeo’s API documentation. This cURL request saves a WebP capture; the same service can return PDF output when you select that output in the documented request options.

Best Value
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Before the shot, ScreenshotNeo accepts cookie and consent banners and removes known consent platforms, newsletter popups and chat widgets; you can turn each cleanup step off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and each response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server gives AI agents such as Claude and Cursor the tools take_screenshot, get_page_info and capture_pdf.

Plan Included shots per month Price
Free 1,000 $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free, and every feature is included on every plan. Create a free ScreenshotNeo account to use 1,000 screenshots each month with no card.

FAQ

How should I benchmark two renderers fairly?

Use identical HTML, assets, viewport, paper size and readiness signal. Record cold-start and warm-browser timings separately, then compare visual output, extracted text, memory and failure behavior—not just the fastest successful run.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What belongs in a migration acceptance set?

Include at least one JavaScript chart, a long table, custom web fonts, lazy images, deliberate page breaks, a private/authenticated page and a document long enough to exercise repeated headers and footers.

When is asynchronous PDF generation worth adding?

Use an asynchronous queue when documents can outlive an HTTP request, jobs arrive in bursts or callers need retries and webhook-style completion. Keep the job identifier, source revision and renderer version with the result so a later regeneration is explainable.

Frequently Asked Questions

How should I benchmark two renderers fairly?

Use identical HTML, assets, viewport, paper size and readiness signal. Record cold-start and warm-browser timings separately, then compare visual output, extracted text, memory and failure behavior—not just the fastest successful run.

What belongs in a migration acceptance set?

Include at least one JavaScript chart, a long table, custom web fonts, lazy images, deliberate page breaks, a private/authenticated page and a document long enough to exercise repeated headers and footers.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When is asynchronous PDF generation worth adding?

Use an asynchronous queue when documents can outlive an HTTP request, jobs arrive in bursts or callers need retries and webhook-style completion. Keep the job identifier, source revision and renderer version with the result so a later regeneration is explainable.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.