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

To print HTML to PDF, open the rendered page and use your browser’s print workflow, choosing a PDF destination if one is offered. For repeatable or automated output, use a browser automation API such as Playwright or Puppeteer. The right method depends on whether you need a one-off copy or a controlled, repeatable PDF.

Print a rendered web page to PDF in a browser

For an occasional page, the browser’s print workflow is usually the simplest route. The HTML Standard discusses a browser offering save-to-PDF as a print option, but the exact menu labels and availability vary by browser, operating system, and version. There is no single sequence that can be promised for every device.

  1. Open the page and wait for its content to finish loading.
  2. Invoke the browser’s print command.
  3. Choose a PDF destination if the print dialog offers one.
  4. Review the preview, paper size, orientation, margins, scale, and any background-graphics option available.
  5. Save the PDF, then open it and check that the important content appears on the expected pages.

The output reflects the page as rendered by the browser and its print styling, not necessarily the view on screen. A site may apply print-specific CSS that hides navigation, changes colors, or rearranges content. Page breaks, long tables, images, and interactive content can also affect the result, so inspect the saved file rather than assuming the preview or screen view guarantees a correct PDF.

Choose a workflow for recurring PDF generation

Workflow Best fit Output control
Browser print dialog An occasional page saved by a person Uses the browser’s print interface; available settings depend on browser and platform.
Playwright or Puppeteer Repeated, scripted, or application-integrated generation Code can set page format, margins, backgrounds, and other supported options. Behavior and defaults are specific to the selected API.
Adobe Acrobat web-page conversion Readers who already use Acrobat or want its documented conversion and layout controls Acrobat documents controls for items including page size, orientation, margins, scaling, fonts, colors, images, links, and PDF tags.

These workflows are not interchangeable in every detail. A browser dialog is convenient for a person, while automation makes the settings repeatable. Acrobat documents a separate configurable conversion workflow. The sources do not establish a comparative performance winner among them.

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.
#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.

Generate a PDF with Playwright

Playwright’s page.pdf() returns a PDF buffer and uses print CSS media. A page can therefore look different in the PDF than it does on screen. Its API exposes controls such as paper format, dimensions, margins, page ranges, scale, background printing, CSS page sizing, and tagged output. The documented defaults include printBackground: false, preferCSSPageSize: false, and tagged: false.

Here is a minimal Node.js example using Playwright. Install Playwright in your project first, then save this as an ES module file and run it with Node.js:

import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage();

try {
  await page.goto('https://example.com', { waitUntil: 'networkidle' });
  await page.pdf({
    path: 'page.pdf',
    format: 'A4',
    printBackground: true,
    margin: {
      top: '15mm',
      right: '15mm',
      bottom: '15mm',
      left: '15mm'
    }
  });
} finally {
  await browser.close();
}

Replace the example URL with a page you are authorized to access. For production work, choose a load condition appropriate to the page: waiting for network idle can be unsuitable for pages that maintain long-lived requests, while navigating only until the document loads may be too early for content rendered afterward. If the page uses client-side rendering, wait for a meaningful selector or application-specific ready state before generating the PDF.

Set page size, margins, and CSS sizing deliberately

Use the API’s paper format or width and height to specify the page geometry. Playwright’s preferCSSPageSize option lets CSS @page sizing take precedence over API paper format or dimensions; it defaults to false. Decide whether the document’s print stylesheet or your script owns page size, rather than allowing both to produce unexpected scaling.

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.

Margins are separate from the page dimensions. Set them explicitly when layout needs predictable printable space, and check pages with wide tables, code blocks, or headers and footers. The API’s page-range option can limit which pages are emitted when only part of a document is needed.

Include backgrounds and control print appearance

Playwright’s printBackground defaults to false. Turn it on when background fills or images carry necessary information; otherwise, leaving backgrounds off may be preferable for ink-conscious documents. CSS print rules still affect the result, so inspect both colors and contrast in the generated PDF.

Playwright also documents a tagged option for tagged PDF output, defaulting to false. Tagged structure can help with navigation and accessibility, but enabling the option alone is not an accessibility assessment or guarantee. Review the document’s structure and usability separately when accessibility matters.

Generate a PDF with Puppeteer

