Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image not rendering in new window on Chrome!! #1443

Closed
ABHIKSINGHH opened this issue Feb 16, 2018 · 3 comments
Closed

Image not rendering in new window on Chrome!! #1443

ABHIKSINGHH opened this issue Feb 16, 2018 · 3 comments

Comments

@ABHIKSINGHH
Copy link

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?

@niklasvh
Copy link
Owner

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.

@ABHIKSINGHH
Copy link
Author

@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.

@Ismaestro
Copy link

@ABHIKSINGHH The solution:

html2canvas(document.body).then((canvas) => {
    window.open().document.write('<img src="' + canvas.toDataURL() + '" />');
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants