I want to print the div tag content by javascript by using the following code.
var divToPrint1 = $('#PrintDoc').html();
var newWin = window.open('Share Certificate #001', '', 'width=10px,height=10px');
newWin.document.open();
newWin.document.write('<html><body onload="window.print();">' + divToPrint1 + '</body></html>');
newWin.document.close();
setTimeout(function () { newWin.close(); }, 10);
And print code works fine. But now I want to remove the url, date and title from the print by using the javascript code. Is it possible? Can anyone help me to solve the following problem?
I want to print the div tag content by javascript by using the following code.
var divToPrint1 = $('#PrintDoc').html();
var newWin = window.open('Share Certificate #001', '', 'width=10px,height=10px');
newWin.document.open();
newWin.document.write('<html><body onload="window.print();">' + divToPrint1 + '</body></html>');
newWin.document.close();
setTimeout(function () { newWin.close(); }, 10);
And print code works fine. But now I want to remove the url, date and title from the print by using the javascript code. Is it possible? Can anyone help me to solve the following problem?
Share Improve this question asked Mar 18, 2011 at 14:34 AnveshAnvesh 3191 gold badge8 silver badges24 bronze badges3 Answers
Reset to default 5You cannot remove the URL and timestamp programmatically. Those options are part of the Print
dialog, which cannot be controlled from JavaScript in the page. This choice is entirely up to the user.
You are using IE? IE adds extra information to your print. Although not sure this can be changed through code...
I did find an article on the MSDN site where you can set some behavior, didn't try it out but you can give it a spin.
If you are trying in Chrome, when you click print button at the bottom of the print page there will be "Remove the Header and Footer" checkBox.
Also for other browsers go to print settings and there you will find same settings.. just un-check it