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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

A blank html2canvas image in an Ionic 4 Angular app is usually caused by a zero-size or not-yet-rendered target, a canvas that exceeds the device’s limits, an image or other resource blocked by cross-origin rules, or CSS that html2canvas cannot reconstruct. There is no single Ionic fix. Measure the target and output first, then isolate dimensions, resources, and unsupported content in that order.

What a “blank” html2canvas result actually tells you

html2canvas does not photograph the screen. It walks the DOM, reads computed styles and available resources, and builds a new canvas that approximates the element. The project documentation describes it as building “a representation of the page based on the information available on the DOM.” That distinction matters in Ionic: a page can look correct in the WebView while the reconstructed canvas is empty, incomplete or different.

Start by separating three outcomes:

  • Zero dimensions: the selected element was missing, hidden, collapsed or not rendered when capture started.
  • Non-zero but empty: resources failed, content is outside the supported rendering model, or the canvas became unusable at its requested size.
  • Partial or cut off: the viewport, scroll dimensions, scale or browser canvas limit is too small for the target.

The exact cause depends on your html2canvas version, device or WebView, target element, asset URLs and console/network errors. Treat the following as an isolation procedure rather than a universal Ionic 4 patch.

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

1. Verify the target and its dimensions before changing options

Capture the element after Ionic has rendered it

Do not run the capture immediately after changing data or navigating to a page. Wait until Angular has applied the view and images or fonts have had an opportunity to load. Query the exact element and inspect both its bounding box and scroll dimensions.

#1 Best Overall
Lenovo Idea Tab - College Tablet - 11″ 2.5K IPS Touchscreen Display - 90Hz - MediaTek Dimensity 6300-8 GB Memory - 256 GB Storage - Integrated Arm Mali-G57 MC2 - Tab Pen and Folio Case
  • POWER YOUR STUDY, FUEL YOUR PLAY – Discover smarter learning with the Lenovo Idea Tab. Stay campus-ready with all-day battery life, AI-powered apps to enhance your work, and sharp graphics for tv marathons with friends.
  • SMOOTH, POWERFUL, IMMERSIVE – The MediaTek Dimensity 6300 processor is more powerful than ever, with the AI-enhanced multitasking you need to stay ahead.
  • CIRCLE IT, SEARCH IT – Use your Lenovo Tab Pen or fingertip to circle items for instant search results or to translate other languages without switching apps. Circle to Search with Google ensures answers are only a circle away.
  • SHARP VIEW, CLEAR SOUND – Experience sharp visuals and immersive sound for study sessions and streaming breaks. With 72% NTSC and quad Dolby Atmos-tuned speakers you can enjoy your study breaks with vivid videos and crystal-clear sound.
  • LEVEL UP YOUR STUDY – Write, organize, sketch, and calculate with four learning apps built to match your flow. Lenovo AI Note, Squid, Nebo, and MyScript Calculator help you stay clear, focused, and ready for every study session.
import html2canvas from 'html2canvas';

async captureCard(): Promise<void> {
  const element = document.querySelector('#capture');
  if (!(element instanceof HTMLElement)) {
    throw new Error('Capture target not found');
  }

  const box = element.getBoundingClientRect();
  console.log({
    rectWidth: box.width,
    rectHeight: box.height,
    scrollWidth: element.scrollWidth,
    scrollHeight: element.scrollHeight,
    display: getComputedStyle(element).display,
    visibility: getComputedStyle(element).visibility
  });

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

  console.log({ canvasWidth: canvas.width, canvasHeight: canvas.height });
}

If the selector is wrong, the element has a zero rectangle, or its scroll dimensions are zero, changing useCORS or allowTaint cannot help. Make sure the target is not inside a closed *ngIf, an inactive tab, a hidden modal, or a container with zero height. If you capture a modal or overlay, trigger the capture while it is visible.

Use the element’s real scroll size for long content

By default, html2canvas derives width and height from the element and derives windowWidth and windowHeight from the browser window. A page that scrolls beyond the WebView viewport can therefore be cut off. Supplying the target’s scrollWidth and scrollHeight gives the renderer the dimensions it needs for a full-page element. Confirm the resulting canvas dimensions in the console; a non-zero canvas does not guarantee that every child rendered successfully.

2. Check canvas dimensions and pixel scale

Understand the effect of scale

The default scale is window.devicePixelRatio. On a high-density phone, a 1,000 CSS-pixel-wide element can become a substantially larger bitmap. Browser and platform canvas limits vary, and exceeding them can produce a blank or partial output without a useful exception.

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

Use a lower scale as a diagnostic and as a practical solution for large captures:

Rank #2
Lenovo Tab One - Lightweight Tablet - up to 12.5 Hours of YouTube Streaming - 8.7" HD Display - 4 GB Memory - 64 GB Storage - MediaTek Helio G85 - Includes Folio Case
  • COMPACT SIZE, COMPACT FUN – The Lenovo Tab One is compact, efficient, and provides non-stop entertainment everywhere you go. It’s lightweight and has a long-lasting battery life so the fun never stops.
  • SIMPLICITY IN HAND - Add a touch of style with a modern design that’s tailor-made to fit in your hand. It weighs less than a pound and has an 8.7” display that’s easy to tuck in a purse or backpack.
  • NON-STOPPABLE FUN – Freedom never felt so sweet with all-day battery life and up to 12.5 hours of unplugged YouTube streaming. It’s designed to charge 15W faster than previous models so you can spend less time tethered to a power cable.
  • PORTABLE MEDIA CENTER - Enjoy vibrant visuals, immersive sound, and endless entertainment anywhere you go. The HD display has 480 nits of brightness for realistic graphics and dual Dolby Atmos speakers that provide impressive sound depth.
  • ELEVATED EFFICIENCY - Experience the MediaTek Helio G85 processor and 60Hz refresh rate that ensure fluid browsing, responsive gaming, and lag-free streaming.
const canvas = await html2canvas(element, {
  scale: 1,
  width: element.scrollWidth,
  height: element.scrollHeight,
  windowWidth: element.scrollWidth,
  windowHeight: element.scrollHeight,
  onError: error => console.warn(error)
});

If scale: 1 works but the default scale does not, keep the lower value or capture the content in smaller sections. There is no single maximum canvas size that is safe on every browser, Android WebView, iOS WebView or device. Test the chosen dimensions on the oldest and lowest-memory device you support. For very long receipts, invoices or reports, split the capture into sections and combine or upload those pieces instead of requesting one enormous bitmap.

3. Find failed images and other resources

Use developer tools and onError

Open the WebView or browser console and Network panel while capturing. Look for failed image, SVG, font and background requests, redirects, blocked mixed-content requests and authentication responses. The onError callback reports resource failures while rendering continues, so a warning is evidence that the canvas may be missing part of the page rather than proof that the whole operation failed.

Check the URL that actually loads on the affected device. An Ionic app served by ionic serve can have a different origin from a production WebView build, and a URL that appears same-origin in development may redirect to a CDN in production. A reported 2023 issue describes a same-origin URL redirecting to a CDN where useCORS did not behave as expected; that is an edge case, not proof that every redirect fails.

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.

Fix cross-origin images at the server

Images outside the page origin can taint the canvas. With the documented default allowTaint: false, html2canvas skips images it cannot safely use. useCORS: true asks the browser to load an image with CORS, but it cannot override the image server’s policy. The response must include an appropriate Access-Control-Allow-Origin value for your app origin (or a permitted wildcard where appropriate).

Rank #3
URAO Tablet,11" Android 16 Tablet Octa-core 36GB+128GB Gemini AI
  • 【Dual-Function 2-in-1 Tablet】URAO Android 16 Tablet is a game-changer with 2-in-1 professional work mode. The tablet is compatible with a Bluetooth keyboard, mouse, stylus, headset, and a convenient foldable case. The setup and connection process is straight forward, enabling you to effortlessly transform your tablet into either a laptop or a computer mode. Friendly Tips: Mouse does not come with batteries.
  • 【Android 16 & Octa-Core Processor】URAO Android tablet features the latest operating system Android 16 and an 1.8 GHz octa-core processor ensure of excellent performance, seamless multitasking, getting rid of annoying ads, emphasizing privacy and security by designing enhanced app permissions, providing you complete management control.
  • 【36GB (6+30GB) RAM 128GB ROM 】Our 11 inch tablet comes with 36GB (6+30GB) RAM 128GB ROM and maximun 1TB TF card ( not included )expandable ensures you of a fast APP launch and smooth gaming experience. URAO tablet also come with pre-installed Google Play Store, you can easily download any needed Apps such as Facebook, Twitter, Youtube, etc.
  • 【7800mAh Battery with Fast Charge】The built-in large capacity and low consumption CPU enable our URAO 11 inch tablet to stand by for up to 3 days and allows you to enjoy up to 8 hours of mixed reading, watching TV shows, playing games, surfing the web. URAO tablet adopts fast-charging technology ,easily charge via the USB Type-C port and rest assured the battery will last. It is a good companion for you to play and study!
  • 【Wi-Fi 6+Bluetooth5.4】URAO 11 inch android tablet adopts the lastest sixth generation WiFi technology and the upgraded bluetooth 5.4. Dual band integrated chips make the 5g WiFi and 2.4g WiFi more stable and the lastest bluetooth 5.4 connection supports all your favorite accessories, highly increased the speed of data transfer, improved network capacity and reduced network delays.
const canvas = await html2canvas(element, {
  useCORS: true,
  onError: error => console.warn('Resource could not be rendered:', error.message)
});

Inspect the final response after redirects, not just the original URL. If you control the image service, return the CORS header on the image response and ensure caches do not serve a response with the wrong origin policy. If you do not control it, use a documented proxy that fetches the image server-side and serves it from an origin your app can read.

Do not treat allowTaint: true as a reliable export fix. A tainted canvas may display pixels, but browser security can still prevent toDataURL() or other read operations. Use it only when you explicitly do not need to read or export the canvas.

4. Remember what html2canvas cannot reconstruct

CSS support is selective

html2canvas implements a renderer for supported DOM and CSS properties; it is not a native screenshot engine. If simple blocks render but one component disappears, reduce the target to that component and remove styles or effects one at a time. Gradients, filters, masks, unusual blend modes, pseudo-elements and complex positioning can expose differences between the live WebView and the reconstructed output. Verify the minimal case before changing global styles.

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

Cross-origin iframes are not readable

Browser security prevents html2canvas from reading the document inside a cross-origin iframe. The iframe may be visible in the Ionic page while its contents are absent from the generated image. Capture content you own in the parent document, configure the embedded service to provide an export, or use a browser-level screenshot mechanism instead of trying to bypass the same-origin policy.

Rank #4
Android 16 Tablet 10 Inch, 24GB RAM 64GB ROM 1TB,HD IPS,Fast WiFi 6, BT 5.4
  • 【Android 16 OS & High-Performance CPU】 Evermyth GMS-certified tablet runs on the Android 16 operating system, allowing direct downloads of popular apps from the Play Store. Powered by a robust 5-core processor that hits speeds up to 1.8GHz, the android tablet is engineered to boost multitasking performance. Whether you’re working, watching videos, or gaming, this 5-core tablet pc operates seamlessly, delivering a fast, professional-grade experience.
  • 【24GB RAM + 64GB ROM + 1TB Expandable Storage】 Our 10 inch electronics tablets comes with 24GB RAM (3GB physical + 21GB virtual), 64GB ROM, and supports up to 1TB of expandable storage via a TF card (not included). This ensures quick app launches and smooth gameplay.
  • 【10 inch HD IPS In-Cell Display】 This tablet PC boasts a 1280×800 high-resolution IPS screen that delivers vibrant, true-to-life colors. Enjoy sharper, brighter visuals for a more immersive viewing experience. The 5MP front and 8MP rear camera can handle video calls and photo recording with ease. LCD touchscreen uses low-blue-light tech to cut down on eye strain from screen flicker and harsh blue light. Slim and lightweight, this 10-inch tablet amps up immersion for all your favorite activities.
  • 【6000mAh Rechargeable Battery】 Electronics tablets Packed with a 6000mAh battery and a low-power-consuming CPU, Evermyth 10 inch tablet offers up to 3 days of standby time and up to 8 hours of mixed usage—perfect for reading, streaming, or web browsing. Charging is a breeze via the USB-C port, making the tablet an ideal companion for both entertainment and work!
  • 【Wi-Fi 6 & Bluetooth 5.4】 Evermyth Android 16 tablet features the latest Wi-Fi 6 and upgraded Bluetooth 5.4. It supports dual-band (5GHz/2.4GHz) Wi-Fi connectivity for stable, high-speed transfers. Bluetooth 5.4 ensures seamless compatibility with all your favorite accessories.

Native and WebView content is outside the DOM model

html2canvas can reconstruct HTML in the WebView, but it does not provide a pixel capture of native Ionic plugins, system UI, browser chrome or another native surface layered over the page. If your requirement is the exact rendered screen—including content html2canvas cannot read—use a platform or browser screenshot API and accept its different permissions and automation requirements.

5. A controlled Ionic 4 Angular capture recipe

  1. Render a test target. Add a stable identifier such as id="capture" to a visible element with a known background and fixed test dimensions.
  2. Wait for the view. Trigger capture from a user action after the page is displayed; for data-bound content, wait until the data subscription has updated the view. If images are essential, wait for their load events or verify them separately.
  3. Log geometry. Record getBoundingClientRect(), scrollWidth, scrollHeight and computed visibility. Abort with a clear error if any required dimension is zero.
  4. Capture conservatively. Start with scale: 1, explicit scroll dimensions and onError. Change one option at a time so you can identify which condition matters.
  5. Inspect the canvas. Log canvas.width and canvas.height, append the canvas temporarily to the page, or open its data URL in a new tab for visual inspection.
  6. Export only after a successful render. Use toDataURL('image/png') or toBlob(). If reading the canvas throws a security error, return to the CORS and tainted-image checks.
async function renderPng(): Promise<string> {
  const element = document.querySelector('#capture');
  if (!(element instanceof HTMLElement)) {
    throw new Error('Capture target not found');
  }

  const width = element.scrollWidth;
  const height = element.scrollHeight;
  if (!width || !height) {
    throw new Error(`Target has invalid size: ${width}x${height}`);
  }

  const canvas = await html2canvas(element, {
    scale: 1,
    width,
    height,
    windowWidth: width,
    windowHeight: height,
    useCORS: true,
    onError: error => console.warn('html2canvas:', error.message)
  });

  if (!canvas.width || !canvas.height) {
    throw new Error('html2canvas returned an empty canvas');
  }

  return canvas.toDataURL('image/png');
}

Keep the configuration minimal in production. Setting every option at once hides the original failure and can create a result that works only on one device.

Configuration options that matter first

Option Documented behavior Use it when
useCORS Attempts CORS-enabled image loading. Remote images return the required CORS header.
allowTaint Allows drawing images that may taint the canvas. You do not need to read or export the pixels; it is not a cure for export security errors.
scale Defaults to window.devicePixelRatio. Lower it when high-density output is too large or fails.
width, height Control the rendered element dimensions. The target’s natural dimensions are wrong or you are capturing a defined region.
windowWidth, windowHeight Default to the browser window dimensions. Set them to the target’s scroll dimensions for long or clipped content.
onError Receives resource or rendering errors while the process continues. You need evidence about which asset failed.

Troubleshooting by symptom

Symptom Likely cause Next check or fix
Canvas width or height is zero Wrong selector, hidden element, collapsed layout or capture before rendering. Log the element, wait for the view, make it visible and verify its bounding box.
Simple text renders, remote photos do not Cross-origin response lacks permission or the request failed. Inspect the final image response, configure server CORS, use a proxy, and test useCORS: true.
Output stops partway down Viewport dimensions or canvas size are insufficient. Use scroll dimensions, lower scale, or capture sections.
Canvas appears but export throws a security error The canvas was tainted by an unreadable image. Remove or correctly CORS-enable the resource; do not rely on allowTaint.
An embedded payment, map or video frame is missing Cross-origin iframe contents cannot be read. Export from the provider or capture at the browser/platform level.
Works in Chrome desktop but not on a phone Different WebView origin, device pixel ratio, memory or canvas limits. Compare URLs and headers on the phone, set a lower scale and test smaller regions.
Changing options produces random results Several causes were changed simultaneously. Return to the minimal test and alter one option per run.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability and output choices

Rendering is CPU- and memory-intensive because html2canvas reconstructs every captured node and draws a bitmap. Large shadows, many images and very tall pages increase work. Capture only the element required, hide irrelevant selectors, use a sensible scale and release generated data URLs or blobs after upload. On mobile WebViews, avoid running multiple captures concurrently.

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

A successful promise means the renderer completed; it does not certify visual fidelity. Keep a diagnostic mode that records target dimensions, canvas dimensions, failed resources and the device/WebView version. Compare output on the deployment targets that matter rather than relying only on ionic serve.

Best Value
Sale
Amazon Fire HD 10 tablet, built for relaxation, 10.1" vibrant Full HD screen, octa-core processor, 4 GB RAM, 32 GB, Black
  • Do what you love, uninterrupted — 25% faster performance than the previous generation and is ideal for seamless streaming, reading, and gaming.
  • High-def entertainment — A 10.1" 1080p Full HD display brings brilliant color to all your shows and games. Binge watch longer with 13-hour battery, 3 or 4 GB RAM, 32 or 64 GB of storage, and up to 1 TB expandable storage with micro-SD card (sold separately).
  • Thin, light, durable — Tap into entertainment from anywhere with a lightweight, durable design and strengthened glass made from aluminosilicate glass. As measured in a tumble test, Fire HD 10 is 2.7 times as durable as the Samsung Galaxy Tab A8 (2022).
  • Stay up to speed — Use the 5 MP front-facing camera to Zoom with family and friends, or create content for social apps like Instagram and TikTok.
  • Ready when inspiration strikes — With 4,096 levels of pressure sensitivity, the Made for Amazon Stylus Pen (sold separately) offers a natural writing experience that responds to your handwriting. Use it to write, sketch in apps like OneNote, and more.

Or skip the browser setup

If your actual requirement is a screenshot of a publicly reachable web page—not a private, in-app WebView state—ScreenshotNeo provides a one-request alternative. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and each response reports the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.

See the ScreenshotNeo documentation for authentication and options. The basic cURL request 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 also supports full-page captures with lazy images loaded, CSS-selector element capture, device presets or custom viewports, retina scale, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. The parameter names used by other screenshot APIs also work, which can simplify migration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Plan Included shots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Every feature is available on every plan, and yearly billing provides two months free. The free tier includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account if a hosted capture fits your workflow.

When to use html2canvas instead of a hosted screenshot

  • Use html2canvas when the target is private, already rendered inside your Ionic WebView, or must reflect application state that cannot be exposed at a public URL.
  • Use a browser or platform screenshot API when you need pixel-level screen fidelity, native overlays or cross-origin iframe content.
  • Use a hosted API such as ScreenshotNeo when a public URL, repeatable server-side capture, PDF output or AI-agent access is more useful than maintaining browser and WebView diagnostics.

For the Ionic failure itself, the dependable path remains the same: prove the target exists, measure it, reduce scale, identify failed resources, correct CORS, and remove unsupported or cross-origin content one piece at a time.

Frequently Asked Questions

What information should I include when reporting an Ionic html2canvas blank-image bug?

Include the html2canvas version, Ionic and Angular versions, device and operating-system version, WebView or browser version, target dimensions, the exact asset URLs and redirects, console and network errors, and the canvas width and height returned by the diagnostic code. That evidence distinguishes layout, resource, security and size failures.

Can a successful html2canvas promise still produce an unusable image?

Yes. Rendering can finish with a non-zero canvas while individual resources were skipped, unsupported content was omitted, or the requested bitmap exceeded practical device limits. Inspect the output and the onError messages rather than treating promise resolution as a fidelity guarantee.

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

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.