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.

If a PDF generated by Chromium in Docker has different text size, line wrapping, or pagination than a PDF from local Chrome, first verify the font file actually selected in the container. Then align browser and Puppeteer versions, print CSS, font loading, locale, and every PDF option. A matching font-size declaration alone does not guarantee matching metrics: Linux fontconfig may substitute a different file, while Page.pdf() renders with print CSS by default.

Why identical CSS can produce different PDF text

CSS names a requested family; it does not prove that both systems resolve that name to the same font file. Fontconfig builds its configuration from the directories available in Linux and matches a requested pattern to the nearest available font. If the intended family or weight is missing in the image, Chromium can select a substitute with different glyph widths, ascent, descent, and spacing. Those metric changes alter line breaks and page counts even when the nominal font-size is unchanged. See the Fontconfig user documentation and its overview.

Other differences are independent of font substitution:

  • Puppeteer’s page.pdf() uses the print media type unless you explicitly emulate screen.
  • @media print, @page, margins, width constraints, transforms, letter spacing, and font weight can change layout.
  • The browser build, Puppeteer release, operating-system font files, locale, and device scale can all affect reproducibility.
  • A webfont may not have finished loading when the PDF is created.

No source establishes one universal Chrome-versus-Chromium bug or a guaranteed cross-platform pixel match. Treat the problem as an environment-diagnosis exercise.

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.

1. Freeze a reproducible comparison

Before changing CSS, record the complete inputs for both runs:

  • Exact Chrome or Chromium version and executable path.
  • Puppeteer version and the launch arguments used.
  • Docker base-image tag, installed font packages and copied font files.
  • HTML, stylesheets, locale, timezone, viewport, device scale factor and URL.
  • PDF options: paper size, margins, scale, header/footer behavior, and preferCSSPageSize.

Generate the same document twice with the same wait conditions. Keep one container image pinned rather than rebuilding from a floating latest tag. This does not prove that macOS Chrome and Linux Chromium will share metrics; it makes every later difference attributable to a known variable.

2. Verify the font Chromium resolves inside Docker

Inspect the requested family and files

Enter the running image and inspect the font directories configured for that distribution. Use the image’s fontconfig utilities (commonly fc-match and fc-list) to ask which file satisfies the family, style and weight used by your CSS. Compare the returned file and metadata with the machine producing the reference PDF. Checking only that a font package is installed is insufficient: the requested weight may be absent, or a different build of the same family may be selected.

Install the exact files your document needs

Copy licensed font files into a directory included by fontconfig, refresh the image’s font cache when that distribution requires it, and run the match query again. Include every weight and style referenced by the stylesheet. For Chinese, Japanese or Korean content, Puppeteer notes that additional font files may be necessary for complete glyph coverage; its troubleshooting guidance is at Puppeteer troubleshooting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Do not assume that equal family names mean equal metrics across operating systems or font builds. The available documentation explains discovery and matching, but does not quantify a universal cross-platform metric difference.

Confirm fonts after the page loads

In Puppeteer, inspect the browser’s computed styles and wait for the Font Loading API before capture:

await page.goto(url, {waitUntil: 'networkidle0'});
await page.evaluate(() => document.fonts.ready);
const details = await page.$eval('body', el => {
  const s = getComputedStyle(el);
  return {family: s.fontFamily, size: s.fontSize, weight: s.fontWeight, lineHeight: s.lineHeight};
});
console.log(details);

For a specific element, evaluate its computed font-family, font-size, font-weight, line-height and letter-spacing under the same media type used for printing.

3. Make print CSS and PDF options explicit

Check the print media tree

Because Page.pdf() generates print output by default, inspect every @media print rule and the @page block. A print rule can replace the screen family, size, line-height, width, display mode or margins. If your intended output is the screen design, call page.emulateMediaType('screen') before PDF generation; Puppeteer documents this behavior in the Page.pdf() method documentation.

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.

Use a deliberate PDF configuration

The following example makes the main layout controls visible. Adapt the format and margins to your document rather than using these values as a universal prescription:

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch({headless: true});
const page = await browser.newPage();
await page.setViewport({width: 1280, height: 900, deviceScaleFactor: 1});
await page.goto('https://example.com/report', {waitUntil: 'networkidle0'});
await page.emulateMediaType('print');
await page.evaluate(() => document.fonts.ready);
await page.pdf({
  path: 'report.pdf',
  format: 'A4',
  printBackground: true,
  margin: {top: '16mm', right: '16mm', bottom: '16mm', left: '16mm'},
  scale: 1,
  preferCSSPageSize: true,
  waitForFonts: true
});
await browser.close();

Puppeteer’s PDFOptions interface documents scale, paper formats, margins, preferCSSPageSize and waitForFonts. The latter waits for document.fonts.ready. Compare like-for-like values before experimenting with scale; changing scale can hide a font problem while changing every dimension.

Control CSS page size and margins

With preferCSSPageSize: true, CSS @page { size: ... } takes priority over API dimensions or format. If it is false, API dimensions can determine the sheet size. Ensure the two runs do not mix these policies, and check that CSS margins are not being combined unexpectedly with API margins.

Command-line generation

For direct headless use, Chrome documents --print-to-pdf and --timeout, plus a flag to omit generated headers and footers. Use the syntax supported by the exact browser build in your image and consult the Chrome Headless command-line reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

4. Inspect layout, not just the nominal size

Compare a representative element in both environments while emulating print media. Look for:

  • Computed family and actual weight, including synthetic bolding.
  • line-height: normal versus an explicit value.
  • Letter spacing, text transforms, width and max-width constraints.
  • CSS transforms or container scaling.
  • Different fallback fonts for punctuation, emoji or non-Latin scripts.

A historical Stack Overflow report found that an explicit numeric line-height improved single-line vertical sizing, but multiline text still wrapped into different numbers of rows. That anecdotal workaround is documented in the question and answer; test it only after verifying fonts and print settings, and do not treat it as a general fix.

5. A diagnostic order that avoids guesswork

  1. Render a minimal page containing the affected family, weights, scripts and a long wrapping paragraph.
  2. Capture it with identical HTML, viewport, locale, CSS and PDF options.
  3. Use fontconfig matching inside the container and correct missing or substituted files.
  4. Wait for webfonts and verify computed styles under print media.
  5. Align Chrome/Chromium and Puppeteer versions, then rebuild from a pinned image.
  6. Only then test explicit line-height, scale, margins or alternate page-size settings.
  7. Compare text wrapping, baseline position and page breaks, not merely the PDF viewer’s zoom percentage.

Common symptoms and fixes

Symptom Likely cause Action
Text is wider or wraps earlier Font substitution or different font build Run fontconfig matching in the container; install the intended file and weight.
Vertical position differs but wrapping matches Different line-height, ascent/descent or print rule Inspect computed print styles; test a numeric line-height on the affected component.
Only CJK or accented text changes Missing script coverage and fallback glyphs Install the required additional font files and verify each script.
Screen screenshot matches but PDF does not @media print or @page changes Inspect print CSS or explicitly emulate screen media.
PDF sometimes uses a fallback Capture begins before webfont loading completes Wait for document.fonts.ready and use Puppeteer’s waitForFonts.
Every element is proportionally larger or smaller Different PDF scale, page size or device setup Set format/dimensions, scale, margins and viewport explicitly.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reliability and production practices

  • Pin the browser executable, Puppeteer version, Docker image digest and font files.
  • Set locale and timezone deliberately; date, number and line-breaking output can otherwise vary.
  • Keep a golden HTML fixture and compare rendered PDFs after dependency upgrades.
  • Record response errors and font-loading failures rather than silently producing a fallback PDF.
  • Use one rendering image for all production jobs when deterministic output matters.

These controls improve repeatability; they do not establish that Linux Chromium will be pixel-identical to macOS Chrome. If exact identity is a requirement, render both reference and production documents in the same pinned environment.

Or skip the browser setup

ScreenshotNeo provides a website screenshot and PDF API when maintaining a browser image is unnecessary. One GET request can return PNG, JPEG, WebP or PDF, with controls for full-page capture, lazy images, CSS selectors, print-related dimensions, custom CSS and JavaScript, waits, headers, cookies, user agents, timezone, geolocation and PDF paper settings. Cookie and consent banners, newsletter popups and chat widgets are removed before capture. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

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

Use the API documentation at screenshotneo.com/docs/. cURL:

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.
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}`);

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.

Frequently Asked Questions

Does changing CSS font-size alone fix the mismatch?

Usually not. Verify the resolved font file, print CSS, font loading and PDF settings before changing the nominal size.

Should I use Chrome or Chromium in Docker?

Use one pinned browser build consistently. The available evidence does not identify a universally superior choice or guarantee cross-platform metric identity.

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

Why does a PDF have more pages after a browser upgrade?

A changed font build, print stylesheet behavior, scale, page size or line wrapping can move content across page boundaries. Compare those inputs systematically.

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.