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

Do not rely on page navigation or a generic network-idle wait to prove that every image is ready for a PDF. After navigation, make sure the images you need have actually been requested, wait for each to finish and decode, check that it succeeded, and only then generate the PDF. Use a timeout and report failures rather than silently exporting missing images.

Why images can be missing from a PDF

Navigation completion, image loading, and image decoding are separate events. A browser can reach a navigation lifecycle state while an image is still downloading, has failed, or has not yet been decoded for display. A PDF call made at that point may capture an incomplete page.

Lazy loading adds another wrinkle: a below-the-fold image may not have been requested at all. Waiting on the images currently in the DOM cannot make an unrequested image ready. First cause the content that must appear in the PDF to load, then wait for its assets.

Also consider what “all images” means for your output. An <img>-based check does not cover CSS background images, canvas drawings, or other app-generated content. Print styles can hide or reposition elements, so readiness should be evaluated against the media and layout that the PDF will use.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

Choose a readiness condition that matches the PDF

Approach What it tells you Limitation
Navigation lifecycle, such as load A browser navigation reached a lifecycle state. It does not verify that every required image loaded successfully and decoded.
Network idle There was a period without network connections. Playwright defines its networkidle state as no network connections for at least 500 ms and discourages using it as a test-readiness condition. Ongoing polling or analytics can prevent it; a quiet network does not prove the exact required content is ready.
Explicit image load and decode checks Checks the image elements selected for the PDF, including whether they succeeded. You must include the right elements and trigger lazy-loaded content first.
Application-owned export-ready signal Can express that the application has finished preparing the exact export view. Requires control of the application and a correctly maintained signal.

For an application you control, an export-ready signal plus image checks is usually more precise than guessing from network quiet. For an arbitrary page, explicitly inspect the images that matter and define a bounded failure policy.

Reliable workflow for Playwright

  1. Navigate: wait for a reasonable lifecycle state, such as domcontentloaded. Do not treat it as image readiness.
  2. Prepare the export view: perform any application-specific actions, scroll or otherwise trigger required lazy images, and select print or screen media according to the intended PDF.
  3. Wait for required images: wait for loading and decoding, and fail with useful details if a required image is broken or times out.
  4. Wait for fonts if needed: font readiness is separate from images. Puppeteer’s PDF guide documents that page.pdf() waits for fonts by default; explicit handling may still be useful in a different setup.
  5. Generate the PDF: call the PDF API only after the readiness checks have passed.

The following Node.js example uses Playwright. It navigates, triggers lazy-image requests by scrolling, checks every image element for successful loading and decoding, restores the scroll position, and creates the PDF. It treats any broken image as an error instead of producing a deceptively successful file.

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch({ headless: true });
  const page = await browser.newPage();

  try {
    await page.goto('https://example.com', {
      waitUntil: 'domcontentloaded',
      timeout: 30_000,
    });

    // If your app has an export route or action, run it here.
    // For a print-formatted PDF, Playwright uses print media by default.
    // Use page.emulateMedia({ media: 'screen' }) only if screen styling is intended.

    // Trigger images that load only when they approach the viewport.
    await page.evaluate(async () => {
      const step = Math.max(200, window.innerHeight);
      for (let y = 0; y < document.documentElement.scrollHeight; y += step) {
        window.scrollTo(0, y);
        await new Promise(resolve => setTimeout(resolve, 100));
      }
      window.scrollTo(0, 0);
    });

    const imageResult = await page.evaluate(async () => {
      const images = [...document.images];
      const settle = image => new Promise(resolve => {
        if (image.complete) return resolve();
        image.addEventListener('load', resolve, { once: true });
        image.addEventListener('error', resolve, { once: true });
      });

      await Promise.all(images.map(async image => {
        await settle(image);
        if (image.complete && image.naturalWidth > 0 && typeof image.decode === 'function') {
          try { await image.decode(); } catch (_) { /* checked below */ }
        }
      }));

      return images
        .filter(image => !image.complete || image.naturalWidth === 0)
        .map(image => ({ src: image.currentSrc || image.src, alt: image.alt }));
    });

    if (imageResult.length) {
      throw new Error(`Required image(s) failed: ${JSON.stringify(imageResult)}`);
    }

    // Optional when your export depends on web fonts and the app exposes them.
    await page.evaluate(() => document.fonts.ready);

    await page.pdf({ path: 'page.pdf', format: 'A4', printBackground: true });
  } finally {
    await browser.close();
  }
})();

Install Playwright and its browser for your project before running the script. The scrolling delay is only a trigger opportunity, not proof of readiness; the subsequent checks are what determine whether the image elements succeeded. Adapt the trigger for pages whose lazy-loading behavior depends on a particular container, intersection observer, button, or application action. In production, apply a bounded timeout to the image wait as well as navigation so a stalled resource cannot hold a job forever.

Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Limit checks to images the PDF actually needs

The example checks every document.images element. If some images are optional, exclude them deliberately or mark the images required for export with an app-owned selector such as .pdf-required-image. Conversely, do not narrow the check if the omitted images must appear in the final document. A successful network response is not enough if the image has not decoded; naturalWidth provides a meaningful success check, while complete alone may also be true after a failed request.

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

