How to disable header footer in print window using Java Script? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to disable header footer in print window using Java Script?

we are calling print from JavaScript dynamically with "window.print()". But the page URL is present in print page. Manually we can disable the header and footer in print window but it should done from JavaScript or Jquery. If possible please help.

22nd Dec 2016, 4:47 AM
Packiaraj
2 Answers
0
Have a look at this from http://stackoverflow.com/questions/1960939/disabling-browser-print-options-headers-footers-margins-from-page As far as i know there isn't much else that can be done from the web site.. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Print Test</title> <style type="text/css" media="print"> @page { size: auto; /* auto is the initial value */ margin: 0mm; /* this affects the margin in the printer settings */ } html { background-color: #FFFFFF; margin: 0px; /* this affects the margin on the html before sending to printer */ } body { border: solid 1px blue ; margin: 10mm 15mm 10mm 15mm; /* margin you want for the content */ } </style> </head> <body> <div>Top line</div> <div>Line 2</div> </body> </html> I hope this helps
22nd Dec 2016, 4:54 AM
Daniel Sattler
Daniel Sattler - avatar
0
Thanks Daniel
22nd Dec 2016, 4:55 AM
Packiaraj