tsayen / dom-to-image

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

Rendering images in node does not work? #309

Open Aaarrrgggh opened 4 years ago

Aaarrrgggh commented 4 years ago

Hello all,

I'm using this library to generate images from node, with 1200x600 dimensions. This node contains several small images, at least 4 other small images.

None of those small images appear in the generated image.

Here is my code:

            domtoimage.toPng(document.getElementById('main'), { quality: 0.95, width:1200, height:600 })
    .then(function (dataUrl) {
        var link = document.createElement('a');
        /*link.download = '{{file}}';
        link.href = dataUrl;
        link.click();*/
        var img = new Image();
        img.src = dataUrl;
        document.body.appendChild(img);
    });

On Firefox, I have a problem for fetching resource (Javascript error). It does not work. On Chrome, It's working, except there is no image.

In a local environment, this works perfectly.

Someone has an idea?

Thanks all,

Alexander

KavinduAkash commented 1 year ago

I am also facing the same issue. @Aaarrrgggh did u fix this?