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

If an element is missing from a Puppeteer PDF, first check whether it exists in the page before calling page.pdf(). If it does, inspect its computed styles with print media active: PDF generation uses print CSS by default. Then check whether the missing item is a CSS background, whether the page and its fonts finished loading, and whether PDF page geometry is clipping or moving the content.

Start by finding out whether the element exists

“Missing” can mean several different things: the application never rendered the element, print CSS hid it, a background was omitted, an asset failed to load, or the content was pushed outside the visible page area. Diagnose those cases in that order rather than changing PDF options at random.

Before page.pdf(), query the target element and inspect its text, computed styles, dimensions, and bounding box. Also check its ancestors: a child may be visible but clipped by an ancestor’s overflow, hidden by a parent, or positioned outside the page.

const selector = '.invoice-total';

const state = await page.$eval(selector, (el) => {
  const style = getComputedStyle(el);
  const rect = el.getBoundingClientRect();
  return {
    text: el.textContent?.trim(),
    display: style.display,
    visibility: style.visibility,
    opacity: style.opacity,
    width: rect.width,
    height: rect.height,
    x: rect.x,
    y: rect.y,
    documentFontsStatus: document.fonts.status,
  };
});
console.log(state);

If $eval throws because it cannot find the selector, the node is absent at that moment. Investigate navigation, data fetching, client-side rendering, or conditional UI logic before adjusting print settings. If the node is present but has zero dimensions or is hidden, continue with CSS and layout checks.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Epson EcoTank ET-2800 Wireless Color All-in-One Supertank Printer - Black
  • INNOVATIVE CARTRIDGE-FREE PRINTING — No more dealing with lots of tiny ink cartridges; With this wireless document and photo printer each ink bottle set is equivalent to about 90 individual cartridges²
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; When you choose this combination printer, scanner and copier you can print up to 4,500 pages black/7,500 color³
  • COLOR PRINTING — Up to 2 years of ink in the box4 (and with every replacement ink set) for fewer out-of-ink frustrations
  • ZERO CARTRIDGE WASTE — By using an Epson EcoTank printer you can help reduce the amount of cartridge waste ending up in landfills
  • HOME PRINTER DESIGNED FOR RELIABILITY — The Epson EcoTank ET-2800 All-in-One Supertank Color Printer creates vivid, detailed prints and documents thanks to Micro Piezo Heat-Free Technology; Fire off 10 ISO pages per minute1 to easily finish large jobs

Check print CSS before changing the PDF options

Puppeteer’s Page.pdf() renders using the print CSS media type by default. A page that looks correct in a normal browser tab may have different print rules: an element can be hidden, repositioned, clipped, or restyled. See the Page.pdf() API documentation.

Inspect matching @media print rules and their effects on the element and its ancestors. Pay particular attention to display: none, visibility: hidden, positioning, overflow, and page-break rules. You can inspect a selector under print media before producing the PDF:

await page.emulateMediaType('print');
const printState = await page.$eval('.invoice-total', (el) => {
  const s = getComputedStyle(el);
  const r = el.getBoundingClientRect();
  return { display: s.display, visibility: s.visibility, x: r.x, y: r.y, width: r.width, height: r.height };
});
console.log(printState);

If the intended output is specifically a screen-style rendering rather than a print layout, switch media before generating the PDF:

await page.emulateMediaType('screen');
await page.pdf({ path: 'output.pdf' });

This selects screen media rules; it does not make a screen layout automatically suitable for paper. For reports and documents, fixing the print stylesheet is usually more predictable than forcing screen styling.

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

Restore CSS backgrounds when those are what is missing

Puppeteer’s printBackground option defaults to false. Set it to true when the omitted content is a CSS background graphic, such as a colored panel or a background image:

Rank #2
Sale
Epson EcoTank Photo ET-8550 Wireless Wide-Format All-in-One Tank Printer
  • CARTRIDGE-FREE PRINTING — Print lab-quality photos, graphics and creative projects; Get vibrant colors and sharp text with Epson's high-accuracy printhead and Claria ET Premium 6-color inks
  • INK BOTTLES — Save on photos1 and creative projects with affordable in-house printing; All-in-one printer allows you to print 4" x 6" photos for about 4 cents each vs. 40 cents with traditional ink cartridges1
  • LESS FREQUENT INK REPLACEMENT — Replacement ink bottles don't have to be changed nearly as often as ink cartridges¹; Printer, scanner and copier lets you print up to 6,200 color pages³
  • PRINT FOR LONGER — Up to 2 years of ink in the box² (and with every replacement ink set) for fewer out-of-ink frustrations with this wireless printer
  • ZERO CARTRIDGE WASTE — Epson EcoTank printer helps reduce the amount of cartridge waste ending up in landfills; Cartridge-free printer uses high-yield ink bottles; Each replacement ink bottle set is equivalent to about 100 individual ink cartridges⁴
