Open Ram21224 opened 4 years ago
I have experienced this issue too. I've fixed by using HTML5 canvas. Here is my sample code.
<img id="img1" src="~/assets/images/preview.png" style="display:none" />
<canvas id="canvas1"></canvas>
var background = document.getElementById("img1");
var canvas = document.getElementById("canvas1");
var ctx = canvas.getContext("2d");
canvas.width = 630;
canvas.height = 331;
ctx.drawImage(background,0,0);
ctx.font = '12px Arial';
ctx.fillText("Testing ", 100, 100);
var pngData = canvas.toDataURL('image/png');
Im capturing div data as image using dom-to-image, but base64 from safari is missing background image.
jsfiddle
Expected behavior
Actual behavior (stack traces, console logs etc)
Library version
Browsers