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.

For C#, the most direct route is PuppeteerSharp’s PDF API: call PdfAsync to save a file, or use PdfDataAsync or PdfStreamAsync when you need the output in memory or as a stream. PuppeteerSharp uses print CSS media by default. If you need lower-level control, Chrome DevTools Protocol (CDP) provides Page.printToPDF, whose options control page geometry, backgrounds, headers and footers, and output transfer.

Choose a C# approach: PuppeteerSharp or direct CDP

Use PuppeteerSharp when you want a page-oriented C# API and a straightforward way to produce a file, byte array, or stream. Use a CDP client directly when you need to call protocol methods and map their parameters yourself. The protocol reference documents the controls available for Page.printToPDF; the exact calling syntax and generated types depend on the C# CDP client you choose.

There is no documented basis here for claiming one approach is faster or more reliable. Whichever route you select, check the API and protocol support against the PuppeteerSharp package and Chrome build you actually deploy. Some protocol fields are experimental.

Print a PDF with PuppeteerSharp

The following is the basic page-level pattern: launch headless Chrome, navigate to a URL, and save a PDF. Use the PuppeteerSharp package and browser-launch setup appropriate to your project; the API documentation describes IPage.PdfAsync(string) and the options overload.

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.
using PuppeteerSharp;

await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
    Headless = true
});

await using var page = await browser.NewPageAsync();
await page.GoToAsync("https://example.com");
await page.PdfAsync("output.pdf");

The snippet shows the core calls, not package installation or browser provisioning, which depend on your project and PuppeteerSharp version. Consult the PuppeteerSharp documentation for the package’s current launch and setup requirements.

Choose the output form

  • PdfAsync(path) writes the PDF to a file.
  • PdfDataAsync returns PDF bytes, useful when the caller will store, send, or process the result without first writing a local file.
  • PdfStreamAsync returns a stream for stream-based workflows.

PuppeteerSharp also documents options overloads for PDF generation. Use the options object when you need to control layout or printing behavior rather than relying on defaults.

Print CSS or screen CSS

PuppeteerSharp generates PDFs using print media by default. That means CSS inside @media print can affect the result. If the PDF should use screen styles instead, set the page’s media type before generating it:

await page.EmulateMediaTypeAsync(MediaType.Screen);
await page.PdfAsync("output.pdf");

Make this choice deliberately: screen media can preserve screen-oriented styling, while print media can apply print-specific layout and visibility rules.

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.

Control layout with CDP’s Page.printToPDF

Chrome DevTools Protocol’s Page domain exposes Page.printToPDF, described by the protocol reference as “Print page as PDF.” Its parameters let a client specify page geometry, print styling, header/footer behavior, page ranges, and transfer mode. A direct C# CDP call requires using the method and parameter types exposed by your chosen client; do not assume every client uses identical names or supports every field.

Page size, orientation, scale, and margins

The protocol documents paper width and height in inches, orientation, scale, and margins as separate controls. Its stated defaults are 8.5 by 11 inches for paper dimensions, scale 1, and margins of 1 cm. By default, printing covers all pages.

preferCSSPageSize determines how CSS @page sizing interacts with protocol paper dimensions. When enabled, the CSS page size takes precedence. Otherwise, content is scaled to fit the paper dimensions supplied to the protocol. Treat paper size, orientation, scale, and margins as independent layout decisions; changing one does not replace the others.

Backgrounds and header/footer templates

printBackground is false by default. Enable it if the design depends on background colors or graphics. Header and footer display is also off by default. When enabled, the protocol accepts HTML templates; documented placeholder classes include date, title, url, pageNumber, and totalPages.

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.

Page ranges and transfer mode

The protocol supports selecting page ranges and choosing an output transfer mode. These are protocol-level capabilities; confirm the generated parameter types and support in your CDP client and target Chrome build, especially for fields marked experimental in the live reference.

Use Chrome’s command line when C# is not required

For a quick command-line capture, Chrome’s Headless documentation describes --print-to-pdf, which saves a page to output.pdf in the working directory. To suppress the date/time header and URL/page-number footer, use --no-pdf-header-footer. An older flag name, --print-to-pdf-no-header, was previously used, so verify flag compatibility if targeting an older Chrome installation.

