I
I
IvanKalinin2015-05-22 02:36:23
safari
IvanKalinin, 2015-05-22 02:36:23

How to make Safari work with CORS html2canvas correctly?

Please tell me how to make Safari work with CORS. c in the finished "screenshot" the image is missing.

$scope.htmlToPDF = function(html, name) {
        if (name === undefined) {
            name = 'file.pdf';
        }


        html2canvas(html, {
            logging: true,
            useCORS: true,
            onrendered: function (canvas) {
                var img = canvas.toDataURL("image/png")
                var doc = new jsPDF();
                doc.addImage(img, 'PNG', 15, 0, 180, 0);

                setTimeout(function(){
                    doc.save(name);
                }, 1000);
            }
        });
    };

In chrome it works in 90% of cases, FF seems to always work. Doesn't work in Safari at all.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question