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

Start by isolating the final headerTemplate, validating the decoded image, and comparing the exact Puppeteer and Chrome versions. A 2025 Puppeteer report found a Base64 JPEG header that worked with Puppeteer 24.3.0 but failed after upgrading to 24.4.0. A maintainer reproduced a print failure in then-current stable Chrome and said it seemed fixed in Chrome Canary, but no stable release containing that fix was identified. Treat this as a version-sensitive browser regression until your own minimal reproduction proves otherwise.

What Puppeteer actually does with a PDF header

Puppeteer enables headers only when displayHeaderFooter: true; the documented default is false. The headerTemplate value is an HTML string, and Puppeteer documents special classes such as date, title, url, pageNumber, and totalPages. See the PDFOptions documentation (the page was marked version 25.12.0 when accessed).

The API documentation does not promise that a header inherits the page’s resource context or executes JavaScript. A separate historical issue reported that scripts in header and footer templates did not run. Keep the header self-contained: use a literal image source and inline styles rather than page CSS, DOM lookups, or a script that converts the image at print time.

1. Inspect the exact final data URI

Log what is really passed to page.pdf()

Template systems often leave a token such as {{logo}}, add a second prefix, or insert a newline into the payload. Log the final template after interpolation (redact the image data in production), or save it to a protected diagnostic file. Confirm that the source begins with exactly one appropriate prefix:

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.
  • PNG: data:image/png;base64,
  • JPEG: data:image/jpeg;base64,
  • WebP: data:image/webp;base64,

The Base64 portion should contain only the encoded bytes. Remove accidental quotes, whitespace, line breaks, and an extra data:image/...;base64, prefix. If your variable already contains a complete data URI, do not prepend another one.

Validate the decoded bytes independently

A string can look Base64-shaped while decoding to a corrupt or non-image file. Decode it before involving Chromium and open the result with an image viewer or an image-validation utility. Check that the MIME type you declare matches the actual bytes. For example, a JPEG payload labelled as PNG can fail even though the Base64 alphabet is valid.

2. Reduce the PDF to a minimal reproduction

Use a plain body, one image, a top margin large enough for the header, and no application framework. This diagnostic pattern is intentionally small; it is not a guaranteed workaround for the reported regression.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.setContent('<main><h1>Diagnostic PDF</h1><p>Body content</p></main>');

    // pngBase64 must contain valid PNG bytes encoded as Base64,
    // without a data-URI prefix.
    const pngBase64 = process.env.LOGO_BASE64;
    if (!pngBase64) throw new Error('Set LOGO_BASE64 to the encoded PNG bytes');

    await page.pdf({
      path: 'diagnostic.pdf',
      format: 'A4',
      displayHeaderFooter: true,
      headerTemplate: `
        <div style="width:100%; margin:0; padding:0;">
          <img
            src="data:image/png;base64,${pngBase64}"
            style="display:block; width:110px; height:auto;"
            alt="Company logo"
          />
        </div>
      `,
      footerTemplate: '<span class="pageNumber"></span> / <span class="totalPages"></span>',
      margin: { top: '1in', bottom: '0.5in' }
    });
  } finally {
    await browser.close();
  }
})();

Replace the PNG prefix and dimensions when testing JPEG or another format. Keep the original failing image data unchanged for one run, then test a known-good tiny PNG. That A/B test separates image corruption from browser/template behavior.

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.

3. Record both Puppeteer and Chrome versions

Do not treat a Puppeteer version as a Chrome version. Record the package version, the executable actually launched, its browser version, Node.js version, operating system, image format, final header HTML, and all PDF options. A deployment may launch a system Chrome while local development uses Puppeteer’s bundled browser.

Issue #13726, filed in 2025, describes Node 22.14.0, npm 10.9.2, and Windows; the reporter said the JPEG worked on Puppeteer 24.3.0 and failed beginning with 24.4.0. This is an individual report, not a universal compatibility promise.

Print the versions from the same process that generates the PDF:

console.log({
  puppeteer: require('puppeteer/package.json').version,
  node: process.version,
  executable: await browser.executablePath(),
  browser: await browser.version(),
  platform: process.platform
});

Run the minimal case against the last known-working dependency and the failing dependency, while keeping the image and template byte-for-byte identical. Then repeat with the actual production executable.

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

4. Use Canary as a diagnostic comparison, not a production guarantee

