html2canvas不能完全在firefox上渲染/捕获svg

时间:2017-10-05 07:27:37

标签: firefox svg html2canvas

我使用html2canvas将网页保存为png。 Html2canvas在Opera和Chrome中正确渲染/捕获svg。但是它并没有完全在firefox上渲染/捕获svg。这是我正在使用的代码。我也在使用最新的html2canvas。

  $(function() {
                 $("#btnSave").click(function() {
                        html2canvas($("#widget"), {
                            onrendered: function(canvas) {
                                /* theCanvas = canvas;
                                document.body.appendChild(canvas);

                               // Convert and download as image
                                Canvas2Image.saveAsPNG(canvas);
                                $("#img-out").append(canvas);
                                 window.open(canvas);
                                 */

                                  var a = document.createElement('a');
                                 // toDataURL defaults to png, so we need to request a jpeg, then convert for file download.
                                 document.body.appendChild(a);
                                 a.href = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");
                                 a.download = 'Human Insights - O&E.png';
                                 a.click();
                                // Clean up
                                //document.body.removeChild(canvas);

                                 // toDataURL defaults to png, so we need to request a jpeg, then convert for file download.
                            }
                        }, {
                            allowTaint: true,
                        });
                    });
                });

This is the image captured using html2canvas on firefox version :56.0 running on windows 7

This is the image captured using html2canvas on chrome Version 61.0.3163.100 (Official Build) (64-bit) running on windows 7

0 个答案:

没有答案