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

CSS is usually missing from an HTML-to-PDF file because the renderer is using print styles instead of screen styles, cannot fetch a stylesheet or asset, is configured not to print backgrounds, or handles a CSS feature differently from your browser. Identify the renderer and version first, then check media rules, resource loading, PDF color settings, and feature support in that order.

1. Identify the renderer and version

“HTML to PDF” is not one rendering engine. Your application may use Puppeteer with Chromium, Playwright with Chromium, WeasyPrint, a commercial converter, or another tool. Record the library and browser or engine version that actually generates the file: media defaults, resource fetching, and CSS support vary by implementation and version.

The steps below cover documented behavior in Puppeteer, Playwright, and WeasyPrint. They are not a complete compatibility chart for every renderer.

2. Check whether print CSS is replacing screen CSS

PDF output often uses print media rules. Puppeteer’s Page.pdf() documentation says it “Generates a PDF of the page with the print CSS media type.” Playwright documents the same default in its Page API. As a result, @media print rules, print-only stylesheets, or print-specific selectors can hide content or change layout even when the page looks correct in a regular browser tab.

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.

Compare screen and print output

As a diagnostic, generate a PDF once with screen media enabled. If that restores the expected appearance, inspect the print stylesheet and its cascade. Choose screen media only when the PDF is meant to reproduce the screen layout; otherwise, fix the print rules so the PDF has the intended design.

  • Puppeteer: call await page.emulateMediaType('screen') before await page.pdf().
  • Playwright: call await page.emulateMedia({ media: 'screen' }) before await page.pdf().

Check for print rules that set properties such as display, visibility, position, dimensions, margins, or colors, and verify that a print-only stylesheet is not overriding the intended rules.

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. Verify stylesheets, fonts, and images are reachable

A URL that works in your interactive browser may fail in a server-side renderer. The renderer may resolve a relative path against the wrong location, lack access to a private resource, or run in an environment with different network restrictions. A completed PDF file does not prove that every stylesheet or asset loaded successfully.

Check URL resolution and access

  • Inspect the actual URL requested for each stylesheet, font, and image from the rendering process—not just from your own browser.
  • Use absolute asset URLs, or supply a correct base URL when rendering an HTML string. WeasyPrint documents how a <base> element and its URL fetcher affect relative URLs in its API reference.
  • Confirm the renderer can reach the host, including any DNS, firewall, proxy, or TLS requirements in your environment.
  • Check whether a resource requires login or cookies. WeasyPrint’s default HTTP client does not support advanced features such as cookies or authentication; a protected resource may need a custom authenticated fetcher or an accessible URL. See its First Steps documentation.

Read renderer warnings and check fonts

Inspect renderer logs for failed requests instead of inferring success from the output file. WeasyPrint normally catches fetch errors and emits a warning; its documentation describes a custom URL fetcher that can make stylesheet errors fatal during debugging. For @font-face in the WeasyPrint API, use a shared FontConfiguration for the CSS and HTML rendering path, as shown in the first-steps guide.

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.

4. Check PDF background and color options

If text and layout are styled but colored panels, backgrounds, or exact colors are absent, the CSS may have loaded correctly while PDF-specific settings change the result. Playwright documents that printBackground defaults to false and that print colors are modified by default. Check its Page API for the options available in your installed version.

  • Enable background printing when the PDF should include background graphics; in Playwright, set printBackground: true in the PDF options.
  • When exact print colors matter, inspect support for -webkit-print-color-adjust in your renderer and set it deliberately. The property does not make an unsupported renderer behave like a browser that honors it.
  • If creating the PDF through a browser’s print dialog, check its background-graphics setting as well.

5. Isolate unsupported CSS or a cascade conflict

If only particular properties fail after media rules and resource loading have been checked, reduce the document to the smallest HTML and CSS example that still shows the problem. Render it with the same engine and version as production. Check stylesheet order, specificity, computed styles under the actual media type, and whether a later rule overrides the declaration.

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

Do not assume every browser feature is supported identically by every PDF engine. WeasyPrint, for example, disables presentational hints by default; its API reference documents an option to enable them, along with stylesheet origins and cascade behavior. If your output depends on legacy HTML attributes such as a color or alignment hint, check the engine’s documented setting rather than assuming those hints apply.

A blanket !important rule can obscure whether the real issue is a missing stylesheet, a different media query, or cascade order. Use it only when the design genuinely calls for that priority.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

6. Use this diagnostic order

  1. Confirm the input: inspect the exact HTML sent to the renderer and verify it contains the intended <link> or <style>.
  2. Record the engine: note the PDF library and browser or renderer version.
  3. Compare media: check the page under print media, then compare with screen media if the engine supports that diagnostic.
  4. Verify requests: inspect logs and confirm every CSS, font, and image URL resolves and is accessible from the renderer process.
  5. Check PDF options: review background printing and print-color adjustment if the styles load but fills or colors differ.
  6. Reduce the case: test the failing rule in a minimal document using the same engine and version, then check feature support and cascade behavior.

7. Compare engines only after isolating the cause

If a feature still behaves differently after checking media, resources, PDF options, and cascade, compare candidate engines with the same minimal document. Assess the specific CSS feature and engine version, print-media behavior, font handling, resource authentication, and controls for backgrounds and print colors. The documentation cited here does not establish a complete cross-engine compatibility matrix, so verify the feature you need against the chosen engine’s current documentation.

Or skip the browser setup

If your goal is to capture a web page as an image or PDF rather than troubleshoot your own renderer, ScreenshotNeo is a website screenshot API and MCP server for developers. A single request can return a PNG, JPEG, WebP, or PDF; its website screenshot API also offers controls for full-page capture, CSS, JavaScript, waits, and PDF output. It is an alternative capture service, not a fix for CSS in a PDF your own application already generates.

Example cURL request, adapted to capture a page as a PDF:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -d format=pdf -o shot.pdf

See the ScreenshotNeo documentation for request parameters. Cookie banners, popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. An MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000. Sign up for ScreenshotNeo free.

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

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.