await page.pdf({
  path: 'output.pdf',
  printBackground: true,
});

This option affects background printing; it cannot restore a DOM element that was never rendered, is hidden by print CSS, or lies outside the printable area. The available PDF settings, including defaults, are documented in the PDFOptions interface.

Wait for the application’s render condition and verify fonts

Navigation completing does not necessarily mean an application has finished drawing the content you need. Puppeteer’s PDF guide demonstrates page.goto() with waitUntil: 'networkidle2', but a quiet network is not proof that client-side rendering or delayed application work is complete. Prefer a selector that appears only when the relevant content is ready, or an explicit readiness signal exposed by the application.

await page.goto('https://example.com/report', {
  waitUntil: 'networkidle2',
});
await page.waitForSelector('[data-report-ready="true"]', {
  visible: true,
});
await page.pdf({ path: 'report.pdf', printBackground: true });

Replace the example URL and readiness selector with those used by your application. If you control the page, a dedicated attribute or flag set only after data and rendering are complete is more reliable than waiting for an arbitrary fixed delay. A timeout can conceal a race on one run and fail on another.

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

Puppeteer’s PDF generation waits for fonts by default through waitForFonts. That does not establish that every remote font request succeeded or that a font is available in the browser environment. Check failed requests and console errors, inspect document.fonts.status, and, when diagnosing typography, wait for the document font set:

await page.evaluate(() => document.fonts.ready);
console.log(await page.evaluate(() => document.fonts.status));
await page.pdf({ path: 'report.pdf', printBackground: true });

Font problems more often change text wrapping, line height, or pagination than remove a DOM node. Those layout changes can nevertheless make nearby content appear clipped or shifted. For the documented PDF behavior and workflow, see Puppeteer’s PDF generation guide.

Rank #3
HP Smart Tank 5000 Wireless All-in-One Ink Tank Printer, Scanner, Copier with 2 Years of Ink Included, Best-for-Home, Cartridge-Free, Refillable and AI-Enabled. (5D1B6A)
  • SET IT UP ONCE AND PRINT WITH CONFIDENCE. No complicated maintenance. Just easy, reliable printing you can count on.
  • INK FOR YEARS. NOT MONTHS. Up to 2 years of ink included. Get thousands of pages of cartridge-free printing. More pages, less hassle
  • KEEPS PRINTING WELL AFTER COMPETITORS HAVE QUIT. No complex maintenance. Sharper text, richer colors.[2] Only with HP Smart Tank
  • PREMIUM SUPPORT - Strong technical expertise to solve issues faster
  • THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.

Check paper size, margins, scaling, and pagination

If the element exists and is visible under the relevant media type, determine whether it is on another page, outside the printable area, or clipped. Compare the page’s CSS @page rules with the options passed to page.pdf(). The PDF API supports paper format or explicit dimensions, margins, scale, and preferCSSPageSize.

The documented default for preferCSSPageSize is false. In that case, the PDF paper setting can take priority over CSS page size and content may be scaled to fit. If your CSS defines the intended paper size, try honoring it explicitly; otherwise align the PDF options with the dimensions and margins in the stylesheet.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.pdf({
  path: 'report.pdf',
  format: 'A4',
  printBackground: true,
  preferCSSPageSize: true,
  margin: {
    top: '12mm',
    right: '12mm',
    bottom: '12mm',
    left: '12mm',
  },
  scale: 1,
});

Use either CSS page sizing or a deliberately chosen PDF paper size as the controlling specification; avoid conflicting rules. Change one setting at a time and inspect the result. A low scale, unexpected margin, fixed-width element, or print-specific positioning rule can move content or make it look substantially different from the browser view.

An extra or blank page is a pagination symptom, not proof that the DOM element is missing. Check content height, page breaks, margins, and elements that slightly overflow the page. Puppeteer issue #589 is a historical report of blank or extra-page behavior; it is an example of a layout class, not evidence that current Puppeteer universally has that bug.

Capture errors and reduce the problem to a small reproduction

When the visual cause is unclear, record what happened in the same browser runtime that creates the PDF. Capture page errors, console messages, failed requests, and relevant HTTP statuses. Reproduce with the same Puppeteer package and browser version, print rules, fonts, and PDF options; otherwise a difference in environment may be mistaken for a code change.