chrome --headless --print-to-pdf --no-pdf-header-footer https://example.com

Chrome also documents --timeout, which sets a maximum wait before capture even if loading continues, and --virtual-time-budget, which fast-forwards time-dependent JavaScript such as timers. These are CLI options, not automatically PuppeteerSharp API options.

Google’s Headless documentation says unified new Headless mode became available in Chrome 112. Because Chrome’s Headless article also contains historical information about defaults and planned changes, check the installed Chrome version rather than relying on old default-mode guidance.

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

Set up an output that matches the page

  1. Choose the capture route. Use PuppeteerSharp for a convenient C# page API; use direct CDP when you need protocol-level access and can map its types through your client.
  2. Choose the media type. Keep PuppeteerSharp’s default print media for print-specific CSS, or call EmulateMediaTypeAsync(MediaType.Screen) first when the PDF should reflect screen styles.
  3. Set geometry. Decide paper dimensions, orientation, scale, margins, and whether CSS @page sizing should take precedence.
  4. Set visual options. Turn on background printing when needed and configure header/footer templates only if the document calls for them.
  5. Choose output handling. Save directly with PdfAsync, or use the byte-array or stream API for downstream processing.
  6. Validate against deployed versions. Check the installed Chrome build, PuppeteerSharp package, and CDP client; verify experimental protocol options before relying on them.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common PDF issues

The PDF looks different from the browser

Check whether print CSS is active. PuppeteerSharp uses print media by default, so @media print rules may hide, resize, or restyle content. If the desired output is screen styling, emulate screen media before printing.

Background colors or images are missing

Background printing is disabled by default in the protocol. Enable printBackground through the PDF options or CDP parameter mapping supported by your library.

The page size or margins are unexpected

Check the effective paper width and height, orientation, scale, margins, and preferCSSPageSize. CSS @page sizing takes precedence when the preference is enabled; otherwise the content is fitted to the configured paper dimensions.

Unexpected date, URL, or page-number text appears

Header/footer display defaults to false for the protocol. If those elements appear, check the options your wrapper applies. For Chrome CLI use, --no-pdf-header-footer suppresses the command-line header and footer; confirm support on the Chrome version in use.

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.

A CDP option is rejected or unavailable

Protocol support can vary by Chrome build, and some fields are marked experimental. Compare the method and parameter types generated by your C# client with the protocol reference for the Chrome version you deploy.

JavaScript content is missing from a CLI capture

For command-line captures, Chrome’s --timeout caps how long it waits before capturing, while --virtual-time-budget fast-forwards timers and other time-dependent JavaScript. These controls affect CLI behavior; do not assume they map directly to PuppeteerSharp options.

Performance, reliability, and cost considerations

The documentation cited here does not establish a universal performance or throughput advantage for direct CDP versus PuppeteerSharp, nor does it provide deployment-specific reliability benchmarks. Measure the workflow under your own page mix and runtime conditions before making capacity assumptions. For reproducible results, record the Chrome build, PuppeteerSharp version, CDP client version, and the PDF options used.

Chrome’s headless CLI and a C# library are ways to run browser-based printing; no associated service pricing or per-PDF cost was published. Account for the browser runtime and infrastructure you choose to operate, and validate failure handling for your own workload rather than treating a successful local capture as a production guarantee.

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

Or skip the browser setup

If you need a screenshot or PDF through an API instead of managing a browser capture flow, ScreenshotNeo accepts one GET request with a URL and can return a PDF. Its cleanup steps accept cookie and consent banners like a visitor and remove 60+ known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in X-Page-Verdict and X-Billed headers. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for AI agents.

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 request parameters and output options. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Can PuppeteerSharp return a PDF without saving it to disk?

Yes. Use PdfDataAsync for bytes or PdfStreamAsync for a stream.

Does Chrome’s CLI timeout wait for every network request to finish?

No. The documented --timeout is a maximum wait; Chrome captures when it is reached even if loading continues.

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.