Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk5 min

Why Are CSS Styles Missing in My HTML-to-PDF Output?

CSS missing in an HTML-to-PDF file? Check print styles, resource access, background options, and renderer-specific CSS support in a practical debugging order.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

CSS usually looks missing in an HTML-to-PDF file because the renderer is using print styles, cannot fetch a stylesheet or asset, is configured not to print backgrounds, or handles a CSS feature differently from your browser. Identify the rendering engine and version first, then check media mode, resource loading, PDF color settings, and feature support in that order. The exact cause depends on your renderer and document.

Why HTML-to-PDF output can differ from a browser

HTML-to-PDF is not a single rendering method. Tools such as Puppeteer, Playwright, and WeasyPrint have their own defaults and resource-fetching behavior. A PDF may be created successfully even when a stylesheet, font, or image failed to load, or when the engine applied rules that differ from the browser view.

As an Amazon Associate I earn from qualifying purchases.

Start by recording the library and exact browser or renderer version that creates the file. Then check the following causes one at a time; changing several settings together makes it harder to identify the failure.

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

Check whether the renderer uses print or screen CSS

Print output can use a different cascade from the page you see on screen. Look for @media print rules, print-only stylesheets, and selectors that hide or restyle elements. A rule that works in the browser may also be overridden by a more specific rule or a stylesheet loaded later.

#1 Best Overall
Plustek Mobile Scanner S410 Plus - Compact Portable Document Sheet-Fed
  • Digitize on the Go - Connect to your computer via BUS powered, eliminating the need for batteries or external power sources
  • Button Free Scanning Experience - The S410 Plus is an automatic scanning device, no need to push any buttons or click any screens, and automatically processes images and saves them to the designated folders
  • Versatile Paper Handling - Easily scan documents ranging from Letter and Legal sizes to business cards, plastic ID cards, invoices and receipts
  • Ultra compact & Lightweight - Weighing less than 1 lb, lighter than a bottle of mineral water, and its slim design is perfect for portability
  • Work smarter with Plustek Docaction - Built-in OCR allows you convert the files into editable, such as searchable PDF, excel or word. Seamless save to your local computer, FTP and even shared folder

Puppeteer’s page.pdf() documentation says it “Generates a PDF of the page with the print CSS media type.” Playwright also uses print media for PDF generation by default. For diagnosis, render once using screen media and compare. If that restores the expected appearance, inspect the print stylesheet and decide whether the intended PDF should use print or screen rules. Check the API for your installed version: these defaults and options can change.

Puppeteer: compare with screen media

await page.emulateMediaType('screen');
await page.pdf({ path: 'output.pdf' });

Playwright: compare with screen media

await page.emulateMedia({ media: 'screen' });
await page.pdf({ path: 'output.pdf' });

These are diagnostic examples. If the PDF should follow print-specific layout, do not switch to screen media merely to hide a print stylesheet problem.

Rank #2
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

Verify that stylesheets, fonts, and images load in the renderer

A URL that loads in your logged-in browser may not be reachable by the separate process generating the PDF. Check the requested URL and response for each stylesheet, font, and image from the renderer’s environment. Common causes include relative paths resolved against the wrong location, a missing base URL when HTML is supplied as a string, authentication requirements, and network restrictions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use absolute asset URLs, or supply a correct base URL if the API accepts an HTML string.
  • Check whether assets require cookies, authorization, or access to a private network.
  • Inspect renderer logs and warnings. A saved PDF does not prove that all linked resources loaded.
  • For fonts, confirm that the font file is reachable and that the renderer is configured to use it.

WeasyPrint documents that its URL fetcher loads external stylesheets and that a <base> element controls how relative URLs resolve. Its default HTTP client does not support advanced features such as cookies or authentication. If a resource depends on a logged-in session, use an appropriate authenticated/custom fetcher or make the resource accessible to the rendering process.

Rank #3
CZUR Lens800 Pro Portable 8MP A4 Document Scanner
  • Product Performance: 8MP Camera, 270 DPI, Resolution: 3264*2448
  • OCR Recognition: CZUR's software can digitize documents into Word/Excel/PDF/Editable PDF, recognizing 180+ languages. Please note that Thai, Hebrew, and Arabic are currently not supported. If you need the complete OCR language support list, please feel free to contact us for more details
  • Fast Scanning & Multi-Targeting: Ultra Fast Scanning Speed 1s/page and catch multiple targets (like business cards)
  • Maximal Capture Size A4: CZUR Lens can scan various types of documents; medical forms; certificates; contracts; business cards; letters, etc. up to A4 size (8.27'' *11.69''). Not recommended for very Glossy Paper
  • Multifunctional: CZUR Lens can work both as a scanner and webcam. To fold Lens to make it an HD webcam

WeasyPrint normally catches resource-fetch errors and emits a warning. While debugging, its documentation describes using a custom fetcher to make stylesheet errors fatal, so a missing resource cannot pass unnoticed. For API use of @font-face, its documentation calls for a shared FontConfiguration object for the CSS and HTML rendering path. Consult the relevant version’s WeasyPrint API reference and first-steps guide for the exact API.

Check PDF background and print-color settings

If text and layout look right but colored blocks, backgrounds, or other fills disappear or shift, inspect PDF options before assuming the stylesheet failed to load. Playwright documents printBackground as false by default and says printed colors are modified by default. Enable background printing when the PDF needs those graphics, and consider -webkit-print-color-adjust for exact colors where the renderer supports it. Browser print dialogs may also have a background-graphics setting.

Rank #4
CZUR Shine Ultra Smart Portable Document Scanner, Thin Book Scanner
  • Design and Speed: Work with Windows XP/7/8/10/11 AND macOS 10.13 or later. Not compatible with Android and iOS. Designed for A3&A4(11.69*16.53 & 8.27*11.75 inch) document, any objects smaller than A3 size can be scanned with Ultra-fast scanning speed, about 1 second per page. Perfect device to scan FLAT papers
  • USB Document Camera & Scanner: Work as both a document camera for remote teaching&learning compatible with ZOOM; Goole Meet and a document scanner to scan papers and convert/OCR files. OCR supports 180+ languages for text recognition. Please note that Thai, Hebrew, and Arabic are currently not supported. If you need the complete OCR language support list, please feel free to contact us for more details
  • Patented Flattening Curved Book Page Technology: Shine Ultra applies CZUR’s patented technology to flatten the curved surface after pixel transformation to flattening of the book page (Only suitable for thinner books, ET series is recommended for thicker books)
  • High Resolution & AI Tech: CMOS 13MP (4160*3120, A4≈340 AND A3≈245 DPI) camera. Smart Paging and Auto Cropping; Combine Sides; Stamp Mode; and Multiple Color Modes
  • Height Adjustable & Portable: 2-level height adjustable neck. 90 degree foldable and lightweight 4 lbs with foot pedal for convenient operation
await page.pdf({ path: 'output.pdf', printBackground: true });

Check the current API documentation for your installed version and the exact option names. The Playwright Page API and Puppeteer Page.pdf() API document their respective PDF and media controls.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Isolate CSS support and cascade problems

If only a few properties fail after resource loading and media settings are confirmed, reduce the document to a small HTML file containing the affected element and CSS. Render that file with the same engine and version. Check stylesheet order, selector specificity, inherited styles, and whether the property behaves differently in print media.

Best Value
CZUR ET24 Pro Professional Book Scanner, 24MP Document Camera
  • Flattening Technology Upgraded: ET24 Pro computer scanner applies CZUR’s latest technology that can flatten the 3D curved surface after pixel transformation to complete flattening of the book page
  • Camera Upgraded: 24MP HD camera, 320 DPI, 5696*4272 Resolution. Note: Very glare papers are NOT recommended
  • System Compatibility Upgraded: Document scanner for desktop/laptop, support macOS 10.13 or later AND Windows XP/7/8/10/11, also support Linux system(Only for Ubuntu 20.04 to 24.04)
  • CPU and Graphic Algorithm Library Upgraded: We have upgraded ET24’s CPU and CZUR’s Algorithm Library, ensures ET24’s stable performance; faster Graphic Processing Procedure; High OCR Accuracy
  • HDMI Supported: As a document camera, ET24 Pro support HDMI connection ensures faster & stable data transform

CSS behavior is renderer-specific, so browser success is not proof that a PDF engine supports the same feature. WeasyPrint documents stylesheet origins and cascade priority, and presentational hints are disabled by default unless explicitly enabled. If your page relies on legacy HTML presentation attributes, test the relevant presentational-hints option. Avoid adding !important broadly: it may conceal a cascade or loading problem rather than solve it.

The official documentation cited here does not provide a complete compatibility matrix for every engine and CSS feature. If a minimal example still fails, check the relevant engine’s documentation for that specific feature and version rather than assuming that a named renderer supports all modern CSS.

A practical debugging sequence

  1. Record the engine and version. Identify whether the PDF comes from Puppeteer/Chromium, Playwright/Chromium, WeasyPrint, or another renderer, and record its exact version.
  2. Inspect the HTML sent to the renderer. Confirm it contains the expected <link> or <style> and that the generated document is the one being converted.
  3. Compare print and screen media. Look at print rules and test the renderer’s screen-media option to determine whether the media type changes the result.
  4. Check resource requests and logs. Verify stylesheet, font, and image URLs from the renderer’s environment; inspect warnings, errors, and authentication requirements.
  5. Review PDF output options. Check background printing and print-color adjustment when the issue concerns visual fills or colors.
  6. Reduce the failure to a minimal example. If resources and media are correct, test the affected CSS feature and cascade in the same engine and version.
  7. Compare engines only if needed. Use the same minimal document and compare feature behavior, print handling, fonts, fetching/authentication, and control over backgrounds and colors.

Or skip the browser setup

If the goal is a clean visual capture of a web page rather than a print-layout PDF, ScreenshotNeo offers a one-request screenshot API. It is not a fix for a PDF renderer’s CSS behavior, and it returns an image unless you request PDF output.

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

For API options and output formats, see the ScreenshotNeo documentation.

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

ScreenshotNeo accepts cookie/consent banners and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The Free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.

Sign up free for 1,000 screenshots a month, with no card required.

Quick Recap

Bestseller No. 2
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
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
$75.00
Bestseller No. 3
CZUR Lens800 Pro Portable 8MP A4 Document Scanner
CZUR Lens800 Pro Portable 8MP A4 Document Scanner
Product Performance: 8MP Camera, 270 DPI, Resolution: 3264*2448; Single USB Connection: One single USB connection provides power & data
$99.00

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.