tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.21k stars 1.68k forks source link

Image of svg element from DOM is not embedded in png. #396

Open bveeni opened 2 years ago

bveeni commented 2 years ago

Hi everyone, My DOM contains svg element-under div element, which is created using javascript. And that svg has image element,as shown in attached image(html.png). With this domtoPng, in downloaded png file, I am able to see all elements from dom, except this image of svg,(which I set it as background for graph) . When I run my app, I can see the image (i.e included in my dom) as shown in expected image.But png file, that I got by downloading using domtopng excludes that image.You can check on result.png, that shows missing image. Please let me know, if anyone comes with such issue. expected html result

Thanks Binita Shrestha

tanrich commented 2 years ago

I have the same problem

bveeni commented 2 years ago

Hey @tanrich dom-to-image.min.zip

I solved this issue using this js file. You can try using this file.

Thanks

tanrich commented 2 years ago

Thanks

I don't understand. What's the difference. Thanks.

bveeni commented 2 years ago

Somewhere I found this file and suggested to try using this one and that worked for me. I don't remember exactly what changes I made. I am not sure if this will work for you but yes, you can give a try.

grumblerbear commented 1 year ago

Hi! Your solution great work with fill: url(#namePattern) but not work with stroke: url(#namePattern), maybe you can add this feature, please?

mauriciabad commented 1 year ago

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

grumblerbear commented 1 year ago

https://root.lacony.ru/eclipse i try use html-to-image there (when click on one object) but its work bad, if dom-to-image just wrong work with svg, this lib create strange gradients