October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk8 min

Why html2canvas Images Do Not Show in jsPDF PDFs (and How to Fix It)

Missing images in a jsPDF export usually originate in html2canvas: CORS, redirects, unfinished resources, canvas limits or unsupported content. This guide shows how to isolate and fix each cause.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The usual cause is not jsPDF. html2canvas can omit an image because the browser’s origin policy would taint the canvas, because the image has not finished loading, or because the capture is too large or outside html2canvas’s supported rendering model. A reliable workflow is: make the image same-origin or serve it with usable CORS headers, wait for images and fonts, capture dimensions that match the content, verify that the canvas is readable, and only then pass its data to jsPDF.

First, identify where the image disappears

There are three separate handoffs: the browser loads the image, html2canvas reconstructs your DOM into a canvas, and jsPDF converts that canvas into a PDF image. Test each handoff instead of treating every blank PDF as a jsPDF error.

  1. Inspect the canvas. If the image is absent immediately after html2canvas() resolves, the problem is loading, CORS, unsupported content, or canvas size.
  2. Test readability. If the image appears on the canvas but toDataURL() throws a SecurityError, the canvas is tainted.
  3. Validate the jsPDF call. If a readable data URL exists but the PDF is blank or the call throws, check the image format, coordinates, and dimensions supplied to addImage().

Open DevTools’ Network panel for every image URL. Check the final response—not merely the URL typed in your HTML—because a redirect can move an apparently same-origin request to a CDN.

Cross-origin images: why useCORS is not a bypass

By default, html2canvas avoids drawing an image that would make the canvas unreadable (allowTaint:false). An image from another origin can taint a canvas. A tainted canvas cannot be read by script, so the normal conversion to a PNG data URL fails later.

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

useCORS:true tells html2canvas to attempt a CORS request; it does not grant permission. The image server must return an appropriate Access-Control-Allow-Origin response header for the requesting page. If the server omits that header, the image may be skipped or the resulting canvas may remain unreadable.

Choose a cross-origin fix

Fix Server control required? Best use Limitation
Serve from the application origin Yes First-party assets you can move or proxy into your site Requires changing where the asset is served
useCORS:true Yes, including the response header A CDN or object store that supports CORS Does not override browser policy; redirects and credentials still matter
html2canvas proxy No for the image host; yes for your controlled proxy Third-party images whose server cannot be changed Adds infrastructure and must restrict which URLs it fetches
Inline or base64 data URI No request during capture Small assets you fetched and converted earlier Increases document size and still requires a safe earlier fetch

Do not expect allowTaint:true to repair PDF export. It permits drawing a tainting image, but it still prevents scripts from reading the canvas, which blocks the usual toDataURL() handoff.

Redirects are a common surprise

A page may reference /images/logo.png, yet the request can redirect to a different host. Inspect the final response origin and its CORS headers. A same-origin starting URL does not guarantee a same-origin final resource.

Use a diagnostic capture before calling jsPDF

This example waits for image resources and fonts, captures the element, reports failures, and verifies that the canvas can be converted before creating the PDF.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
async function exportElementToPdf(element) {
  // Wait for images that are already in the DOM.
  await Promise.all([...element.querySelectorAll('img')].map(img => {
    if (img.complete) return Promise.resolve();
    return new Promise(resolve => {
      img.addEventListener('load', resolve, { once: true });
      img.addEventListener('error', resolve, { once: true });
    });
  }));

  // Wait for web fonts when the browser supports the Font Loading API.
  if (document.fonts?.ready) await document.fonts.ready;

  const canvas = await html2canvas(element, {
    useCORS: true,
    windowWidth: element.scrollWidth,
    windowHeight: element.scrollHeight,
    onError: err => console.warn('html2canvas resource failed', err)
  });

  console.log({ width: canvas.width, height: canvas.height });
  if (!canvas.width || !canvas.height) {
    throw new Error('html2canvas returned a zero-sized canvas');
  }

  let imgData;
  try {
    imgData = canvas.toDataURL('image/png');
  } catch (error) {
    throw new Error('Canvas is not readable; check CORS, redirects, and tainted images');
  }
  if (imgData === 'data:,') throw new Error('Canvas conversion produced empty data');

  const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' });
  const margin = 10;
  const pdfWidth = 210 - margin * 2;
  const pdfHeight = (canvas.height * pdfWidth) / canvas.width;
  pdf.addImage(imgData, 'PNG', margin, margin, pdfWidth, pdfHeight);
  pdf.save('capture.pdf');
}

exportElementToPdf(document.querySelector('#capture'));

addImage() accepts a data URL or canvas (as well as an image element, byte array, or RGBA data). The format, coordinates, and dimensions must be valid. If your canvas contains transparency and the PDF result has an unexpected background, render against an explicit background or choose an image format appropriate to your document.

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⁴

Blank, partial, or clipped canvases

Canvas limits

Browsers impose maximum canvas dimensions and total pixel areas. A very long page can therefore produce a blank or partially rendered canvas even though a short test works. Capture a smaller region, split a long document into pages, reduce scale, or render sections separately. Log both dimensions; a zero dimension points to capture setup, while a huge dimension points to a browser limit.

Viewport and scroll dimensions

html2canvas uses a virtual window for layout. Fixed headers, lazy content, and horizontally clipped layouts can be affected by an undersized viewport. Set windowWidth and windowHeight from the element’s scroll dimensions when you need the complete element. For a responsive design, use the viewport width that produces the intended breakpoint rather than blindly using the full document width.

Lazy-loaded images

An image can be visible to a human after scrolling but not loaded when capture starts. Trigger the section’s loading state first, wait for img.complete && img.naturalWidth > 0, and only then capture. A completed image with a zero natural width failed to load and needs a network or URL fix.

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

Timing, frameworks, and unsupported content

Capture after the framework has committed the final DOM, not during an intermediate render. In React, Vue, or similar applications, wait until data, images, transitions, and fonts are settled. Disable animations for the capture or wait for their end; otherwise you can get inconsistent full, half, or blank output.

Use html2canvas’s resource error callback and the browser’s network log together. The library’s documented imageTimeout default is 15,000 milliseconds; increase it only when slow, legitimate resources need more time, and fix failing requests rather than masking them with a longer timeout.

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.

html2canvas reconstructs supported DOM and CSS; it is not a pixel-perfect browser screenshot. Unsupported CSS effects may be missing. Cross-origin iframes cannot be rendered because their contentDocument is inaccessible. Content drawn by another document, browser UI, or inaccessible resource needs a different capture strategy.

A practical troubleshooting sequence

The image is missing from the canvas

  • Check the image request status and final URL in Network.
  • Confirm naturalWidth > 0 and that the image is not still lazy-loading.
  • For another origin, verify Access-Control-Allow-Origin on the actual response and keep useCORS:true.
  • If the host cannot provide CORS, use a controlled same-origin proxy or pre-convert the asset to a data URI.

The canvas is visible but toDataURL() fails

  • Look for any cross-origin image, canvas, SVG image, or redirected CDN request.
  • Remove the offending resource or make its response CORS-readable.
  • Do not rely on allowTaint:true; a tainted canvas remains unreadable.

The PDF is blank but the data URL works

  • Confirm the data URL is passed unchanged and the format string matches it (for example, 'PNG').
  • Use positive, finite width and height values and coordinates inside the page.
  • Check that the selected jsPDF page size can contain the calculated image; split oversized content across pages.

The result is cropped or only half the page appears

  • Log canvas dimensions and compare them with the element’s scrollWidth and scrollHeight.
  • Set an intentional capture viewport, reduce scale, or paginate long content.
  • Ensure content is rendered before capture and that no framework transition is still running.

Performance, reliability, and document quality

Large canvases consume memory proportional to their pixel area. A high device-pixel ratio or an unnecessarily large virtual viewport can make captures slow or exceed browser limits. Start with the smallest viewport that represents the design, capture only the required element, and paginate long reports. PNG preserves sharp text and transparency but can produce large PDFs; JPEG can be smaller for photographic content but introduces compression and does not preserve transparency.

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

For repeatable exports, make the capture state deterministic: freeze animations, set the intended timezone and data state, wait for fonts and images, and record canvas dimensions and resource errors. Keep CORS configuration explicit in deployment rather than depending on development-server behavior.

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 you need a clean website screenshot or PDF rather than a DOM reconstruction, ScreenshotNeo makes one request to capture a URL. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. 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. It also provides an MCP server for Claude, Cursor, and other MCP clients, with take_screenshot, get_page_info, and capture_pdf tools.

See the ScreenshotNeo documentation for all options. A direct cURL call is:

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 includes full-page and element capture, lazy-image loading, custom CSS and JavaScript, waits for selectors, delays or network idle, device and viewport presets, retina scale, PDF paper and page controls, request blocking, headers, cookies, user agents, authorization, geolocation, timezone, transparent backgrounds, resizing, caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to try it.

FAQ

Can I use an image URL with credentials?

Credentials and cookies must be configured so the response is both authorized and CORS-readable. A successful authenticated browser request alone does not make the resource readable to html2canvas.

Why does the page look correct but the PDF omit a CSS effect?

The browser paints many features that html2canvas does not reconstruct. Replace unsupported effects with capture-friendly markup or use a browser screenshot service when pixel fidelity is required.

Should I convert every image to base64?

No. Data URIs are useful for small, preprocessed assets, but they increase document size. Prefer same-origin or correctly configured CORS responses when you control the application.

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

Frequently Asked Questions

Can I use an image URL with credentials?

Credentials and cookies must be configured so the response is both authorized and CORS-readable. A successful authenticated browser request alone does not make the resource readable to html2canvas.

Why does the page look correct but the PDF omit a CSS effect?

The browser paints many features that html2canvas does not reconstruct. Replace unsupported effects with capture-friendly markup or use a browser screenshot service when pixel fidelity is required.

Should I convert every image to base64?

No. Data URIs are useful for small, preprocessed assets, but they increase document size. Prefer same-origin or correctly configured CORS responses when you control the application.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.