Open print preview page in new tab in chrome

Prak picture Prak · Nov 7, 2013 · Viewed 9.3k times · Source

Is there any way to open print preview page in new tab in chrome. I m trying to

    `<a href="#" target="_blank" onclick="window.print();">Print_This_Page</a>`

but it does not work.

Please help.

Answer

jessica picture jessica · Dec 19, 2013

I solved this with javascript by first opening the page in a new tab/window, set a timeout so it would have time to finish loading, and then called the print-function

var printPage = window.open(document.URL, '_blank');
setTimeout(printPage.print(), 5);