Force left margin to 0, avoids margin when printing

This commit is contained in:
Nathan Gray 2015-02-19 00:27:21 +00:00
parent b1b1269e0e
commit 89741b682c

View File

@ -982,13 +982,15 @@ var fw_base = Class.extend({
},et2_list[i],et2_IPrint); },et2_list[i],et2_IPrint);
} }
appWindow.onafterprint = null; appWindow.onafterprint = null;
// Reset after removing margin
$j('#egw_fw_main').css('margin-left', framework.activeApp.sideboxWidth + "px");
}; };
if(appWindow.matchMedia) { if(appWindow.matchMedia) {
var mediaQueryList = appWindow.matchMedia('print'); var mediaQueryList = appWindow.matchMedia('print');
var listener = function(mql) { var listener = function(mql) {
if (!mql.matches) { if (!mql.matches) {
afterPrint();
mediaQueryList.removeListener(listener); mediaQueryList.removeListener(listener);
afterPrint();
} }
}; };
mediaQueryList.addListener(listener); mediaQueryList.addListener(listener);
@ -998,7 +1000,9 @@ var fw_base = Class.extend({
// Wait for everything to be loaded, then send it off // Wait for everything to be loaded, then send it off
jQuery.when.apply(jQuery, deferred).done(function() { jQuery.when.apply(jQuery, deferred).done(function() {
appWindow.print(); // Despite being set in the print CSS, this just doesn't work
$j('#egw_fw_main').css('margin-left','0px');
appWindow.setTimeout(appWindow.print, 0);
}).fail(function() { }).fail(function() {
afterPrint(); afterPrint();
}); });