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.

To convert a webpage to PDF with print CSS, write a print-specific stylesheet using @media print to remove screen-only elements and @page to set paper size and margins. Use CSS fragmentation rules such as break-before and break-inside to guide pagination, then save the browser’s print preview as a PDF. For repeatable automated output, Puppeteer’s page.pdf() uses print CSS by default.

What print CSS does when a page becomes a PDF

Print CSS is a second presentation of the same document, intended for paper or a PDF produced through the browser’s print pipeline. Rules inside @media print affect that output without changing the normal screen view. The browser lays out the content for pages, then fragments it across those pages according to its paged-media behavior and the print settings.

This is different from simply taking a screenshot: a PDF created by printing is paginated, can preserve selectable text and links, and can span multiple pages. Your CSS influences the layout, but the browser’s print dialog or automation options may also determine paper size, margins, scale, and whether backgrounds print. Treat those settings and the target browser as part of the output, not as incidental details.

Start with a print stylesheet

Keep the screen design intact and add targeted rules for print. The example below is a starting point; replace selectors with those used by your site. It hides common screen chrome, resets clipping, and asks the browser to keep short visual units together where possible.

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.
@page {
  size: A4;
  margin: 16mm;
}

@media print {
  nav,
  header.site-header,
  footer.site-footer,
  .screen-only,
  button,
  .cookie-banner {
    display: none !important;
  }

  html,
  body {
    background: #fff;
    color: #000;
  }

  .content,
  article,
  pre,
  table {
    overflow: visible !important;
  }

  h1,
  h2,
  h3,
  figure,
  table {
    break-inside: avoid;
  }

  h2 {
    break-before: page;
  }
}

Set page geometry with @page

The @page rule defines the intended page size and margins. The sample requests A4 with 16 mm margins on each side. Change the size and margin values to match the document’s purpose and expected paper format. A browser’s print dialog or the options passed to an automated PDF call can override these values, so check the final output rather than assuming the CSS request won.

Remove elements that have no paper value

Navigation, sticky headers, cookie banners, chat widgets, interactive buttons, and screen-only controls often waste space or obscure content in a PDF. Hide those elements with selectors that match your site. Avoid hiding useful information just because it is interactive on screen: for example, a link’s destination or a disclosure’s content may matter in a reference document.

Reset overflow on containers that need to continue across pages. A screen layout may use overflow: auto or overflow: hidden to create a scroll region or crop decoration. In print, that can clip content rather than allow it to paginate. Likewise, large fixed or absolutely positioned regions can overlap or disappear when the content is split across pages. Prefer normal document flow for printable material.

Guide page breaks without over-constraining them

Use break-before, break-after, and break-inside to influence fragmentation. For example, break-before: page can start a major section on a fresh page, while break-inside: avoid can discourage splitting a heading, table, or figure. These are layout hints, not a promise that every element will remain intact. A table or figure taller than a page still has to split or overflow, and excessive forced breaks can create blank space.

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

Apply avoidance selectively. Keeping a short heading with the paragraph that follows is useful; forcing every large section to stay together can push substantial blank areas into the PDF. In the example, h2 { break-before: page; } is deliberately strong and may be too aggressive for a short article. Remove it or apply it only to major boundaries if the resulting PDF has unnecessary page breaks.

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.

Convert a page manually in a browser

  1. Add and load the print rules. Put the CSS in the site stylesheet or a stylesheet loaded by the page. Confirm the page actually receives the updated rules.
  2. Open the page in the browser you intend to use. Browser engines can paginate differently, so preview in the browser that will create the delivered PDF.
  3. Open Print and inspect the preview. Use the browser’s Print command, then select Save as PDF when available. The exact wording can vary by browser and operating system.
  4. Set the output options. Choose the paper size, orientation, margins, scale, and background-graphics behavior appropriate to the document. These settings may change or override the stylesheet’s requested geometry.
  5. Inspect every page before saving or distributing it. Look for clipped content, blank pages, broken tables, missing fonts, and headings stranded at the bottom of a page. Check backgrounds and links if they matter to the reader.
  6. Save the PDF and repeat after relevant changes. Text length, CSS, loaded assets, browser versions, and print settings can all change pagination.

Automate webpage-to-PDF conversion with Puppeteer

Puppeteer provides browser automation from JavaScript. Its page.pdf() method generates a PDF using the print CSS media type by default, so @media print rules apply without an extra media switch. The following ES module example opens a page, waits for network activity to settle, and writes an A4 PDF:

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();

try {
  const page = await browser.newPage();
  await page.goto('https://example.com/article', {
    waitUntil: 'networkidle0'
  });

  await page.pdf({
    path: 'article.pdf',
    format: 'A4',
    printBackground: true,
    margin: {
      top: '16mm',
      right: '16mm',
      bottom: '16mm',
      left: '16mm'
    }
  });
} finally {
  await browser.close();
}

Install Puppeteer in your project before running the script, and run it in an environment where its browser can launch. The page URL is an example; replace it with the page you are authorized to capture. The try/finally block closes the browser even if navigation or PDF generation fails.

Wait for the page you actually need

networkidle0 waits for network activity to become idle, which can be useful when stylesheets, fonts, or images are still loading after navigation. It is not a universal guarantee that every page is ready: pages with persistent network requests may never reach that state, and client-side content may render after the network quiets. For those pages, wait for a meaningful selector or an application-specific ready condition before calling page.pdf(). If the page is still missing content in the resulting PDF, investigate its rendering state rather than assuming that navigation completion means all assets are ready.

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

Choose print or screen media intentionally

Because page.pdf() uses print media by default, it is the right choice for a PDF designed with print CSS. If you specifically need the screen presentation instead, call await page.emulateMediaType('screen') before page.pdf(). That is an intentional change of output design; it does not make screen styles behave like a carefully prepared print layout.

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.

Understand colors and backgrounds

The sample sets printBackground: true so page backgrounds are included in the generated PDF. Browser printing may otherwise modify colors by default. The CSS property -webkit-print-color-adjust can request exact colors in supporting environments, but inspect the produced PDF in the actual runtime because color handling is browser-dependent.

Choose the right method for the job

Method Best fit Trade-off
Browser Print → Save as PDF A one-off conversion or a human-reviewed document. Fast to do, but depends on a person and the current browser’s print settings.
Puppeteer page.pdf() Repeatable generation in a script or application workflow. Requires a browser runtime and deliberate waits, settings, and PDF validation.
Print CSS A shared way to prepare page content for browser print flows. Pagination details can vary by browser engine and release.

In practice, print CSS is not a separate conversion engine: it shapes the content used by either the manual browser workflow or automated browser printing. Choose manual printing when review and convenience matter more than repeatability; use Puppeteer when you need a scriptable process and can control its runtime. For either method, the generated PDF—not a CSS preview—is the final acceptance artifact.

Validate layout and pagination in the target runtime

Support for paged-media features has historically varied across browsers. Current support for @page is broad across recent devices and browser versions, but individual properties and generated margin-box features may still differ. Chrome 131 added CSS-generated margin content for printed pages; that does not establish identical behavior across other engines or versions. Do not assume a page break or header/footer treatment will look exactly the same everywhere.

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

Use the same browser engine and settings that will produce the delivered PDF. At a minimum, test a short page and a long page, then inspect the actual PDF for:

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
  • Content cut off at the right edge or bottom of a page.
  • Unexpected blank pages or excessive gaps caused by forced breaks.
  • Headings separated from the sections they introduce.
  • Tables or code blocks split in difficult-to-read places.
  • Missing fonts, images, or background colors.
  • Links that should be available to readers and any visible source URLs.

Retest after changing content or CSS, and after changing the browser runtime or print settings. Pagination is affected by the engine, fonts, assets, and settings, so a CSS change that seems local can shift content onto different pages.

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

Troubleshoot common PDF problems

Content is clipped instead of continuing on the next page

Inspect ancestors of the clipped content for overflow: hidden, overflow: auto, fixed heights, or other screen-layout constraints. Reset overflow to visible in print for containers that should paginate. Also check for fixed or absolutely positioned content that was designed for a single viewport rather than a sequence of pages.

A heading appears alone at the bottom of a page

Review the break rules around that heading and the following content. Avoid breaking the heading itself, and consider keeping it with a short following block where supported by the layout. Avoid placing a forced page break before every heading: that can solve one stranded heading while creating blank space elsewhere.

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

The PDF has blank pages or large gaps

Look for repeated break-before: page or break-after: page rules, especially on sections that naturally fall at a page boundary. Remove unnecessary forced breaks and preview again. A rule intended for major chapter boundaries may be too broad when applied to every h2.

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.

A table or figure splits awkwardly

Use break-inside: avoid for smaller units that should stay together, then verify the result. Avoidance cannot keep an element larger than the printable page intact. For long tables or code blocks, prioritize readable splitting and ensure the content is not hidden by an overflow rule.

Fonts or images are missing

Make sure the required assets have loaded before PDF generation. Navigation completion alone may not be sufficient for delayed client-side rendering; wait for the relevant selector, resource, or application-ready state. Check that the target runtime can access the assets and inspect a PDF generated by that same runtime.

Colors or margins differ from the preview

Check the print dialog or Puppeteer options for page size, margins, scale, and background printing. These can override CSS requests. For Puppeteer, review format, margin, and printBackground; for manual printing, confirm the selected options in the dialog. Then compare the saved PDF, not just the preview.

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.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. Its one-call endpoint captures a webpage, and its available outputs include image formats and PDF. The example below shows the supplied webpage-capture request; use the PDF output settings documented for the endpoint when you need a PDF rather than the example WebP image. See the ScreenshotNeo API documentation for request details.

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

ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. The free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000. See ScreenshotNeo for product details, or sign up free for 1,000 screenshots a month with no card.

Frequently asked questions

Does Puppeteer use my print stylesheet automatically?

Yes. page.pdf() uses the print CSS media type by default. Switch to screen media with page.emulateMediaType('screen') only when the screen styling is deliberately required.

Can I force every heading to start on a new PDF page?

You can request that with break-before: page, but it may leave unnecessary blank space. Apply forced breaks only where a fresh page is genuinely useful and check the full document.

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

Why does a PDF look different in another browser?

Browser engines and releases can differ in paged-media behavior, while fonts, loaded assets, and print settings also affect pagination. Validate the PDF in the runtime that will create it.

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.