Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dom-to-image SVG image elements

Tags:

image

svg

d3.js

I'm using the brilliant dom-to-image to capture a screenshot of a d3.js dashboard and download as a png.

I've found it works better than it's competitors - the CSS transfers beautifully - but I've come across a stumbling block.

I have some SVG image elements in my dashboard:

<image x="20" y="20" width="300"height="80" 
xlink:href="image/my_image.png"/>

These are either embedded directly onto the svg or as pattern definitions and they are not rendering on the PNG.

This is a know problem and one which has come up on Stack Overflow before but I haven't been able to find a solution. Any thoughts?

like image 305
Bmil Avatar asked Dec 31 '25 22:12

Bmil


1 Answers

For me what worked was installing html-to-image and not using dom-to-image

like image 103
Maurici Abad Avatar answered Jan 03 '26 13:01

Maurici Abad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!