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

The error Protocol error (Page.printToPDF): Printing failed comes from Chromium’s PDF-printing operation, not from a separate Puppeteer PDF engine. Find out first whether a minimal page also fails, then check the browser revision, writable runtime paths, Linux dependencies, sandbox permissions, memory and serverless CPU. Only after those checks should you debug the page’s print CSS and assets.

What the error means

page.pdf() asks Chromium to run the DevTools Page.printToPDF command. Chromium uses the print CSS media type by default, so a page can look correct in a normal browser while its print layout fails or produces unexpected output. Fonts are awaited by default before the PDF is created.

If you intend to print the screen design, set await page.emulateMediaType('screen'). For color-sensitive output, use the CSS property -webkit-print-color-adjust: exact in the document or injected styles. Keep print media when the page has a deliberate print stylesheet.

Start with a minimal reproduction

Do not begin by changing launch flags at random. A small script identifies whether the failure belongs to Chromium/Puppeteer or to one document.

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.
#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.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: true });
  try {
    const page = await browser.newPage();
    await page.setContent('<!doctype html><html><body><h1>PDF test</h1><p>Hello</p></body></html>', {
      waitUntil: 'load'
    });
    await page.pdf({
      path: 'minimal.pdf',
      format: 'A4',
      printBackground: true
    });
  } finally {
    await browser.close();
  }
})();

Record the Puppeteer version, the Chromium revision (bundled or externally supplied), Node.js version, operating system, container image and every launch argument. If this script fails, investigate the runtime first. If it succeeds, compare the real page’s navigation, fonts, scripts, images, print CSS, templates and page size against the minimal case.

Check browser revisions before changing application code

A Chromium update can expose a regression even when your JavaScript is unchanged. In issue #10353, a report opened June 8, 2023 described roughly half of PDFs that worked in Chrome 113 failing in Chrome 114, with memory spikes before a crash. In issue #12470, opened May 21, 2024, Chrome for Testing win64-125.0.6422.60 timed out while win64-121.0.6167.85 succeeded; the report used Puppeteer 22.9.0, Node 18.15.0 and npm 9.5.0 on Windows.

  1. Run the minimal script with the revision currently used in production.
  2. Run exactly the same script with a known-good revision.
  3. Keep Node, the operating system, launch flags and page content constant while comparing.
  4. If the older revision works, pin it temporarily or upgrade deliberately after checking the Chromium/Puppeteer compatibility change. Do not silently change several variables at once.

The Puppeteer PDF guide identified as version 25.12.0 shows the basic sequence: launch, create a page, navigate, call page.pdf() and close the browser. Use that sequence as your control test.

Fix Windows Chrome permissions and sandbox setup

On Windows, downloaded Chrome files need the permissions required by Chrome’s sandbox. Puppeteer 22.14.0 and later attempts to configure them with Chrome’s setup tool. Older installations, or machines where setup still fails, may need the documented icacls repair against %USERPROFILE%/.cache/puppeteer/chrome.

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

After applying permissions, rerun the minimal PDF test under the same Windows account and service context that runs your application. A script that works interactively can still fail when launched by a service account with a different profile or cache directory.

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.

Make container paths writable

Chromium writes profile, configuration and cache data while it starts. A read-only container can therefore fail before page content matters. Point the XDG directories and the browser profile at writable locations, and verify ownership:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    headless: true,
    userDataDir: '/tmp/puppeteer-profile',
    env: {
      ...process.env,
      XDG_CONFIG_HOME: '/tmp/puppeteer-config',
      XDG_CACHE_HOME: '/tmp/puppeteer-cache'
    }
  });
  // create a page and call page.pdf() here
  await browser.close();
})();

Create those directories during image startup if necessary. The account executing Chromium must be able to read, write and create files in all three paths. Also check that the output directory for the PDF is writable; an otherwise healthy print operation can appear to fail when the destination cannot be created.

Verify Linux libraries, fonts and the sandbox

Minimal CI images often omit libraries Chromium needs. The troubleshooting guidance calls out packages including libnss3, libgbm1, GTK libraries, font packages, ca-certificates, xdg-utils and wget. Install the equivalents for your distribution, then confirm the same image can launch Chromium and render a text-only PDF.

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

Do not treat --no-sandbox as a universal fix. It weakens browser isolation and should be used only in a trusted, constrained environment where you understand the security trade-off. Prefer correcting user permissions and sandbox privileges. If you must test the flag, make it a controlled diagnostic change and remove it when the underlying environment is fixed.

Alpine requires a deliberate Chromium match

Chrome does not support Alpine out of the box. The troubleshooting record describes timeouts with the current Chromium package on Alpine 3.20 and cases fixed by downgrading to Alpine 3.19. Match the installed Chromium version to a Puppeteer version that supports it rather than assuming the newest package is compatible.

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.

When comparing Alpine images, hold the application code and URL constant. A successful test on Debian or Ubuntu does not prove that an Alpine image has the same libraries, fonts, sandbox behavior or browser revision.

Separate crashes, timeouts and page-specific failures

Intermittent failures or browser crashes

Inspect memory limits and concurrency. The Chrome 114 incident report observed memory spikes before crashes. Reduce the number of simultaneous pages, avoid launching a new browser for every request, and ensure the container or host has enough memory for Chromium plus your application. Capture the browser process exit and server logs so a crash is not misreported as a generic protocol error.

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

Cloud Run jobs that become extremely slow

Cloud Run can disable CPU after an HTTP response. If PDF work starts after sending the response, the process may run extremely slowly and look hung. Finish the Puppeteer work before responding, or configure CPU to remain allocated for background execution.

A fixed timeout on one Chrome for Testing build

Compare the exact browser revision and timeout behavior, as in the Chrome 125 versus 121 report. A longer timeout cannot repair a browser regression; it only delays the failure. Pin the known-good revision while you evaluate an upgrade.

Only then inspect the document and print settings

Once the minimal test works, make the real page deterministic:

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
  • Await navigation and the application’s data-loading completion before printing.
  • Wait for critical selectors and fonts; page.pdf() already waits for fonts, but late JavaScript can still replace content afterward.
  • Use emulateMediaType('screen') only when screen CSS is intended. Otherwise keep the default print media.
  • Check print styles for invalid layout rules, hidden content, enormous fixed elements and unsupported assumptions about viewport size.
  • Test header and footer templates separately. Remove them temporarily if the minimal document works but the templated document fails.
  • Remove page ranges temporarily, then add them back with a known valid range.
  • Resize or replace extremely large images and verify that every critical asset finishes loading.
  • Try a fixed paper format such as A4 before combining custom width, height, margins and landscape settings.

A useful diagnostic is to save the fully rendered HTML and a screenshot immediately before page.pdf(). If the screenshot itself is blank or incomplete, fix navigation or application rendering first; if it is correct but PDF printing fails, focus on print CSS, templates, page dimensions and the browser revision.

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

A production-oriented Puppeteer example

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    headless: true,
    userDataDir: '/tmp/puppeteer-profile',
    env: {
      ...process.env,
      XDG_CONFIG_HOME: '/tmp/puppeteer-config',
      XDG_CACHE_HOME: '/tmp/puppeteer-cache'
    }
  });

  try {
    const page = await browser.newPage();
    await page.goto('https://example.com', {
      waitUntil: 'networkidle0',
      timeout: 60000
    });
    await page.emulateMediaType('print');
    await page.pdf({
      path: 'page.pdf',
      format: 'A4',
      printBackground: true,
      preferCSSPageSize: true,
      timeout: 60000
    });
  } finally {
    await browser.close();
  }
})();

Replace networkidle0 with a selector-based readiness check when the site keeps analytics or other long-lived connections open. Do not add --no-sandbox unless your deployment is trusted and you have ruled out a proper sandbox configuration.

Quick diagnosis table

Symptom Most useful first check Likely remedy
Minimal page fails everywhere Browser revision, executable and runtime logs Compare a known-good revision; repair dependencies or permissions
Only Windows service fails Chrome cache/profile ownership and sandbox permissions Apply the Windows permission setup and use a writable service profile
Only read-only container fails XDG_CONFIG_HOME, XDG_CACHE_HOME, userDataDir and output path Move each to writable storage and verify ownership
Alpine times out Alpine and Chromium versions Use a supported pairing; Alpine 3.19 fixed the recorded 3.20 cases
Intermittent crash under load Memory limit, concurrency and browser exits Reduce parallel work and increase available memory
Screenshot is correct, PDF fails Print CSS, templates, ranges, images and paper options Simplify PDF options, then add settings back one at a time
Cloud Run work hangs after response CPU allocation timing Print before responding or enable CPU always
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If your goal is a dependable capture rather than maintaining Chromium, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF, while the service accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Each of those cleanup steps can be turned off.

Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

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

See the ScreenshotNeo documentation for output formats, PDF settings and the full option list. The service includes full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, paper size/margins/landscape/page ranges for PDFs, HTML/CSS-to-image, custom CSS and JavaScript, pre-capture clicks, hidden selectors, selector/delay/network-idle waits, request and resource blocking, custom headers/cookies/user agents/Authorization, timezone and geolocation, transparent backgrounds, image resizing, TTL-controlled caching, signed public image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API and an OpenAPI specification. Parameter names used by other screenshot APIs also work for easier migration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

All features are on every plan: 1,000 screenshots a month free with no card, then Starter is $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000 and Business $249 for 1,000,000. Yearly billing gives two months free. Start with the free ScreenshotNeo account.

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.

FAQ

Does page.pdf() use screen styles?

No. It uses print media by default. Call page.emulateMediaType('screen') when the screen stylesheet is the intended design.

Should I always add --no-sandbox?

No. It reduces isolation. Correct permissions and sandbox configuration first, and use the flag only as a controlled workaround in a trusted environment.

Why does a screenshot work while PDF printing fails?

Screenshot rendering does not exercise every print-only path. Compare print CSS, templates, page ranges, paper dimensions and oversized assets, then test a minimal PDF with the same browser revision.

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.

Can increasing the timeout fix a Chrome regression?

No. Compare browser revisions and pin or upgrade deliberately when a specific Chrome build is responsible. A longer timeout only waits longer for the same failure.

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.