Puppeteer version and PDF-specific details

Puppeteer’s PDF generation guide, surfaced as version 25.12.0 in the documentation reviewed, demonstrates navigation with waitUntil: 'networkidle2' before calling page.pdf(). Treat that as a useful navigation pattern, not proof that every image required by the PDF has decoded. Its guide also states that PDF generation waits for fonts by default; the API’s waitForFonts option defaults to true. Neither font behavior nor network-idle substitutes for checking image success.

A Puppeteer implementation can use the same browser-side image readiness logic as the Playwright example. After navigating and triggering lazy content, evaluate an image wait in the page, inspect failures, and only then call page.pdf(). Keep the wait bounded by your job’s timeout policy. The exact APIs and behavior can vary with the Puppeteer and browser versions in use, so validate the pattern against the version deployed by your application.

Rank #3
Sale
Epson Workforce ES-400 II High-Speed Color Duplex Desktop Document Scanner
  • FAST DOCUMENT SCANNING — Document scanner with feeder allows you to speed through stacks with a 50-sheet Auto Document Feeder (ADF); Efficient office scanner to help you scan more productively
  • INTUITIVE, HIGH-SPEED SOFTWARE — Quickly scan with this desktop document scanner; Epson ScanSmart Software lets you easily preview scans, email files, upload to the cloud, and more; Plus, automatic file naming saves even more time
  • SEAMLESS INTEGRATION — Easily incorporate your data into most document management software with the included TWAIN driver; Office document scanner integrates seamlessly with business workflows
  • EASY SHARING — Duplex scanner allows you to scan straight to email or popular cloud storage2 services like Dropbox, Evernote, Google Drive, and OneDrive for simple storage and sharing
  • SIMPLE FILE MANAGEMENT — Scanner allows the creation of searchable PDFs with Optical Character Recognition (OCR) and convert scans to editable Word or Excel files effortlessly; Designed for home and office document scanning

Print media, CSS backgrounds, and non-image content

Playwright generates PDFs using print CSS media by default. That can change visibility, dimensions, or layout relative to the screen. If the PDF is supposed to reflect the screen view, explicitly emulate screen media before the readiness check and PDF generation. If print styling is intended, leave the default and verify the print layout.

Image-element checks do not guarantee readiness for CSS background images. If backgrounds are essential, define explicit selectors or an application-level export-ready condition for them and verify the rendered PDF. Canvas content is likewise not covered by document.images; make the drawing code expose a completion signal before export. These cases need application-specific checks rather than a broader generic network-idle guess.

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

Timeouts, failures, and export policy

Choose timeouts based on your application, target sites, and job budget; no single duration suits every page. Bound navigation and image waits. On timeout, report which image URLs were still pending where possible. On a completed but failed request, report the URL and decide whether the image is required.

Rank #4
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images
  • Required image fails: stop the export and return a diagnostic, or apply an explicitly designed fallback image.
  • Optional image fails: continue only if omission is acceptable and observable in logs or job results.
  • Image never starts: check whether it is lazy-loaded, blocked, hidden, or requires an application action.
  • Image loads but looks wrong in the PDF: inspect print CSS, sizing, background behavior, and whether the output uses print or screen media.

A deliberate failure is preferable to a PDF that appears complete but silently omits required content. Include image failure details in your job result so downstream systems can distinguish a valid export from a partial one.

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

Or skip the browser setup

For a one-request capture workflow, ScreenshotNeo returns a website capture as PNG, JPEG, WebP, or PDF. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers state the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents. It is not a substitute for custom browser-side readiness logic on every dynamic page, so verify that the result meets your content requirements.

For a clean WebP screenshot, see the ScreenshotNeo API documentation and use:

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

The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up free for ScreenshotNeo.

Best Value
Sale
ScanSnap iX2500 Wireless or USB High-Speed Document Scanner, Black
  • OUR MOST ADVANCED SCANSNAP. Large touchscreen, fast 45ppm double-sided scanning, 100-sheet document feeder, Wi-Fi and USB connectivity, automatic optimizations, and support for cloud services. Upgraded replacement for the discontinued iX1600
  • CUSTOMIZABLE. SHARABLE. Select personalized profiles from the touchscreen. Send to PC, Mac, mobile devices, and clouds. QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
  • STABLE WIRELESS OR USB CONNECTION. Built-in Wi-Fi 6 for the fastest and most secure scanning. Connect to smart devices or cloud services without a computer. USB-C connection also available
  • PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. Easily manage, edit, and use scanned data from documents, receipts, photos, and business cards. Automatically optimize, name, and sort files
  • AVOIDS PAPER JAMS AND DAMAGE. Features a brake roller system to feed paper smoothly, a multi-feed sensor that detects pages stuck together, and skew detection to prevent paper damage and data loss

Frequently Asked Questions

Does `networkidle` wait for images?

It waits for a defined period without network connections; it does not assert that each required image succeeded and decoded.

Does `img.complete` mean the image loaded successfully?

No. Check a success condition such as `naturalWidth > 0` as well.

Should I use print or screen media for the PDF?

Use print media for a print-styled document; emulate screen media only when the PDF should match screen styling.

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

Quick Recap

Bestseller No. 4
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.