From 89741b682c1ca468ed8b22c21d2f2796c89b8971 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 19 Feb 2015 00:27:21 +0000 Subject: [PATCH] Force left margin to 0, avoids margin when printing --- phpgwapi/js/framework/fw_base.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpgwapi/js/framework/fw_base.js b/phpgwapi/js/framework/fw_base.js index faef5dcac6..491b53618f 100644 --- a/phpgwapi/js/framework/fw_base.js +++ b/phpgwapi/js/framework/fw_base.js @@ -982,13 +982,15 @@ var fw_base = Class.extend({ },et2_list[i],et2_IPrint); } appWindow.onafterprint = null; + // Reset after removing margin + $j('#egw_fw_main').css('margin-left', framework.activeApp.sideboxWidth + "px"); }; if(appWindow.matchMedia) { var mediaQueryList = appWindow.matchMedia('print'); var listener = function(mql) { if (!mql.matches) { - afterPrint(); mediaQueryList.removeListener(listener); + afterPrint(); } }; mediaQueryList.addListener(listener); @@ -998,7 +1000,9 @@ var fw_base = Class.extend({ // Wait for everything to be loaded, then send it off 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() { afterPrint(); });