Recommended Free Tools
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use a namespace import, call the function only after the Ionic view has mounted in a browser, and verify the package that your lockfile actually resolves. In most Ionic React projects, domtoimage.toPng is undefined because the import shape does not match the package export—not because the element contains a difficult image. Once the method exists, handle rendering failures such as CORS, fonts, or unloaded images as a separate problem.
What the error means
The dom-to-image API exposes top-level functions that accept a DOM node and return promises fulfilled with data URLs. The expected call is:
const dataUrl = await domtoimage.toPng(node);
If JavaScript reports that toPng is undefined, first inspect domtoimage itself. You may have imported a default value when the bundler provided a module namespace, loaded a different copy of the package, or executed code before a browser DOM existed. Do not start by changing CSS or image URLs; those issues normally produce a rejected promise after toPng has been found.
1. Install and verify the dependency
Install the package in the Ionic project
From the directory containing your Ionic React package.json, run:
#1 Best Overall
- 【1080P 60FPS Video Capture Card】 This HDMI game capture card is based on USB3.0 high speed transmission port, input resolution up to 4K@30HZ, output resolution up to 2K@30Hz or 1920×1080@60Hz. Type c and USB interface can meet most of the devices in daily life. Easily meet the online capture, real-time recording, online meetings, live gaming and other functions, so you have a better visual enjoyment. Note: For capture use only; requires capture software to function and is not intended for direct screen casting to a monitor or TV
- 【Ultra Low Latency Screen Sharing】 HDMI capture card is made of good quality aluminum alloy with strong heat dissipation, allowing you to enjoy ultra low latency while live gaming or video recording or live streaming, avoiding blue screens and lag. This HDMI to USBC capture card supports easy recording of good quality audio or HD video and transferring it to your computer or streaming platform, allowing you to record 60 fps HD video directly on your hard drive and real-time preview
- 【Plug and Play, Easy to Carry】 This HDMI 1080P video capture card does not require any additional drivers or external power supply, just plug and play for fast capture. The capture card is small and lightweight, so you can put it in your bag for emergencies, making it very portable for outdoor live streaming. It's also a great way to share content in game recording, video conference, video recorder and online teaching
- 【Wide Compatibility USB Capture Card】 Easily streams to Facebook, Youtube or Twitch. With the connection, this HDMI to USB C/3.0 video capture devices can be working on several Operating Systems and various software: Windows 7/ 8/ 10, Mac OS or above, Linux, Android, Laptop, Xbox One, PS3/PS4/PS5, Camera, DVDs, Set Top Box, Webcame, DSLR, Switch/Switch 2, TV BOX, HDTV, Potplayer/VLC, ZOOM, OBS Studio etc.
- 【Package Content & Note】 1x HD Audio Capture Card , 1x USB 3.0 to USB C Adapter (A-side 3.0, B-side 2.0), 1x user manual. Please note that you need to restart the OBS Studio software after the audio setup is complete, otherwise it will result in no sound output. When using an adapter, if the device is recognized as USB 2.0, try using the other side with the USB-C port. Simply flip the capture card and reconnect it to be recognized as USB 3.0
npm install dom-to-image
Confirm that both package.json and the lockfile name the package you intend to use. Check for duplicate, aliased, or transitive copies when a monorepo or workspace is involved. npm currently lists the original package as version 2.6.0 and says it was last published about nine years ago. That age makes stale lockfiles and multiple resolved copies especially plausible.
Inspect what your application receives
Temporarily log the imported value in a browser-only path:
console.log('dom-to-image export:', domtoimage);
console.log('toPng type:', typeof domtoimage.toPng);
You need to see a function for the second log. If the import object is wrapped (for example, under a default property), do not guess which property to use across every build. Try the namespace import below, then rebuild and inspect the result. Also remove an accidental duplicate dependency and regenerate the lockfile only when you understand which package entry is being changed.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
2. Use the import shape that works in Ionic React
Preferred ES-module form
In an Ionic React component, import the module namespace:
import * as domtoimage from 'dom-to-image';
Then call domtoimage.toPng(node). An Ionic community integration reports this namespace form as the working pattern. A default import such as import domtoimage from 'dom-to-image' can produce a value whose toPng property is absent, depending on the TypeScript and bundler interop settings.
Rank #2
- [Enhanced 4K-1080P Video Capture Experience] Capture the Magic: Elevate your video recordings to new heights with our upgraded anti-static 1080P Video Capture Card. Immerse yourself in stunning visuals, supporting HDMI input at 4K 60FPS and USB output for capturing in 1080P, complete with rich stereo sound. Enjoy crystal-clear video recordings, dynamic gaming live streams, and professional conference broadcasts. Note: HDMI resolution: Max input can be 3840×2160@30Hz / Video output resolution: Max output can be 1920×1080@30Hz
- [Seamless Real-Time Preview] Stay in the Moment: Our advanced ultra-low latency technology ensures seamless real-time transmission of video streams. Experience instant, lag-free previews, allowing you to capture every detail precisely. Effortlessly record video directly to your hard disk, all without compromising on quality or introducing any delays.
- [Versatility and Broad Compatibility] Your Creative Hub: Connect your DSLR, camcorder, or action camera to a wide range of operating systems, including Windows, MacOS, and Linux. Unlock a world of possibilities with real-time streaming to popular platforms like Twitch, Youtube, OBS, Zoom, Potplayer, and VLC, giving you the tools to share your content effortlessly.
- [Effortless Plug and Play] Simplicity Redefined: Say goodbye to complex installations. Our plug-and-play design eliminates the need for drivers or external power supplies. Seamlessly integrate high-definition acquisition into various scenarios, whether it's educational recordings, immersive gaming, precise medical imaging, captivating live streams, or professional broadcasting.
- [Seize Every Detail with Precision] Unleash your creativity and attention to detail with our video capture card. Capture every nuance, every color, and every moment with precision, thanks to the enhanced capabilities of our technology. Whether you're a content creator, a gamer, or a professional, our capture card empowers you to seize the finest elements and bring them to life in your recordings and live streams.
CommonJS projects
If your toolchain is CommonJS-compatible, the project README documents:
const domtoimage = require('dom-to-image');
Do not mix require, a default import, and namespace access without checking the actual runtime object. The correct choice is the one that leaves typeof domtoimage.toPng equal to 'function' in the built application.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →3. Capture only after Ionic has mounted the element
Why timing matters
dom-to-image needs a real browser DOM. Do not call it at module scope, during server rendering, or while the first render is still constructing the target. In Ionic, routed views and WebView content can mount after the component function initially runs. Obtain the node from a ref or an ID inside an event handler or a client-side effect.
A maintained fork, dom-to-image-more, explicitly recommends a typeof window !== 'undefined' guard or a client-only dynamic import and rejects render calls made without a browser DOM. The same lifecycle discipline prevents the original package from being invoked too early.
Minimal Ionic React component
import { useRef } from 'react';
import * as domtoimage from 'dom-to-image';
export function CaptureCard() {
const cardRef = useRef<HTMLDivElement>(null);
async function savePng() {
const node = cardRef.current;
if (!node || typeof window === 'undefined') return;
try {
const dataUrl = await domtoimage.toPng(node);
const link = document.createElement('a');
link.download = 'card.png';
link.href = dataUrl;
link.click();
} catch (error) {
console.error('DOM capture failed', error);
}
}
return (
<>
<div ref={cardRef}>Capture me</div>
<button type="button" onClick={savePng}>Save PNG</button>
</>
);
}
The ref is null until the target has rendered. The click handler therefore runs at the right time, and the guard prevents a server-side invocation. If your target is selected by ID instead, check the result explicitly:
Rank #3
- 【4K HDMI Input, 2K@30Hz Recording】Powered by a true USB 3.0 high-speed interface, the capture card supports up to 4K@30Hz HDMI input and records at 2K@30Hz or 1080P@60Hz. Perfect for gamers, streamers, and professionals who need crisp, smooth video for live streaming, gameplay recording, or online meetings.
- 【Ultra Low Latency Screen Sharing】Built with a premium aluminum alloy shell and advanced chipset for stable heat dissipation, ensuring ultra-low latency transmission. Capture high-quality video and dual-channel audio in real time—no lag, no frame drop—ideal for Twitch, YouTube, or OBS streaming.
- 【Easy Plug and Play, Compact & Portable】No driver or external power required—just plug and play via USB 3.0 or Type-C connection to your Windows or macOS computer. Lightweight and compact design makes it easy to carry for outdoor streaming, live shows, or mobile recording setups.
- 【Wide Compatibility & Multi-Device Support】Compatible with Windows 7 8 10 11, macOS, Linux,Android and supports most popular software such as OBS, Zoom, VLC, Twitch Studio, and more. Works seamlessly with PS4, PS5, Xbox, Switch, DSLR cameras, TV boxes, and other HDMI-output devices for streaming to YouTube, Twitch, etc.
- 【What You Get】Includes: HDMI Capture Card, USB 3.0 to USB-C Adapter, User Manual. Tips: Make sure your tablet’s OTG function is enabled before connecting. Test your HDMI device with a monitor first to confirm video and audio output, then connect to the Video Capture Card for recording.
const node = document.getElementById('capture');
if (!node) throw new Error('Capture target not mounted');
const dataUrl = await domtoimage.toPng(node);
4. Separate an undefined method from a failed render
When toPng is undefined
- Change a failing default import to
import * as domtoimage from 'dom-to-image'. - Check that the resolved package is really
dom-to-image, not an alias or a second copy. - Verify the built browser bundle, not only a development-only import.
- Ensure the call is not happening in server-rendered or pre-mount code.
When toPng exists but the promise rejects
That is a rendering or resource problem. Cross-origin images, web fonts, external stylesheets, SVG resources, and tainted canvases can all affect the result. Make sure images have finished loading before capture and keep the try/catch around the promise. The original README notes that failed images can throw unless an imagePlaceholder is supplied. A placeholder can keep an unavailable image from aborting the entire export, but it does not fix missing CORS permission.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →For a deterministic export, wait until the content you need is present, use same-origin or CORS-enabled assets, and test the exact Ionic WebView where the feature will run. A desktop browser success does not prove that a mobile WebView has identical font, SVG, or network behavior.
5. Decide whether to stay on the original package
| Consideration | dom-to-image |
dom-to-image-more |
|---|---|---|
| Import and call | Namespace import and domtoimage.toPng(node) are the documented shape. |
Documents the same call, so the application-level API is familiar. |
| Maintenance | npm lists version 2.6.0 and a publication roughly nine years ago. | Maintained fork with current documentation focused on browser resources and SSR. |
| Resource diagnostics | README discusses failed images and an imagePlaceholder option. |
Documents resource interception, image-error reporting, font and stylesheet handling. |
| Runtime target | Requires a browser DOM for capture. | Also requires a browser DOM and documents guards or client-only loading for SSR. |
Migrate as a compatibility test rather than a blind replacement. Update the import, capture a representative card in a real browser and Ionic WebView, and compare fonts, SVG, external images, and layout. Keep the original package if its output is correct and its age is acceptable for your maintenance policy; choose the fork when its diagnostics or resource handling address a problem you actually have.
6. Troubleshooting checklist
Symptom: “Cannot read properties of undefined (reading ‘toPng’)”
Cause: The imported value is not the module namespace expected by the package. Fix: switch to the namespace import, rebuild, and log the export object and typeof domtoimage.toPng.
Symptom: toPng is not a function after changing imports
Cause: A different package copy, alias, or interop wrapper is being bundled. Fix: inspect package.json and the lockfile, remove unintended duplicates, and use the CommonJS form only when the project actually uses CommonJS.
Rank #4
- 【1080P HD High Quality】Capture resolution up to 1080p for video source and it is ideal for all HDMI devices such as PS4, PS3, Xbox One, Xbox 360, Wii U, DVDs, DSLR, Camera, Security Camera and set top box. Note: Video input supports 4K30/60Hz and 1080p120/144Hz. Does not support 4K120Hz/144Hz. Output supports up to 2K30Hz.
- 【Plug and Play】No driver or external power supply required, true PnP. Once plugged in, the device is identified automatically as a webcam. Detect input and adjust output automatically. Won't occupy CPU, optional audio capture. No freeze with correct setting.
- 【Compatible with Multiple Systems】suitable for Windows and Mac OS. High speed USB 3.0 technology and superior low latency technology makes it easier for you to transmit live streaming to Twitch, Youtube, Facebook, Twitter, OBS, Potplayer and VLC.
- 【HDMI LOOP-OUT】Based on the high-speed USB 3.0 technology, it can capture one single channel HD HDMI video signal. There is no delay when you are playing game live.
- 【Support Mic-in for Commentary】Rybozen capture card has microphone input and you can use it to add external commentary when playing a game. Please note: it only accepts 3.5mm TRS standard microphone headset.
Symptom: The ref is null
Cause: Capture runs before the Ionic view mounts or after it has unmounted during navigation. Fix: invoke capture from a user action or a client-side effect after rendering, and return early when ref.current is null.
Symptom: SSR or build-time error mentioning window or document
Cause: Browser-only code executed on the server or during module evaluation. Fix: move the import or call into client-only code, guard with typeof window !== 'undefined', and never capture during server rendering.
Symptom: Export rejects, is blank, or misses images
Cause: The method exists, but a resource failed, is cross-origin, or was not loaded. Fix: wait for images and fonts, verify CORS and stylesheet availability, inspect the caught error, and use an image placeholder where the library supports it.
Symptom: It works on desktop but not in an Ionic WebView
Cause: WebViews can differ in font availability, SVG support, network permissions, and timing. Fix: test the actual device runtime, use assets the WebView can fetch, and capture only after the view and its resources are ready.
Performance, reliability and cost considerations
A DOM-to-image export runs in the user’s browser and can consume memory proportional to the target’s size and its rasterized resources. Keep capture regions bounded when a full page is unnecessary, avoid triggering several captures at once, and release references when a routed view unmounts. Large, font-heavy cards and pages with many external images are more likely to expose timing or resource failures than a simple same-origin component.
Best Value
- AV TO USB Converter: Capture videos and audios from VHS, VCR, Hi8, DV tapes to a PC, with the help of our USB Video Converter. Save room while digitizing your favorite old memories
- Quality Capture Card: Our USB Video Capture Card converting anolog RCA composite input into HD 720P USB output and capturing audio without any sound card. Advanced signal processing technology provides you with great precision, colors, resolutions, and details.
- Plug and Play: Automatically install the driver once you hook up this RCA to USB Converter to a PC. No external power is needed. User-friendly and easy to operate
- Wide Compatibility: The Video Capture Card can work with video devices with RCA connector or S-Video connector, such as VHS, VCR, Hi8, camcorder, compatible with Windows and Mac OS. Support video formats like NTSC, PAL, and support brightness, contrast, hue, and saturation control
- Note: The Video Converter is used with acquisition software. We recommend OBS Studio or PotPlayer for Windows, and QuickTime Player for Mac. They can be downloaded for free online. Please operate according to the steps in User Manual or contact us if you have any questions
For reproducible server-side captures, move the job out of the WebView instead of trying to make SSR render a browser-only library. ScreenshotNeo is a website screenshot API and MCP server for developers; it returns PNG, JPEG, WebP, or PDF from one request. It is not a drop-in replacement for a local DOM node, but it is useful when the input is a reachable URL rather than an in-memory React component.
Or skip the browser setup
When a URL is all you need, ScreenshotNeo can capture it without installing Chromium or managing Ionic browser timing. Its cleaner capture accepts cookie or consent banners before removing more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and whether it was billed. The service also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
See the ScreenshotNeo API documentation for the complete option set. A direct request looks like this:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorscurl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same request in 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)
And in 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 lazy-image loading, CSS-selector element capture, dark mode, 12 device presets plus arbitrary viewports, retina scale, PDF paper and page-range controls, HTML/CSS-to-image, custom JavaScript and CSS, clicks before capture, hidden selectors, waits for selectors, delays or network idle, request and resource blocking, custom headers, cookies, user agents, Authorization, timezone and geolocation, transparent backgrounds, resizing, selectable cache TTLs, signed image links, asynchronous jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, an OpenAPI specification, and compatibility with parameter names used by other screenshot APIs.
| 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 |
Yearly billing gives two months free, and every feature is available on every plan. Start with 1,000 free screenshots a month with no card.
FAQ
Can I use the same component with a maintained fork?
Usually the application call remains domtoimage.toPng(node), but treat the change as a compatibility test and verify fonts, SVG, external images, and the Ionic WebView before shipping.
Will a server screenshot service capture an unsaved React state?
No. A URL-based service sees the page it can load over the network; it cannot see a component that exists only in a user’s in-memory state. Use the local DOM approach for that case, or expose the state through a URL before requesting a server capture.
Frequently Asked Questions
Can I use the same component with a maintained fork?
Usually the application call remains domtoimage.toPng(node), but treat the change as a compatibility test and verify fonts, SVG, external images, and the Ionic WebView before shipping.
Will a server screenshot service capture an unsaved React state?
No. A URL-based service sees the page it can load over the network; it cannot see a component that exists only in a user’s in-memory state. Use the local DOM approach for that case, or expose the state through a URL before requesting a server capture.
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.

