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

To save a JavaScript-rendered webpage as a PDF, let the page finish rendering in a browser before printing it. For a one-time copy, use the browser’s print-to-PDF option. For repeatable captures, use Chrome Headless or browser automation such as Playwright, and wait for the specific content you need—not just for navigation or a quiet network.

For a one-time PDF, print the rendered page from your browser

  1. Open the page in a JavaScript-capable browser and wait until the text, chart, image, or other content you need is visible.
  2. Open the browser’s print command and select its option to save or print to PDF.
  3. Save the file, open it, and check that the required content and page breaks are present.

Exact menu wording differs between browsers. This method captures the page after the browser has rendered it; saving the original HTML or fetching it without running its scripts may not include content generated after the initial load.

Use Chrome Headless for a repeatable command-line capture

Chrome Headless can print a page to a PDF file:

chrome --headless --print-to-pdf=output.pdf https://example.com/

The Chrome documentation also describes --timeout, which bounds the wait before capture. Chrome proceeds when that timeout is reached even if the page is still loading, so it does not guarantee that a particular script-generated element is ready. --virtual-time-budget can fast-forward timer-driven code, but likewise cannot guarantee that every required request or render has completed. Choose timing controls for the page’s behavior and inspect the PDF. The documented options are in the Chrome Headless command-line reference, last updated 2024-10-21; confirm flag availability and spelling against your installed Chrome version.

To remove Chrome’s default PDF header and footer, the reference gives --no-pdf-header-footer; older Chrome versions may use --print-to-pdf-no-header.

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.

Automate PDF generation with Playwright

Playwright’s page.pdf() uses print CSS by default. A page’s print stylesheet can hide or rearrange elements compared with its on-screen view. If you want screen media instead, call page.emulateMedia({ media: 'screen' }) before page.pdf(). The following Node.js example waits for a page-specific selector, then generates a PDF:

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch({ headless: true });
  const page = await browser.newPage();
  try {
    await page.goto('https://example.com/', { waitUntil: 'domcontentloaded' });

    // Replace this with a selector that appears when the content you need is ready.
    await page.waitForSelector('#rendered-content', { state: 'visible', timeout: 30000 });

    // Uncomment to use screen styles rather than print styles.
    // await page.emulateMedia({ media: 'screen' });

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

Install Playwright and its supported browser before running the script; for example, use npm install playwright and npx playwright install chromium in your project. Replace the URL and #rendered-content with the target page and a selector tied to the content you need. If no stable selector exists, wait for a page-specific text or application state instead.

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.

Choose the PDF appearance deliberately

  • Print or screen styling: leave the default print media for a print-oriented document. Emulate screen media when preserving the screen layout is more important.
  • Backgrounds and colors: Playwright’s printBackground defaults to false. Set it to true when background graphics matter. PDF colors are adjusted for printing by default; the page’s -webkit-print-color-adjust styling can request exact colors.
  • Paper and fit: format, width, height, margin, scale, and preferCSSPageSize control page sizing and layout. The documented scale range is 0.1 to 2, with a default of 1. Review for clipped content, awkward page breaks, and unexpected scaling.

See the official Playwright PDF API for the current options.

Why generic load and network waits can miss JavaScript content

A navigation event reports progress through navigation; it does not necessarily mean that a later API response, timer, or client-side render has produced the content you want. Playwright describes networkidle as discouraged for testing and recommends using assertions tied to the page’s expected state. A visible target element, expected text, or other application-specific signal is usually a more meaningful readiness condition than a fixed delay or a quiet network.

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

Puppeteer’s guide demonstrates page.goto() with waitUntil: 'networkidle2' followed by page.pdf(), and says PDF generation waits for fonts by default. That is the guide’s example, not a guarantee that every dynamically rendered site is ready. See Playwright navigation guidance and the Puppeteer PDF generation guide.

Or skip the browser setup

ScreenshotNeo can return a PDF through one GET request. Replace the example URL with the page you want to capture; see the ScreenshotNeo documentation for API options.

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
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.pdf

ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks or 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.

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

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

Troubleshoot an incomplete or awkward PDF

  • The JavaScript content is missing: Make the readiness condition target that content, such as a selector or expected text. A timeout or navigation completion can happen before rendering finishes.
  • Some content is still loading: Check whether the page waits on timers, API responses, lazy loading, or user interaction. Use an appropriate page-specific wait; Chrome’s timeout proceeds even if loading is incomplete.
  • The PDF looks different from the browser: Playwright prints with print CSS by default. Try screen media if you need the screen layout, and check the page’s print styles for hidden or repositioned elements.
  • Backgrounds or colors are absent: Enable printBackground in Playwright and inspect print color styling, including -webkit-print-color-adjust where exact colors are needed.
  • Text or sections are clipped or split badly: Review paper size, margins, scale, and page breaks; adjust those options and inspect the saved file again.
  • Chrome rejects a flag: Check the installed Chrome version and use the current documented spelling. The header/footer flag has an older alternative spelling for older versions.

Which approach should you use?

Approach Best for Main consideration
Browser print dialog A one-time saved copy Wait for the page content yourself and verify the saved PDF.
Chrome Headless A simple repeatable command-line capture Timeout and virtual-time controls do not prove a page-specific render is complete.
Playwright or Puppeteer Automated captures needing readiness and layout control Choose an appropriate page signal and account for print-versus-screen styling.
ScreenshotNeo An API or MCP-based capture without managing browser setup Requires an API key; review the PDF and the page-specific output you need.

Browser software and automation are the practical routes for this task; the available documentation does not establish a need for a physical product.

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.

Frequently Asked Questions

Does a webpage need JavaScript enabled to save as PDF?

Yes, if the content you need is created by scripts, the browser or capture tool must render those scripts before printing.

Can I make a PDF with Puppeteer instead of Playwright?

Yes. Puppeteer supports PDF generation; its official guide shows navigation followed by page.pdf(), but readiness still depends on the page.

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.

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