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.

A commerce PDF can differ from its browser preview because the renderer may use print media, capture before fonts finish loading, scale content to a different paper size, alter colors, paginate long data differently, or omit headers and footers. Diagnose those decisions in order—fonts, media, page geometry, color, page breaks, then header/footer controls—using the deployed Puppeteer or Playwright version rather than assuming the screen view is authoritative.

1. Confirm fonts are ready before capture

When glyphs, line wrapping, or invoice totals move unexpectedly, verify that the intended web font loaded before PDF capture. Puppeteer’s PDF generation guide and its PDFOptions reference document Page.pdf() waiting for document.fonts.ready by default. The option controlling this is waitForFonts, whose documented default is true.

What to check

  • Confirm the CSS font-family names match the loaded font files and that the files are reachable from the renderer.
  • Check network and browser-console errors for failed font requests, incorrect MIME types, or cross-origin restrictions.
  • Inspect the capture call for an explicit waitForFonts: false; removing that override restores Puppeteer’s documented default.
  • Do not treat the default as a guarantee for every renderer or deployment. Verify the behavior of the browser automation version you run.
await page.pdf({
  path: 'invoice.pdf',
  waitForFonts: true
});

If the PDF still wraps differently after fonts are ready, compare the actual font used in the captured page with the browser preview; a fallback font can have different metrics even when the CSS looks correct.

2. Check print versus screen media

Puppeteer and Playwright document print CSS as the default media for PDF generation. A page that looks correct in a screen-sized browser window can therefore change when @media print rules apply. Start by finding every print rule that changes display, width, visibility, colors, or spacing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Why the screen preview is misleading

  • Print rules may hide navigation or change an invoice’s layout.
  • Print-specific widths and margins can alter line wrapping and page count.
  • Elements visible on screen may be intentionally suppressed for paper output.

Choose the intended media explicitly

Keep print media when the PDF is designed as a paper document. If the PDF should reproduce the screen design, use the renderer’s documented screen-media emulation route and test the result. Playwright exposes this through its Page API; Puppeteer documents the equivalent media-emulation workflow in its PDF guide.

// Playwright: use screen CSS when that is the intended design
await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'invoice.pdf' });

Do not infer the active media from the HTML alone. Record the media setting in the capture code and include both screen and print snapshots in regression tests.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

3. Resolve page-size and scaling precedence

Unexpected clipping, large white margins, or uniformly shrunken invoices usually indicate a conflict between CSS page geometry and API paper settings. Puppeteer’s PDFOptions defines preferCSSPageSize: when it is true, CSS @page size takes priority over API width, height, or format. Its documented default is false, so content is scaled to fit the selected paper size instead. Unspecified margins default to none in the documented options.

Compare both sources of geometry

Setting Where it is defined Effect to verify
@page { size: ... } Print CSS Defines CSS page dimensions when CSS precedence is enabled.
format Puppeteer PDF options Selects a named paper format when API sizing is used.
width and height Puppeteer PDF options Set explicit API dimensions; compare units with CSS dimensions.
preferCSSPageSize Puppeteer PDF options true lets CSS size take priority; documented default is false.
Margins CSS and API options Check both declarations; unspecified Puppeteer margins default to none.

Use one deliberate policy

  1. Decide whether the document is fixed-size (for example, a receipt) or should fit a standard sheet.
  2. Remove contradictory @page and API dimensions, or document which one wins.
  3. If CSS controls the size, set preferCSSPageSize: true and test the deployed Puppeteer version.
  4. If the API controls the size, set format or explicit dimensions and inspect scaling at the page edges.
await page.pdf({
  path: 'invoice.pdf',
  format: 'A4',
  preferCSSPageSize: false,
  margin: { top: '12mm', right: '12mm', bottom: '12mm', left: '12mm' }
});

4. Separate color adjustment from background printing

Missing brand panels and shifted colors involve two different controls. Playwright documents that PDF colors are modified for printing by default and points to -webkit-print-color-adjust when exact rendering is needed. Puppeteer separately exposes printBackground, which defaults to false. Turning on one does not automatically configure the other.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Diagnostic sequence

  1. Inspect whether the colored element is a CSS background or a foreground color.
  2. For Puppeteer, check printBackground; set it to true when backgrounds are required.
  3. Check print color adjustment in the stylesheet if exact color reproduction matters.
  4. Open the saved PDF in more than one viewer; distinguish a PDF rendering difference from a viewer’s display profile.
await page.pdf({
  path: 'invoice.pdf',
  printBackground: true
});

Use color-adjustment rules cautiously: “exact” browser output is not the same as calibrated commercial printing, and the final PDF remains the authority for acceptance tests.

5. Inspect page-break outcomes with realistic commerce data

Pagination failures often appear only with production-shaped content. Test long product descriptions, many line items, multi-line addresses, tax notes, and totals placed near a page boundary. Inspect whether rows split, overflow, or leave an unexpectedly large blank area.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

A repeatable test matrix

Fixture What to observe
One short invoice Baseline margins, page size, fonts, and totals.
Many line items Row continuity, repeated headings, and total placement.
Long descriptions Wrapping, row growth, and content crossing a page boundary.
Long billing and shipping addresses Column expansion and collision with totals.
Totals near the boundary Whether totals remain visible, move cleanly, or create excess whitespace.

Interpret results by symptom

  • Rows split: determine whether the target browser and version honor the break-related CSS you are using; do not assume a universal rule.
  • Content overflows: check fixed heights, absolutely positioned elements, and width changes under print media.
  • Large blank regions: look for keep-together behavior, oversized blocks, or a footer reservation.
  • Different page counts between releases: compare browser version, fonts, media mode, and paper settings before changing CSS.

Detailed universal CSS paged-media behavior is not established here, so treat break properties as browser-version-dependent and validate them with these representative fixtures.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Check header and footer controls

Puppeteer exposes displayHeaderFooter and separate header and footer template options in its PDFOptions reference. A missing date, title, or page number can therefore be an option or template problem rather than a layout problem.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Verify the complete chain

  1. Confirm displayHeaderFooter: true is enabled.
  2. Inspect the header and footer template strings for the expected content and valid markup.
  3. Check that the template’s reserved space does not collide with the document body.
  4. Recheck option names and supported template tokens against the Puppeteer version deployed.
await page.pdf({
  path: 'invoice.pdf',
  displayHeaderFooter: true,
  headerTemplate: '<span class="header">Invoice</span>',
  footerTemplate: '<span class="footer">Page <span class="pageNumber"></span></span>'
});

A practical capture checklist

  1. Log the Puppeteer or Playwright version and the browser executable used.
  2. Wait for fonts and confirm the intended family is actually applied.
  3. Record whether PDF capture uses print or screen media.
  4. Choose CSS or API page sizing and set precedence deliberately.
  5. Configure background printing and color adjustment independently.
  6. Render realistic multi-page invoices and inspect every boundary.
  7. Enable and test header/footer templates when they are part of the document contract.
  8. Archive representative PDFs so a browser upgrade can be compared against a known result.

Choosing a browser-based rendering workflow

When comparing Puppeteer, Playwright, or a hosted HTML-to-PDF architecture, evaluate the same controls: print-media defaults, font-readiness control, CSS @page precedence, color and background settings, header/footer support, and page-break behavior on long documents. Hosted rendering can reduce browser operations, but its exact defaults are provider- and version-specific; require a reproducible test invoice before moving production capture off your own infrastructure.

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.