On April 4, 2025, Puppeteer collaborator OrKoN reported reproducing “Printing failed” with current stable Chrome and said it “seems to be fixed with canary” in the discussion of issue #13726 (comment). The comment does not identify a Canary build or a stable release containing the change.

Therefore, testing Canary can reveal an upstream Chrome regression, but it is not evidence that a particular current stable version is fixed. Do not pin production to Canary solely on this observation. Verify the exact release you intend to deploy and retain a regression test.

5. Keep header markup deliberately self-contained

  • Use an inline src data URI and inline dimensions.
  • Give the header enough top margin; otherwise the image can be clipped or overlap body content.
  • Use display:block to avoid inline baseline gaps.
  • Start without external fonts, stylesheets, relative paths, CSS background images, or JavaScript.
  • Confirm that your templating layer escapes neither the URI nor the surrounding quotes.

A 2018 issue recorded a relative path such as /public/images/logo.png rendering as a gray outline (#2443). That is a historical report, not proof that every relative URL fails or that every Base64 image succeeds. If you use a file or network URL after the minimal test, verify its origin, permissions, and load timing separately.

6. Compare the failing and working environments

Variable What to capture Why it matters
Puppeteer Exact npm package version The reported break appeared at a package-version boundary.
Browser Executable path and Chrome/Chromium version Puppeteer and the launched browser have separate release histories.
Image Format, byte length, decoded validity, URI prefix Separates bad bytes and MIME mismatches from print behavior.
Template Final HTML string after interpolation Finds leftover tokens, duplicate prefixes, whitespace, and quoting errors.
Runtime Node version, OS, launch flags, PDF options The issue report was Windows-specific; do not generalize it to every OS.

Troubleshooting by symptom

The image is absent but the PDF is otherwise valid

Check displayHeaderFooter, the top margin, the final src, and whether the decoded bytes open independently. Replace the production image with a tiny known-good PNG. If that works, repair the source bytes or MIME label.

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

The PDF call throws “Printing failed”

Run the minimal reproduction with the same executable and compare Puppeteer/browser versions. Remove scripts, external resources, and complex CSS from the header. Test a controlled Canary comparison only to identify a possible upstream browser regression; do not claim a stable fix without release-specific verification.

A gray outline or broken-image marker appears

Inspect relative URLs and resource context, then switch temporarily to a literal data URI. Confirm there is no second prefix and that the format declaration matches the bytes. The historical relative-path report is evidence to investigate, not a blanket rule.

It works locally but fails in deployment

Compare the actual executable path, browser version, image bytes, final template, OS, Node runtime, launch flags, and PDF options. Ensure secrets or environment variables did not produce an empty Base64 value. Preserve the generated template and a hash of the image for safe comparison.

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

Performance, reliability, and safe rollout

Inline images avoid a separate network request, but large Base64 strings enlarge the HTML passed to Chromium and every generated document. Resize logos to their intended print dimensions and avoid embedding unnecessary metadata. A deterministic minimal test should run in CI against the browser executable you deploy, asserting that the PDF is produced and that a rendered-page inspection or image extraction finds the logo.

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.

When upgrading Puppeteer, test the old and new versions with identical inputs before changing application code. If a browser regression is suspected, record the exact versions and keep a temporary pin only with a documented review date; the available issue discussion does not establish a permanently safe version.

Or skip the browser setup

If your requirement is simply to obtain a clean screenshot or PDF of a URL rather than control Puppeteer’s print pipeline, ScreenshotNeo provides a website screenshot API and MCP server. One request can return PNG, JPEG, WebP, or PDF, with options for full-page capture, lazy-loaded images, CSS-selector elements, custom CSS and JavaScript, waits, headers, cookies, user agents, PDF margins and page ranges.

Its cleanup step accepts cookie-consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. An 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 parameters and formats. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

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

FAQ

Does Base64 guarantee that a header image will print?

No. It only embeds encoded bytes. The bytes, MIME label, final template, PDF settings, and browser implementation can still cause failure.

Should I upgrade to the newest Puppeteer?

Not as an automatic fix. The documented report identifies a 24.3.0-to-24.4.0 change, while the Chrome discussion does not name a stable release with a correction. Reproduce with your exact versions first.

Can JavaScript in headerTemplate repair the image?

Do not rely on it. A historical issue reported that header/footer scripts were not evaluated. Build the final image URI before calling page.pdf().

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.