But because my div have filter dr" /> But because my div have filter dr" /> But because my div have filter dr"/>

How to use dataURL to save div image With drop-shadow outline? (codepen link in cmt)

179 Views Asked by At

I want to use toDataURL to download specific div image

 <div class="webtoonImage">
    </div> <!--side display webtoon-->

But because my div have filter drop-shadow as an outline border. So that why the toDataURL didn't capture it.

.container {
  display: grid;
  filter: drop-shadow(1px 0px 0px black) 
    drop-shadow(-1px 0px 0px black)
    drop-shadow(0px 1px 0px black) 
    drop-shadow(0px -1px 0px black)
    drop-shadow(1px 1px 0px black);
}

I was wonder is it possible to save the image with the drop-shadow outline border?

Here is the video link of the problems: video link demonstate problem

Explain problme in image form: When I click download button: clicking download button

This is how the image div is downloaded download image no border

There is no border outline , the dataURL didn't capture the drop-shadow outline border downlaod image no border outline quesiton mark

The drop-shadow is at the .container class width drop-shadow outline clip path balloon

This is when I turn off the drop-shadow no drop-shadow

Here is the toDataURL function to donwload the .div .webtoonImage:

function downloadWebtoonDesktop() {
    html2canvas(document.querySelector(".webtoonImage")).then(function(canvas) {
        // document.body.appendChild(canvas);
        console.log("hello")
        var dataURL = canvas.toDataURL("image/png");
        let downloadLink = document.createElement('a');
      downloadLink.setAttribute('download', 'DiamondWebtoonLayout-Episode-.png');
      let url = dataURL.replace(/^data:image\/png/,'data:application/octet-stream');
      downloadLink.setAttribute('href', url);
      downloadLink.click();
        // document.querySelector("#theimage9").src = theimage9; 
    });
}

[UNSOLVED] codepen link

0

There are 0 best solutions below