$("#print").on('click', function () {
var child = window.open("image.jpg", "_blank", "location=0,toolbar=0,scrollbars=1,fullscreen=1,menubar=0");
//any way to know/wait for image to load?
child.print();
});
Any way for my parent window to know that the child window has completed loading the image prior to calling .print()? If they were trigger happy they would end up printing a blank page.
I’ve tried both:
child.attachEvent("onload", function () { child.print(); });
and
child.attachEvent("DOMContentLoaded", function () { child.print(); });
//(found this online, apparently it's Firefox only, still didn't work)
You are going to need to create a page, i.e.
print.htmland add this script to it:Then use it like so: