Canvas2image script does not work on Chome

Asked

Viewed 106 times

2

Good afternoon to all,

I’m developing an e-mail signature generator here for the service. I took a ready script that uses 'html2canvas' and 'canvas2image' to transform the code into an image and later, allow the user to save the image as .png. However, when I click on the "Save Signature" button an example of the signature appears below that person can select 'Save as." but the company logo, which is in the project folder in . png format does not appear in the final result.

The JS code I’m using is this

$(function() { 
$("#btnSave").click(function() { 
    html2canvas($("#gerador"), {
        onrendered: function(canvas) {
            theCanvas = canvas;
            document.body.appendChild(canvas);
            var photo = canvas.toDataURL('image/png');

            //Convert and download as image 
            Canvas2Image.saveAsPNG(canvas);
            // Clean up 
            document.body.removeChild(canvas);

        }

    });
  });
}); 

I know this script carries out the download of the file, however the same is coming without any extension,.

I appreciate all your help.

  • Find the download code?

  • It was commented, is this here Canvas2image.saveAsPNG(canvas);

  • I took a look here in Stack and solved the problem of saving without format, it was necessary to edit the script canvas2image.js . A problem I solved,now missing to make it work on Chrome,Mozilla works perfectly.

  • send the download link of this code ready

  • What code are you referring to? If this is the one I put up,.

  • Some light @Rafaelaugusto ?

  • Must be Cors problem, please give details. It may even be CSS problem

  • CSS is very simple, nothing that can remove the logo from the final result.

  • Problem solved.

  • @Otáviocapila if the problem has been solved, please add the solution as a response.

  • I don’t know the cause of the problem,but after I went up the page to production on the server,.

Show 6 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.