Rank #4
NDYIN Portable Printers Wireless for Travel, N80 Bluetooth Thermal Printer
  • Wireless Bluetooth Printer: Portable thermal printer compatible with iPhone, Android phones, iPad and tablet computers via Bluetooth. For smartphones, please download the "Nada Print" App. You can also connect to laptops and computers for printing using a USB-C cable. (Note: Laptops and computers can only be connected via USB and require the installation of a driver first. Bluetooth connection is not supported.)
  • No-ink printing: Only supports US Letter and A4 size thermal paper.(Doesn't support regular paper) The no-ink portable thermal printer uses direct thermal technology, requiring no ink, toner or ribbons, making it environmentally friendly, cost-effective and time-saving. The thermal printer package comes with a roll of US Letter thermal printing paper. Note: When installing the paper, remember to switch the paper size switch on APP
  • Clear Print: NDYIN N80 portable thermal printer adopts high-definition printing technology, with a 203DPI resolution to provide you with clear printing results. This mobile printer is compatible with roll paper, folded paper and tattoo transfer paper, supporting printing from your mobile phone PDF, Word, pictures and web pages anytime and anywhere. It is recommended to use our NDYIN thermal paper to achieve good printing quality
  • Portable wireless printer for travel: The thermal printer is equipped with a built-in 1500mAh rechargeable battery, which can print 160 sheets of 8.5" x 11" thermal paper after being fully charged. It weighs only 1.5 pounds and is compact in size. This ink-free portable printer can be easily carried in a backpack or briefcase! It is perfect for business travel, cars, small offices, construction sites, schools and homes. You can print documents, contracts, invoices and boarding passes anytime and anywhere
  • The N80 thermal printer has a wide range of uses. The package includes the N80 printer, a roll of US Letter paper(7m/roll), a user manual, a guide card, a type-C soft cable and a type C adapter. Note: The charging adapter is not included. Special thermal paper is required for use; ordinary paper cannot be used. This ink-free portable thermal printer is suitable for various scenarios such as home, school, travel, office, and outdoor, meeting the printing needs of different groups of people. This tattoo template printer is also compatible with tattoo transfer paper, making it an ideal choice for tattoo art
page.on('console', (message) => {
  console.log('console:', message.type(), message.text());
});
page.on('pageerror', (error) => {
  console.error('page error:', error);
});
page.on('requestfailed', (request) => {
  console.error('request failed:', request.url(), request.failure()?.errorText);
});
page.on('response', (response) => {
  if (!response.ok()) {
    console.error('HTTP response:', response.status(), response.url());
  }
});

Keep the reproduction small enough to tell whether the failure follows the DOM, CSS, asset loading, or PDF geometry. The official Page class documentation notes that navigation behavior can differ in some situations between headless shell and standard headless Chrome. If behavior is unusual, record which mode and browser executable you used rather than assuming the environments are identical.

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

Troubleshooting by symptom

What you see Likely cause What to check or change
The selector is not found before PDF generation. Data or client-side rendering has not completed, or application logic did not create the node. Check navigation and application errors; wait for an application-specific selector or ready flag.
The node exists but disappears in the PDF. Print media rules hide or reposition it, or an ancestor clips it. Inspect computed styles and ancestor overflow with print media active; fix print CSS or deliberately use screen media.
Text or a colored/image panel’s background is absent. Background printing is disabled, or the asset/font request failed. Set printBackground: true for CSS backgrounds; inspect failed requests and font readiness for assets.
Content is cut off at an edge or appears on another page. Paper dimensions, margins, scale, CSS page size, or pagination rules conflict. Compare @page with PDF options; verify scale, margins, and preferCSSPageSize; inspect later pages.
A blank or extra page appears. Content slightly overflows the page or page-break/layout rules create another page. Measure content and margins and test page-break rules in a minimal reproduction; do not treat this alone as a missing-node problem.
The PDF changes between runs or environments. Readiness races, asset failures, or differences in browser mode/version. Log browser and Puppeteer versions, wait for the app’s ready condition, and capture failed requests and page errors.

Or skip the browser setup

If you need a website screenshot or PDF without maintaining a Puppeteer browser flow, ScreenshotNeo offers a screenshot API and MCP server. Its one-call API can return an image or PDF; see the API documentation.

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

ScreenshotNeo accepts cookie or consent banners before capture and removes more than 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 each response reports the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.

Create a free ScreenshotNeo account to try 1,000 screenshots a month with no card.

Frequently Asked Questions

Does Puppeteer’s waitForFonts option mean every font loaded successfully?

No. It waits for the document font set, but you should still check font requests and availability in the browser environment.

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 printBackground make an element hidden by CSS appear?

No. It enables CSS background printing; it does not override display or visibility rules or create missing DOM nodes.

Quick Recap

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.