tsayen / dom-to-image

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

images in DOM are not converting into base64 #362

Open Talal0 opened 3 years ago

Talal0 commented 3 years ago

I'm using dom-to-image in ionic4 project it is working fine in android but in iOS is not converting showing blank space inside container

csandman commented 3 years ago

According to the readme, Safari is not supported:

Safari is not supported, as it uses a stricter security model on <foreignObject> tag. Suggested workaround is to use toSvg and render on the server.`

https://github.com/tsayen/dom-to-image#browsers

I would assume this goes for both MacOS and iOS

Ginhing commented 3 years ago

Solved this issue by translate the network image into base64 by canvas.toDataURL before using dom-to-image on safari

nattapat-cop commented 3 years ago

@Ginhing can you show example i have same problem for image it already base64 but still showing blank space

jijojosein commented 1 year ago

Had the same issue on Safari. Used SVG instead of png and the issue was solved.