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.

If dom-to-image rejects, returns a blank image, or leaves content out, first capture the complete error and try exporting a small, stable DOM node. Then isolate the failure in this order: page timing, asset loading, canvas security, and browser/runtime behavior. There is no single fix for every conversion error; the exact package version, browser, and failing content matter.

Start by capturing the full failure

The top-level conversion methods return promises, so an empty result alone does not tell you whether the failure occurred while preparing the DOM and its resources or later during SVG decoding and rasterization. Log the rejected error before changing code. The dom-to-image README describes the library’s DOM-to-SVG-to-image approach and promise-based API.

try {
  const dataUrl = await domtoimage.toPng(target);
  console.log(dataUrl);
} catch (error) {
  console.error('dom-to-image conversion failed:', error);
}

For a promise chain, attach a rejection handler:

domtoimage.toPng(target)
  .then((dataUrl) => {
    console.log(dataUrl);
  })
  .catch((error) => {
    console.error('dom-to-image conversion failed:', error);
  });

Keep these details with the error: browser and version, the installed dom-to-image package version, the method and options used, the target element, and URLs for relevant images, fonts, or stylesheets. Check the browser console and Network panel for failed requests as well as the rejection itself.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Verify that the target and page are ready

Capture only after the target exists in the live DOM and the resources and styles it depends on have loaded. If the target is inserted dynamically, wait for the framework or application update that creates it; selecting a node before that point can mean exporting the wrong element or no useful content.

#1 Best Overall
Sale
Kodak PIXPRO FZ45 Digital Camera, 16MP Point & Shoot (Black)
  • 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
  • Optical Zoom: 4x optical zoom with a 27mm wide angle lens for flexible framing indoors or outdoors
  • Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
  • Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
  • LCD Screen and Battery: 2.7in LCD screen with 2 AA alkaline batteries for convenient on-the-go use

Wait for stylesheets and fonts

A stylesheet added immediately before capture may not yet have been parsed into the CSSOM. The related dom-to-image-more documentation specifically warns that newly inserted stylesheets may not expose their @font-face rules in the same tick. Wait for the stylesheet’s load event and, where appropriate, for document.fonts.ready before converting.

async function waitForStylesheet(link) {
  if (link.sheet) return;
  await new Promise((resolve, reject) => {
    link.addEventListener('load', resolve, { once: true });
    link.addEventListener('error', reject, { once: true });
  });
}

await waitForStylesheet(document.querySelector('link[rel="stylesheet"]'));
if (document.fonts?.ready) {
  await document.fonts.ready;
}
const dataUrl = await domtoimage.toPng(document.querySelector('#capture'));

Adapt the selector to the stylesheet and target your app actually uses. Do not wait for a stylesheet load event after it has already completed; the helper above checks link.sheet first, but applications with complex stylesheet loading should track the load promise when creating or inserting the link.

Wait for images used by the target

Before capture, inspect the images within the target and confirm their loads have completed. An image that is still loading, has a bad URL, or is blocked may be missing from the serialized output or cause a conversion failure depending on the library version and options. Also check CSS background images: they do not appear in target.querySelectorAll('img'), so inspect computed styles and network requests for them separately.

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

Find asset and origin problems

When text, images, or styling is missing, isolate the resources before rewriting the capture code. Open DevTools and look for failed or blocked image, font, and stylesheet requests; verify that the requested URL is correct and that the browser can access it. Remote content is not automatically embeddable just because it renders in the page.

Rank #2
Sale
Kodak PIXPRO FZ55-BK 16MP CMOS Sensor Camera 5X Optical Zoom 28mm Wide
  • 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
  • Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
  • Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
  • Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
  • LCD Screen and Battery: 2.7in LCD screen and a rechargeable lithium-ion battery for on-the-go use

Images, background images, and fonts

Cross-origin rules can affect whether assets can be read and embedded. The original project’s README notes that image failures can cause conversion failure depending on options. Check whether the asset host permits the required cross-origin access and whether the browser’s console reports a CORS or network error. A page that displays a remote image can still encounter restrictions when code tries to export content containing it.

