Требуется распечатать таблицу одним нажатием кнопки.При нажатии кнопки открывается диалоговое окно печати.Все столбцы не помещаются в портретном режиме, поэтому перед печатью его необходимо изменить на альбомный.Есть ли способ сделать альбомный режим опцией по умолчанию при открытии диалогового окна печати?
$scope.printDiv = function () {
loadFullGrid($scope.constantgriddata);
var divToPrint = document.getElementById("MPRepotTable");
newWin = window.open('', '_blank', 'top=0,left=0,height=100%,width=auto');
var css = '@page { size: landscape; }',
style = document.createElement('style');
style.type = 'text/css';
style.media = 'print';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
var htmlToPrint = '' +
'<style type="text/css">' +
'table th, table td {' +
'border:1px solid #000;' +
'margin-top: 0px;' +
'margin-bottom: 0px;' +
'margin-right: 0px;' +
'margin-left: 0px;' +
'}' +
'</style>';
divToPrint.appendChild(style);
htmlToPrint += divToPrint.outerHTML;
htmlToPrint = htmlToPrint.replace(/<input[^>]*>|<img[^>]*>|'""'/g, '')
newWin.document.write(htmlToPrint);
newWin.print();
newWin.close();