I want to add css media to format  (add page-break-inside... )the page to be print, but following code just pops up new window and simply prints the
table without supporting media print css. 
Here is the code I got from following link:
How to use HTML to print header and footer on every printed page of a document?
<script>
 function printDiv()
 {
    var divToPrint=document.getElementById('tableToPrint');
    newWin= window.open("");
    newWin.document.write(divToPrint.outerHTML);
    newWin.print();
    newWin.close();
 }
</script>
 
    