The related dom-to-image-more implementation documents onImageError diagnostics, requestInterceptor, and imagePlaceholder. It also documents loadExternalStyleSheet as an opt-in way to handle font discovery when cross-origin stylesheet rules cannot be read. These names and behaviors belong to that related implementation; do not pass them to the original dom-to-image package unless the documentation for your installed package and version confirms support.

SVG content

If the target contains inline SVG or an image loaded from an SVG URL, test it separately from ordinary text and raster images. An issue title such as “Error exporting page containing SVG” is evidence that a user reported a concern, not proof of a defect in every release. Remove the SVG temporarily; if the simpler target converts, add back the SVG and its external references incrementally. Check the console for failed resource loads or decoding errors.

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

Check canvas and WebGL content

A canvas embedded in the target can be captured only if browser security permits its pixels to be read. If cross-origin content was drawn into the canvas without appropriate access, the canvas may be tainted; the original README cautions that a tainted canvas may prevent rendering. Trace the canvas’s drawing code back to the source image or other resource and confirm that the source host allows the access your application needs.

Rank #3
Sale
Digital Camera, Latest FHD 1080P Digital Camera for Teens with SD Card Anti Shake Point and Shoot Cameras Portable 16X Zoom Compact Small Cameras for Kids Boys Girls Seniors with Wrist Strap
  • Latest Digital Camera Built-in Fill Light : This compact digital camera is paired with a powerful CMOS processor and image stabilization to help you take & record the most exciting moments in 44 MP quality images & FHD 1080P quality videos anywhere, anytime. Plus, there is also a built-in fill light to help you take high quality pictures even in low light&dark settings, making this the perfect camera for all indoors/outdoors situations.
  • Long-Lasting Battery Life & 16X Digital Zoom :This point and shoot camera will retain its battery charge even after long use. The controls and functions are easy to operate making this the perfect choice for children, teens and younger. This kids camera supports 16x digital zoom, you can zoom in or out the subject by pressing the W/T button for taking still photos to zoom in or out on distant objects and capture all the details you need.
  • Multifunctional & Portable Digital Camera: This cheap digital camera is slim enough to fit in your pocket. You'll easily be able to take it with you on all your indoor/outdoor activities and adventures and ideal for beginners, children and teenagers. This kids digital camera is equipped with 20 filters, anti-shaking, self-timer, continuous shooting, date stamp, time-lapse recording, smile capture, internal MIC and speaker (recording sound videos), great for your daily photography needs.
  • WEBCAM & PAUSE FUNCTION : More than just a FHD 1080p digital camera, it also works as a webcam for video calls and vlogging. Connect the camera to the computer, press shutter and power button at the same time and the camera will automatically turn on webcam mode for all your video calling and live streaming needs. The pause function allows you to pause when seeing playback videos.
  • A Must Have Photography Device : This digital camera with SD card made from high-quality materials, this retro camera is safe and durable. Perfect for all ages to develop & improve their photographic abilities and observation skills. Our dedicated and experienced 24/7 support team is available for all after purchase troubleshooting, questions and technical help.

For WebGL, the related dom-to-image-more documentation explains a separate timing constraint: the drawing buffer may be cleared after compositing unless the WebGL context was created with preserveDrawingBuffer: true. That setting must be supplied when creating the context; a screenshot library cannot enable it retroactively. Treat this as guidance for the related implementation and your browser’s WebGL behavior, not as a universal fix for every canvas failure.

Separate library issues from browser/runtime limits

dom-to-image uses SVG as an intermediate representation, including SVG foreignObject rendering. Browser handling and image decode timing can therefore affect the final output. The related dom-to-image-more documentation cautions that Safari’s handling of foreignObject and image decoding may produce blank or inconsistent output. The original README also mentions a Firefox issue involving external stylesheets. These are implementation-dependent caveats, not guarantees about every current browser release.

Run the same minimal reproduction in the exact browser and version where the issue occurs, then compare it with another browser if available. Also verify that the code runs in a browser environment with a DOM. The related project’s documentation says server-side rendering calls without a browser DOM are unsupported; a Node process alone is not a substitute for a browser page.

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

Reduce the reproduction one content type at a time

Use a controlled target to find the feature that correlates with failure. Begin with plain text and a solid background, then add one category at a time:

Rank #4
Kodak PIXPRO FZ55-RD 16MP Camera 5X Optical Zoom 28mm Wide Angle 1080p
  • 16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting
  • Optical Zoom: 5x optical zoom with a 28mm wide angle lens for flexible framing indoors or outdoors
  • Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
  • Memory Support: Works with Class 10 SD, SDHC, or SDXC cards up to 512GB
  • LCD Screen and Battery: 2.7in LCD screen and a rechargeable lithium-ion battery for on-the-go use
  1. Plain text and basic inline styling.
  2. External and embedded stylesheets, followed by web fonts.
  3. Raster images and CSS background images.
  4. Inline and externally loaded SVG.
  5. Canvas and WebGL content.

After each addition, capture and record whether the error, blank output, or omission returns. This narrows the problem to resource preparation, a particular asset origin or content type, or final browser rasterization. It is a debugging method, not a claim that a specific defect has been reproduced.

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

Common symptoms and what to check

Symptom First checks Next action
Promise rejects Log the complete rejection; inspect console and network errors. Reduce the target and identify the first asset or feature that makes the rejection return.
Blank output Confirm the target is live and ready; check stylesheet/font timing and browser behavior. Try a plain-text target, then add styles and resources incrementally.
Images or backgrounds missing Check URLs, load state, network failures, and cross-origin permissions. Test each resource separately; do not assume a displayed remote asset can be exported.
Font differs or falls back Check font request success, stylesheet timing, and whether font rules are readable. Wait for stylesheet loading and, when appropriate, document.fonts.ready.
Canvas or WebGL is missing Check whether the canvas is tainted and how the WebGL context was created. Resolve source-origin access; for WebGL, configure buffer preservation at context creation if required.
Works in one browser but not another Record exact browser/version and check SVG foreignObject and decode behavior. Keep a minimal reproduction and verify support for the exact package version.
Fails only in server-side code Check whether a real browser DOM exists in that runtime. Run the conversion in a browser context or use a browser-based capture approach.

Or skip the browser setup

If your goal is a website screenshot rather than exporting a node already rendered in your app, ScreenshotNeo provides a screenshot API and MCP server. A single GET request captures a URL; use the API documentation at ScreenshotNeo docs for available formats and options.

curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://stripe.com 
  -o shot.webp

Replace YOUR_API_KEY with your key and change the target URL as needed. The response can be PNG, JPEG, WebP, or PDF. ScreenshotNeo accepts cookie/consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers say which page verdict applied and whether it was billed. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

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

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

Keep the diagnosis tied to the exact package

The original dom-to-image project and the maintained related dom-to-image-more project are not interchangeable evidence. Confirm the installed package and version before using option names or assuming a reported issue applies. GitHub issue titles—including reports about SVG export, font-family, and border-image behavior—describe individual concerns; they do not establish prevalence, current status, or universal reproducibility.

Frequently Asked Questions

Does dom-to-image work without a browser?

The conversion depends on a browser DOM and rendering behavior. The related dom-to-image-more documentation describes calls without a browser DOM as unsupported.

Do options documented for dom-to-image-more also work in dom-to-image?

Not necessarily. Confirm every callback or option against the documentation for the exact package and version installed.

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

Quick Recap

SaleBestseller No. 1
Kodak PIXPRO FZ45 Digital Camera, 16MP Point & Shoot (Black)
Kodak PIXPRO FZ45 Digital Camera, 16MP Point & Shoot (Black)
16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting; Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
$99.99
SaleBestseller No. 2
Kodak PIXPRO FZ55-BK 16MP CMOS Sensor Camera 5X Optical Zoom 28mm Wide
Kodak PIXPRO FZ55-BK 16MP CMOS Sensor Camera 5X Optical Zoom 28mm Wide
16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting; Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
$139.99
Bestseller No. 4
Kodak PIXPRO FZ55-RD 16MP Camera 5X Optical Zoom 28mm Wide Angle 1080p
Kodak PIXPRO FZ55-RD 16MP Camera 5X Optical Zoom 28mm Wide Angle 1080p
16MP Sensor: Captures detailed photos with a CMOS sensor for everyday shooting; Full HD Video: Records 1080p video for travel clips, family moments, or simple vlogging
$139.99

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.