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

Put every canvas on one page, wait for your application to finish drawing, then call Puppeteer’s page.pdf() once. Puppeteer prints the composed page with print media by default. If your canvases depend on screen-only CSS, call page.emulateMediaType('screen') before creating the PDF. The reliable part is the readiness signal: Puppeteer waits for fonts, but it cannot know that your asynchronous canvas rendering is complete.

Complete Puppeteer example

The following script loads a page, waits for an application-defined flag, optionally selects screen media, and writes one PDF containing all canvases visible in the document. Replace the URL and readiness condition with those used by your application.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();

  await page.goto('https://example.com/canvas-report', {
    waitUntil: 'networkidle2'
  });

  // Set this in your page after every canvas has been drawn.
  await page.waitForFunction(() => window.canvasDrawingComplete === true);

  // Print media is the default. Uncomment when screen styles are required.
  // await page.emulateMediaType('screen');

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

  await browser.close();
})();

page.pdf() returns a Promise<Uint8Array>; supplying path writes the bytes to disk. You can omit path and send the returned bytes to object storage, an HTTP response, or another service.

Make canvas readiness explicit

A network-idle event only describes network activity. A chart can still be decoding data, waiting for a worker, or drawing after that event. Set a page-owned flag (or expose another deterministic condition) only after the final canvas operation has completed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
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
function drawEverything(data) {
  drawSalesCanvas(data.sales);
  drawMapCanvas(data.regions);
  drawSummaryCanvas(data.summary);
  window.canvasDrawingComplete = true;
}

window.canvasDrawingComplete = false;
loadReportData().then(drawEverything);

When a flag is not practical, wait for a selector that your application adds after rendering:

await page.waitForSelector('[data-canvas-ready="true"]');

Use the condition that represents your application’s actual completion, not a fixed sleep. A delay can be useful for a known animation, but it is less reliable when data or rendering time varies.

Inspecting and validating multiple canvases

You can enumerate the elements in page context with page.$$eval(). This is useful for diagnostics, dimension checks, or collecting labels before printing.

const canvasInfo = await page.$$eval('canvas', canvases =>
  canvases.map((canvas, index) => ({
    index,
    width: canvas.width,
    height: canvas.height,
    cssWidth: canvas.getBoundingClientRect().width,
    cssHeight: canvas.getBoundingClientRect().height
  }))
);
console.log(canvasInfo);

The selector can be narrowed, for example .report canvas, when unrelated canvases (such as a hidden editor) are present. The PDF captures the page layout, so keep canvases in the intended document order and use ordinary print CSS to control spacing and page breaks.

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

Choose print or screen rendering

Print media (the default)

Puppeteer’s PDF API uses print media unless you change it. This lets @media print rules, print-specific visibility, and paper-oriented layout determine the result. It is usually the right choice for reports.

Screen media

Call the media emulation method before page.pdf() when the canvas layout is correct only under screen CSS:

await page.emulateMediaType('screen');
await page.pdf({ path: 'screen-layout.pdf', format: 'A4' });

Do not switch media after generating the PDF; the PDF call uses whichever media type is active at that moment.

Control paper geometry and pagination

Use one of Puppeteer’s named formats, or provide explicit dimensions. The PDF options relevant to a multi-canvas report include:

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 #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⁴
  • format: a named paper size such as A4. The documented default is Letter.
  • width and height: explicit dimensions when a custom sheet is needed.
  • landscape: rotate the paper for wide charts.
  • margin: top, right, bottom, and left values such as '12mm'.
  • scale: adjust rendered size when content is too large or too small.
  • pageRanges: emit only selected pages after layout is complete.
  • preferCSSPageSize: when true, a CSS @page size takes priority over width, height, or format.
  • printBackground: false by default; set true when canvas containers, backgrounds, or other CSS backgrounds must appear.

A CSS page rule can define the paper itself:

@page {
  size: A4 landscape;
  margin: 10mm;
}

.canvas-sheet {
  break-inside: avoid;
  page-break-inside: avoid;
}

Pass preferCSSPageSize: true if that CSS size should win. Preventing a break inside a canvas wrapper helps, but a block taller than one sheet still must overflow or be split; resize the canvas or choose a larger paper size in that case.

Preserve colors and backgrounds

PDF printing can modify colors, and backgrounds are not printed unless printBackground: true is set. For designs where exact color treatment matters, add the print color adjustment rule recommended for Chromium print rendering:

html {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

Validate the output with the actual Chromium version used in deployment. This setting requests color preservation; it does not repair a canvas that was never drawn or a layout that is clipped by its paper geometry.

When direct canvas printing is unsatisfactory

The normal approach is to print the page containing the canvases. If a target browser or page produces missing or altered canvas output, a practical fallback is to snapshot each canvas and print a document containing image elements. This is an implementation pattern to test in your target environment, not a Puppeteer guarantee.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const snapshots = await page.$$eval('canvas', canvases =>
  canvases.map((canvas, index) => ({
    index,
    dataUrl: canvas.toDataURL('image/png'),
    width: canvas.width,
    height: canvas.height
  }))
);

await page.setContent(`
  <style>
    @page { size: A4; margin: 12mm; }
    img { display: block; max-width: 100%; break-inside: avoid; }
  </style>
  ${snapshots.map(item =>
    `<img src="${item.dataUrl}" width="${item.width}" height="${item.height}">`
  ).join('')}
`);

await page.pdf({
  path: 'canvas-snapshots.pdf',
  format: 'A4',
  printBackground: true,
  preferCSSPageSize: true
});

Snapshotting trades live canvas rendering for raster images. Check the resulting resolution, file size, and any application-specific restrictions before adopting it. If your page uses a canvas that cannot be serialized in your environment, fix that condition or use the direct print path instead.

Useful layout patterns for several canvases

One canvas per report section

Wrap each drawing and its heading in a section, then use print CSS to keep a section together where possible:

<section class="canvas-section">
  <h2>Revenue</h2>
  <canvas id="revenue" width="1200" height="700"></canvas>
</section>

Wide charts

Use landscape paper or explicit width and height rather than relying on an aggressive scale. Scaling down a readable chart can make labels unusable.

High-density displays

The canvas’s internal pixel dimensions and its CSS dimensions are separate. Decide the intended print size first, then verify both values with the diagnostic snippet. A very large backing store can increase memory use and PDF generation time.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
  • 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.

Reliability and performance checklist

  • Launch and close the browser in a try/finally block in production so failures do not leave Chromium processes running.
  • Use a bounded navigation and readiness timeout; investigate slow data sources instead of waiting forever.
  • Wait for the application’s completion signal after navigation. Puppeteer’s default font wait does not cover your canvas drawing work.
  • Keep the page to the canvases and assets needed for the report. Unnecessary images and scripts increase memory and render time.
  • Choose printBackground, paper size, margins, and media type deliberately; defaults are not neutral for reports.
  • Test several content lengths, empty datasets, long labels, and the largest expected canvas dimensions.
  • Compare a generated PDF in a viewer and, when possible, extract a page image for visual regression testing.

Troubleshooting

The PDF contains blank canvases

The PDF was probably generated before drawing completed. Set a deterministic flag or ready selector after the final draw, and wait for it. Also verify that the canvas is visible and that the page’s data request succeeded.

Colors or backgrounds differ from the page

Set printBackground: true, check print CSS, and add the color-adjust rule when exact colors matter. If the page intentionally changes under print media, emulate screen media before calling page.pdf().

A chart is clipped or split

Inspect the paper size, orientation, margins, and scale. Try landscape for wide content, or use explicit dimensions. Put a canvas and its heading in a wrapper with break-inside: avoid; a section taller than a page still needs resizing or a deliberate split.

The script times out at navigation

networkidle2 is only a navigation heuristic and may never occur on pages with persistent connections. Use a less restrictive navigation milestone when appropriate, then wait for your application’s own ready signal.

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

Fonts are missing

PDF generation waits for fonts by default, but the font still must be available to the page. Check font loading errors and ensure your readiness signal is not set before the desired font-dependent drawing occurs.

Snapshot fallback produces a huge file

Canvas PNG data can be large, especially at high backing-store resolutions. Compare JPEG or a reduced drawing resolution where image quality permits, and avoid snapshotting canvases that can be printed directly.

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 simply a clean capture or PDF of a web page rather than custom Puppeteer control, ScreenshotNeo provides a one-request screenshot API and an MCP server for AI clients. Its API accepts options for full-page capture, element selection, waiting conditions, custom CSS or JavaScript, PDF paper settings, and more. Cookie and consent banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing result.

For a PDF or image of a composed URL, start with the API documentation at https://screenshotneo.com/docs/. A direct cURL request is:

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

Python:

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)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also offers take_screenshot, get_page_info, and capture_pdf through MCP for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots each month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Rank #4
Sale
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

FAQ

Does Puppeteer have a canvas-specific PDF method?

No. The documented workflow is to compose the page, ensure it is ready, and use the normal page PDF API.

Can I generate one PDF from canvases on different pages?

page.pdf() prints the current page. Navigate or compose the content into one document first, then generate the PDF, or create and merge separate PDFs with a separate document-processing step.

Should I always use networkidle2?

No. It is an illustrative navigation choice. Select a navigation milestone and an application-specific drawing signal that match your page.

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

What is the safest way to verify output after a Puppeteer upgrade?

Run visual checks against representative PDFs, including wide and multi-page canvas layouts, and confirm options and defaults against the Puppeteer version installed in your project.

Frequently Asked Questions

Does Puppeteer have a canvas-specific PDF method?

No. Compose the page, wait for drawing to finish, and use the normal page PDF API.

Can canvases from different pages be placed in one PDF?

Not directly with one page.pdf() call; compose them into one document or create separate PDFs and merge them separately.

Is networkidle2 required?

No. Use the navigation milestone and application-ready condition that fit your page.

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

The Bottom Line

For multiple canvases, correctness comes from one composed page and an explicit drawing-complete signal; paper size, media type, backgrounds, and pagination then determine how that page becomes a PDF.

Quick Recap

Bestseller No. 3
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
HP Smart Tank 5000 Ink Tank Printer | 2 Years of Ink Included | All-in-One
PREMIUM SUPPORT - Strong technical expertise to solve issues faster; THE LAST PRINTER YOU'LL EVER NEED. Enjoy years of refillable, cartridge-free printing.
$189.99

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.