ng-grid table div needs to be print

478 views
Skip to first unread message

Alagiri A

unread,
Apr 25, 2014, 7:23:53 PM4/25/14
to ang...@googlegroups.com
I am using simple js function to print the html of the Angular search results div to printed using window.print.
I am seeing issues with the alignment of the table in the print preview as well as print.

Tried adding all the required js and css for the angular grid.

Js:

/*Printing Library Search results*/
function printLibSearch() {
var mywindow = window.open('', 'Library Search', 'height=400,width=600');
mywindow.document.write('<html><head><title>Library Search results</title>');
/*optional stylesheet*/ 
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/style.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/ng-grid.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/media.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/chosen.css">');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/datepicker.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/messages.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/demo_table_jui.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/dropzone.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/bootstrap.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/demo_page.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/demo_table_jui.css" />');
mywindow.document.write('<link rel="stylesheet" type="text/css" href="/css/jquery-ui-1.8.4.custom.css" />');
mywindow.document.write('</head><body >');
mywindow.document.write($('.gridStyleLib').html());
mywindow.document.write('</body></html>');
mywindow.print();
//mywindow.close();
return true;
}

Prateek Bansal

unread,
Apr 1, 2016, 5:36:25 AM4/1/16
to AngularJS
Did you get any solution for this?
Reply all
Reply to author
Forward
0 new messages