Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
161
rated 0 times [  165] [ 4]  / answers: 1 / hits: 26898  / 10 Years ago, tue, december 2, 2014, 12:00:00

create html page as inline and that page open to new tab and show print view



i tried with this code but not working..



     var mywindow = window.open('', 'Print  Report', 'height=400,width=600');
mywindow.document.write('<html><head><title>Print Report</title>');
mywindow.document.write('</head><body ><table border=1 style=width: 500px; height: 300px;>');
mywindow.document.write(htmlTable);
mywindow.document.write('</table></body></html>');
mywindow.open().print();

More From » jquery

 Answers
1

try this..



var winPrint = window.open('', '', 'left=0,top=0,width=800,height=600,toolbar=0,scrollbars=0,status=0');
winPrint.document.write('<title>Print Report</title><br /><br /> Hellow World');
winPrint.document.close();
winPrint.focus();
winPrint.print();
winPrint.close();


if the window is not open .. please check whether the popup is blocked :)..


[#68623] Sunday, November 30, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
carrington

Total Points: 674
Total Questions: 90
Total Answers: 108

Location: Burundi
Member since Sat, Aug 21, 2021
3 Years ago
;