Puppeteer’s Page.pdf() generates PDF output using print CSS media. The API documentation identifies version 25.12.0 and notes that print colors may be modified by default. It points to the CSS property -webkit-print-color-adjust for requesting exact colors.

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.
import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
const page = await browser.newPage();

try {
  await page.goto('https://example.com', { waitUntil: 'networkidle0' });
  await page.pdf({
    path: 'page.pdf',
    format: 'A4',
    printBackground: true,
    margin: {
      top: '15mm',
      right: '15mm',
      bottom: '15mm',
      left: '15mm'
    }
  });
} finally {
  await browser.close();
}

Use the Puppeteer version installed in your application and consult its matching API documentation: defaults and supported settings can change across versions. Where exact color matters, test the resulting file rather than assuming the CSS property or API option guarantees identical color reproduction across viewers and printers.

Convert a web page with Adobe Acrobat

Acrobat documents a workflow for converting web pages to PDF with configurable conversion and layout settings. Its documented controls cover bookmarks, PDF tags, encoding, fonts, colors, multimedia, backgrounds, images, links, scrollable blocks, page size, orientation, margins, and scaling. This can be useful if Acrobat is already part of your workflow or its conversion controls suit the document.

Adobe’s help page, last updated September 23, 2025, describes these settings; it does not establish that Acrobat produces the same result as a particular browser automation engine. Review the output, especially if the page contains embedded or scrollable content, or if PDF tags are important. Tags can preserve HTML structure for easier navigation, but their presence does not by itself demonstrate full accessibility.

Make the HTML print-ready

For pages you control, a dedicated print stylesheet can make the PDF more predictable. The browser automation APIs described here use print media by default, so test styles intended for printing in that context. Consider which elements should remain, how content should break across pages, and whether backgrounds are essential. Do not infer that a screen design will paginate well without checking a generated PDF.

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
  • Keep essential text and images visible in print styles.
  • Check long tables, wide content, and large images for clipping or awkward breaks.
  • Choose whether page size comes from CSS @page rules or the automation API.
  • Decide whether background graphics and exact brand colors matter to the document.
  • When tagged output is required, inspect the resulting structure and assess accessibility beyond the existence of tags.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common HTML-to-PDF problems

The PDF is missing content that appears on screen

The page may not have finished rendering when capture began, or print CSS may hide the content. Wait for a meaningful element or application-ready state before generating the PDF, and inspect the page’s print styles. If content loads only after scrolling, the capture workflow may need to trigger that behavior before PDF generation.

Colors or background images are absent

In Playwright, background printing defaults to off; set printBackground: true when the backgrounds are needed. In Puppeteer, printing can modify colors by default; its documentation identifies -webkit-print-color-adjust as the CSS property for exact colors. Verify the saved PDF because viewers and print workflows may render color differently.

Text is clipped, scaled unexpectedly, or breaks badly

Check paper format, width and height, margins, scale, and CSS @page rules together. In Playwright, preferCSSPageSize controls whether CSS page size takes precedence over the API’s format or dimensions. Inspect wide elements and page breaks in the actual PDF.

The scripted capture hangs or fails to settle

A network-idle condition may never occur on a page with ongoing requests. Use a different navigation wait condition and then wait for a specific element or known application state. Ensure that browser cleanup runs even if navigation or PDF generation throws an error.

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.

The PDF has tags but is still difficult to use

Tagged output is a feature, not proof of accessible reading order, meaningful labels, or overall accessibility. Review the document with the requirements and tools appropriate to your use case.

Or skip the browser setup

For a screenshot or PDF through an API, ScreenshotNeo offers one GET request to return a screenshot or PDF. Its clean-capture steps can accept cookie/consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.

Example cURL request:

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

See the ScreenshotNeo API documentation for authentication and PDF options. Sign up for 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Does printing HTML to PDF save the page exactly as it looks on screen?

No. Print CSS and print-specific rendering can change layout, colors, or visible elements, so inspect the PDF.

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

Can I use browser automation to create only selected pages?

Playwright documents a page-ranges option for limiting the pages generated.

Does generating a tagged PDF make it accessible?

No. Tags can preserve structure, but their presence alone is not an accessibility guarantee.

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.