The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →The fastest way to improve Puppeteer PDF generation is to measure each stage first: browser startup, page creation, content loading, readiness waits, PDF rendering, and output I/O. Then tune the stage that actually dominates. Reusing a browser for repeated jobs and replacing an unnecessarily broad network-idle wait with a correct, document-specific readiness signal are useful hypotheses to benchmark—not guaranteed multipliers. Puppeteer’s documentation provides the APIs and defaults, but no controlled speed comparison or universal percentage gain.
Measure the pipeline before changing it
A PDF request can spend its time in several independent places. Time them separately so a change to waiting, Chromium lifecycle, or PDF options can be judged against the real bottleneck.
import puppeteer from 'puppeteer';
import { writeFile } from 'node:fs/promises';
const mark = (name, start) => console.log(`${name}: ${Date.now() - start} ms`);
const totalStart = Date.now();
const browserStart = Date.now();
const browser = await puppeteer.launch();
mark('launch', browserStart);
const pageStart = Date.now();
const page = await browser.newPage();
mark('new page', pageStart);
const loadStart = Date.now();
await page.goto('https://example.com/invoice/123', { waitUntil: 'domcontentloaded' });
mark('navigation', loadStart);
const readyStart = Date.now();
await page.waitForSelector('[data-pdf-ready="true"]');
mark('application ready', readyStart);
const pdfStart = Date.now();
const pdf = await page.pdf({ format: 'A4', printBackground: true, waitForFonts: true });
mark('page.pdf', pdfStart);
const writeStart = Date.now();
await writeFile('invoice.pdf', pdf);
mark('write', writeStart);
console.log(`total: ${Date.now() - totalStart} ms`);
await browser.close();
Run this against representative documents, not only a trivial page. Include small text-only files, large reports, image-heavy pages, and templates that load web fonts or client-side charts. Record cold and warm runs, median and tail latency, throughput, CPU, memory, PDF size, and visual/text correctness. Keep the Puppeteer and Chrome versions, operating system or container, concurrency, wait condition, and PDF options in the test record. No official Puppeteer source reviewed here publishes a speed multiplier, so any percentage you report should come from your own controlled workload.
Reuse Chromium for repeated jobs
Launching and closing Chromium for every document is simple and matches the standalone pattern in the official PDF guide. A service that generates many files can instead launch once, then create a page or isolated browser context per job. This may reduce repeated startup work, but it is an architecture hypothesis to benchmark rather than a documented guarantee.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problems#1 Best Overall
- INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
- COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
- ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
- HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
for (const document of documents) {
const context = await browser.createBrowserContext();
const page = await context.newPage();
try {
await page.setContent(document.html, { waitUntil: 'domcontentloaded' });
await page.waitForSelector('[data-pdf-ready="true"]');
await page.pdf({ path: document.output, format: 'A4' });
} finally {
await context.close();
}
}
} finally {
await browser.close();
}
Bound concurrency instead of creating unlimited pages. Add cleanup for every page and context, watch memory over long runs, and decide how to recover from a crashed browser. Context isolation is important when jobs contain different cookies, credentials, or tenant data. Compare this design with one-launch-per-document using the same files and options; measure cold-start latency, sustained throughput, memory growth, crashes, and isolation behavior.
Wait for the document’s real readiness condition
The official guide demonstrates waitUntil: 'networkidle2'. Puppeteer also exposes waitForNetworkIdle(), waitForSelector(), and waitForFunction(). Network-idle waiting includes at least the configured idle period, and pages with analytics, polling, advertisements, or open connections may never become meaningfully idle. A targeted condition can avoid unrelated traffic, but only if it proves that all content required in the PDF is ready.
Use an application-ready marker
await page.goto(url, { waitUntil: 'domcontentloaded' });
await page.waitForSelector('[data-pdf-ready="true"]', { timeout: 30_000 });
await page.pdf({ path: 'report.pdf', format: 'A4' });
Your application can set the marker after data, images, and charts finish rendering. If no marker exists, wait for a specific selector or function that represents the completed state.
Use network idle deliberately
await page.goto(url, { waitUntil: 'domcontentloaded' });
await page.waitForNetworkIdle({ idleTime: 500, concurrency: 0, timeout: 30_000 });
Do not replace a reliable readiness check merely to reduce elapsed time. Verify that fonts, images, asynchronous data, and chart canvases are present in the resulting PDF.
Understand fonts and print media
By default, Page.pdf() waits for fonts to load. The official guide states: “By default, the Page.pdf() waits for fonts to be loaded.” The current API reference lists waitForFonts: true and ties it to document.fonts.ready. This protects output from fallback fonts, but the documentation does not claim that disabling it is faster.
Rank #2
- CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
- INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
- LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
- PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
- ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴
await page.pdf({
path: 'report.pdf',
format: 'A4',
waitForFonts: true
});
Benchmark waitForFonts: false only when your template uses reliably available fonts, then compare typography and pagination. A small timing change is not useful if text reflows or branding changes.
PDF generation uses the print CSS media type by default. If your layout is designed for screens, set the media type explicitly:
await page.emulateMediaType('screen');
await page.pdf({ path: 'screen-layout.pdf', format: 'A4' });
Print CSS and color handling can change the output. Treat media selection as a correctness requirement, not a speed switch.
Reduce rendering work only when the output allows it
PDF options control what Chromium renders; the official reference does not quantify their relative speed. Test each change while keeping the document and environment constant.
| Option | Default or behavior | Possible trade-off |
|---|---|---|
printBackground |
false |
Enabling backgrounds may increase paint work but can be required for branding. |
pageRanges |
All pages | Printing selected pages can reduce output scope when full-document delivery is unnecessary. |
scale |
Configurable | Changing scale affects layout and readability; verify pagination. |
width, height, format |
Configurable paper geometry | Different geometry changes line wrapping and page count. |
timeout |
30,000 ms PDF timeout | A timeout permits longer operations; it does not make them faster. |
Remove unnecessary images, animations, third-party widgets, and data from the HTML itself when requirements permit. Do not assume that blocking a request or lowering image quality is safe without checking the finished PDF.
Rank #3
- SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
- INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
- KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
- PREMIUM SUPPORT - Strong technical expertise to solve issues faster
- THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
A complete, defensive generation function
import puppeteer from 'puppeteer';
export async function htmlToPdf(url, outputPath) {
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 30_000 });
await page.waitForSelector('[data-pdf-ready="true"]', { timeout: 30_000 });
await page.emulateMediaType('print');
await page.pdf({
path: outputPath,
format: 'A4',
printBackground: true,
waitForFonts: true,
timeout: 30_000
});
} finally {
await browser.close();
}
}
For production, add structured timings, cancellation, bounded concurrency, and a retry policy that distinguishes transient navigation failures from deterministic template errors. Keep browser and page lifecycles in finally blocks so a failed job does not leak resources.
Benchmark two key strategy choices
Fresh browser versus warm browser
- Use identical documents, options, and concurrency.
- Separate first-request latency from steady-state throughput.
- Track memory, crashes, cleanup time, and tenant isolation.
- Restart periodically if long-lived processes show growth or instability.
Network idle versus targeted readiness
- Measure elapsed waiting time and tail latency.
- Test pages with polling, analytics, slow images, fonts, and late charts.
- Compare PDF completeness, pagination, and text extraction.
- Choose the faster condition only when it is consistently correct.
Troubleshooting slow or incorrect PDFs
The job always reaches the timeout
Look for a selector that never appears, a JavaScript error, a blocked resource, or a page that keeps making requests. Add logging around navigation and readiness, confirm the marker is actually emitted, and use a targeted wait when network idle is unsuitable. Increasing the 30,000 ms timeout only allows more time; it does not remove the cause.
Fonts or layout differ from the browser
Keep waitForFonts: true, verify the font files are reachable in the deployment environment, and check whether print media rules are changing the design. Use emulateMediaType('screen') only when screen CSS is intentional.
Images or charts are missing
Wait for the application’s completed state rather than only domcontentloaded. Ensure lazy-loaded content is triggered, image URLs are accessible from the Chromium process, and canvases finish drawing before calling page.pdf().
Warm-browser performance degrades
Inspect page and context cleanup, bound concurrency, monitor memory over time, and restart the browser after a measured health threshold. Do not trade isolation for reuse.
Rank #4
- Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
- No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
- Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
- Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
- The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
PDF output is unexpectedly large or slow
Check image dimensions and compression, remove unnecessary backgrounds or pages when allowed, and compare file size and visual quality after each change.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or skip the browser setup
For a one-call screenshot or PDF service, ScreenshotNeo accepts a URL and returns a PNG, JPEG, WebP, or PDF. It removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, with the result identified by X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. Every plan includes all features, including full-page capture, element selection, device presets, custom waits, headers and cookies, PDF page ranges, caching, signed links, webhooks, bulk capture, and a usage API.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for PDF and option details. 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}`);
The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
FAQ
Does Puppeteer document an exact speed increase for these changes?
No. The official guide and API references describe behavior and options, not a controlled optimization benchmark.
Is a 30,000 ms timeout a performance target?
No. It is the listed default PDF timeout. A larger value permits slower work but does not accelerate it.
Should every service keep one Chromium process forever?
No. Warm reuse may help repeated jobs, but memory, crashes, cleanup, concurrency, and isolation must be measured for your workload.
Quick Recap
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.

