function convertToCanvasAndPrint() {
html2canvas(document.getElementById("PositionChartMainDiv")).then(function(canvas) {
var img = canvas.toDataURL();
window.open(img);
});
}
I am using 1.0.0-alpha.10 js library, on chrome above function opens a new window as blank. However, on firefox the image is rendered. Why is it so?
There is nothing in this issue that I can help you with. If you wish to get assistance on your issue, follow the instructions for opening an issue and provide an example on jsfiddle of what isn't working.
@niklasvh : I am trying to take a snapshot of a big org chart and open the image in new window. The chart is inside a div(id=PositionChartMainDiv). But when I call the above function on Print button click, the chart opens on firefox in new window but on chrome the new window is empty with no content in its body. Why such difference in behavior? I really can't share the entire content on jsfiddle as the content is very big.
@ABHIKSINGHH The solution:
html2canvas(document.body).then((canvas) => {
window.open().document.write('<img src="' + canvas.toDataURL() + '" />');
});
Most helpful comment
@ABHIKSINGHH The solution: