javascript - Elements with display: none are printing to sheet. -
im having trouble getting work have complex html page has chart(from highcharts) when try print chart, prints chart plus page has elements set display: none. module highcharts.
print: function () { // win.print(); var chart = this, container = chart.container, origdisplay = [], origparent = container.parentnode, body = doc.body, childnodes = body.childnodes; if (chart.isprinting) { // block button while in printing mode return; } chart.isprinting = true; // hide body content each(childnodes, function (node, i) { if (node.nodetype === 1) { origdisplay[i] = node.style.display; node.style.display = 'none'; } }); // pull out chart body.appendchild(container); // print win.focus(); // #1510 win.print(); // allow browser prepare before reverting settimeout(function () { // put chart in origparent.appendchild(container); // restore body content each(childnodes, function (node, i) { if (node.nodetype === 1) { node.style.display = origdisplay[i]; } }); chart.isprinting = false; }, 1000); },
i don't know why not working. here link page source code.
thanks!
Comments
Post a Comment