Recommended Free Tools
To capture a div in an Ionic 4 Angular page, pass its rendered DOM element to html2canvas, wait for the returned Promise, then display or export the resulting canvas. This is a browser-side reconstruction of DOM content, not a literal screenshot of the screen or a native iOS/Android capture. Because compatibility depends on the installed package and the target browser or WebView, check your project’s dependency manifest and lockfile rather than assuming one html2canvas import works in every Ionic 4 project.
Install the package that matches your project
The current html2canvas getting-started instructions use the scoped package name and import path below:
npm install @html2canvas/html2canvas
import html2canvas from '@html2canvas/html2canvas';
The older package named html2canvas has its own installation and import form. Its npm listing identifies version 1.4.1. Do not install one package and copy the other package’s import path by assumption. First inspect package.json and the lockfile to see what is already installed, then use the corresponding import form. If you are starting fresh, use the current scoped installation above.
html2canvas runs in a browser context: it uses window, document, and computed styles. It is not a Node.js server-rendering library. The sources available for this topic do not establish a tested compatibility matrix for a particular Ionic 4, Angular, html2canvas, iOS, Android, or WebView version, so verify the combination used by your app.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
Capture a rendered element in an Ionic Angular page
Mark the part of the template you want to capture with an Angular template reference. Call the capture method after Angular has rendered the element and its content. The following is an integration pattern using the documented element-to-canvas API; adapt the @ViewChild syntax if your project’s Angular version requires a different form.
<div #captureArea>
<h2>Share this report</h2>
<p>The content to capture goes here.</p>
</div>
<button type="button" (click)="capture()">Capture</button>
import { ElementRef, ViewChild } from '@angular/core';
import html2canvas from '@html2canvas/html2canvas';
export class ReportPage {
@ViewChild('captureArea', { read: ElementRef })
captureArea!: ElementRef<HTMLElement>;
async capture(): Promise<void> {
const element = this.captureArea.nativeElement;
const canvas = await html2canvas(element);
const imageDataUrl = canvas.toDataURL('image/png');
// Display, download, or pass the PNG data URL to another workflow.
console.log(imageDataUrl);
}
}
If your project has the older unscoped package installed, use its matching import instead:
import html2canvas from 'html2canvas';
Keep the import and installed dependency consistent. The capture call returns a Promise, so handle it with await inside an async function or attach a .then() handler. The element should exist in the rendered page when the call runs; triggering it from a user action after the view is displayed is a straightforward way to avoid querying an element before it is available.
Choose what happens to the canvas
Show the result in the page
To preview the output, assign the data URL to an image element. For example, bind a component property to an <img> element’s src after the asynchronous capture finishes. This lets the page display the generated image. The data URL contains the image data, so for large captures it can consume substantial memory; keep the capture area and output scale appropriate for the device.
Download a PNG in the browser
The html2canvas examples export the canvas as a PNG data URL and use it as a download link. A minimal browser-side pattern is:
const canvas = await html2canvas(this.captureArea.nativeElement);
const link = document.createElement('a');
link.href = canvas.toDataURL('image/png');
link.download = 'capture.png';
link.click();
This creates a browser download flow, not a save directly into an iOS or Android photo gallery. Saving into a native gallery is a separate platform task, and the available guidance does not establish which Ionic native plugin or API to use.
Capture at a different scale or viewport size
Configuration options include scale, windowWidth, windowHeight, useCORS, and proxy-related controls. For higher-resolution output, the documented examples use scale: window.devicePixelRatio. Increasing scale also increases the canvas dimensions and memory demands, so it is not a free quality improvement.
If the rendered area or desired viewport differs from the current window, the examples show setting windowWidth and windowHeight from the element’s scroll dimensions. For example:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
const element = this.captureArea.nativeElement;
const canvas = await html2canvas(element, {
windowWidth: element.scrollWidth,
windowHeight: element.scrollHeight
});
Use the size options intentionally: a taller or wider output can exceed device-specific canvas limits even if the element appears normally on screen. There is no single safe maximum dimension for every browser and device.
Rank #4
Omit controls or adjust the cloned document
If buttons or other interface elements should not appear in the output, the documented ignore mechanism includes the data-html2canvas-ignore attribute; an ignore option is also described. The onclone option lets you make changes to the cloned document used during rendering. These approaches allow the capture to differ from the live page without treating html2canvas as a native screen grab.
Understand what the image represents
html2canvas traverses the DOM and recreates content using the CSS and other page information it knows how to render. It does not take an actual browser screenshot, so unsupported or incompletely supported CSS can make the result differ from what the user sees. The project documentation cautions that the result “may not be 100% accurate to the real representation.” Treat the canvas as a rendered approximation of the selected DOM, and check the actual output for the layouts and styles your app depends on.
That distinction matters when deciding whether this is the right approach. Use html2canvas when the goal is to render a particular DOM element into a canvas from the page. If you need a literal device screenshot, or need to save an image through native platform facilities, that is a different task; the available information does not identify a specific native capture API or Ionic plugin to recommend.
Best Value
Handle remote images and embedded content
Cross-origin images
Browser security rules affect whether remote images can be drawn into a canvas. By default, html2canvas may skip images that would taint the canvas. Setting useCORS can help only when the image host sends suitable CORS headers; the option cannot grant permission that the remote server does not provide. A correctly configured proxy is another documented control, but it must be arranged for the relevant image requests.
If an image is absent from the result, check its origin and the response headers before changing capture code. A same-origin image and a remote image with suitable CORS configuration are different cases, even if both display successfully in the live page.
Iframes
Same-origin iframe content is documented as recursively supported. Cross-origin iframe content cannot be read through the inaccessible document, and some sandboxed frames are also unsupported. If a capture omits an embedded frame, first determine whether it is same-origin and how it is sandboxed; html2canvas cannot bypass the browser’s cross-origin access rules.
Troubleshoot common capture failures
| Symptom | Likely cause | What to check |
|---|---|---|
| The captured image differs from the visible page | The output is reconstructed from the DOM and supported rendering information rather than taken as a literal screenshot; some CSS may not be reproduced exactly. | Inspect the output for the specific styles or layout that differ, and confirm the feature is supported by the library’s rendering behavior. |
| A remote image is missing | The image is cross-origin and the server does not provide suitable CORS headers, so it cannot be safely drawn into the canvas. | Check the image host’s CORS response. Use useCORS only when the host allows it, or configure an appropriate proxy. |
| An iframe is absent | The frame may be cross-origin or sandboxed in a way that prevents access to its document. | Check the frame’s origin and sandbox configuration. Cross-origin iframe content cannot be rendered by accessing its protected document. |
| The output is blank, clipped, or incomplete for a large element | Canvas size limits vary with browser, operating system, GPU, and available device memory; an oversized canvas may fail without a clear error. | Reduce the capture area, review its scroll dimensions, and lower the output scale. |
| The import cannot be resolved | The import path may not match the package installed in the project. | Compare package.json and the lockfile with the scoped or unscoped package import form, and use the matching one. |
Or skip the browser setup
If you need a clean screenshot of a public webpage by URL rather than a canvas made from a particular live Ionic DOM element, ScreenshotNeo is a website screenshot API and MCP server. It is not a drop-in replacement for capturing an in-app div. A single GET request can return a PNG, JPEG, WebP, or PDF; this cURL example saves a WebP screenshot:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for the API details. Before a capture, it can accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and other MCP clients.
The free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is available on every plan, and yearly billing gives two months free. Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month without a card.
Frequently Asked Questions
Is the captured canvas still an interactive Ionic page?
No. The result is an image representation of the selected content, not a second live DOM with working buttons or form controls.
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.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitches

