skip to primary navigationskip to content
 

Matlab Printing

The line "Option orientation-requested 3" needs to be inserted between all <Printer> and <\Printer> eteries in /etc/cups/printers.conf to work around a printing bug between jvm and cups, see http://www.mathworks.com/support/solutions/en/data/1-747TRF/ for details..

If you have a problem where you can only print one figure each time you open matlab read on.. The problem is a known bug in Matlab which Mathworks have declared "will not fix", and relates to the fact for the first print the pagesize property is set as 'a4' which is correct, however subsequently it is reset to 'a4letter' which has no meaning, causing the java printing system to throw a wobbly, you can fix it using the following patch on the file MATLABROOT//toolbox/matlab/graphics/private/printdlg_deprecated.m

--- /matlabr2011b/toolbox/matlab/graphics/private/printdlg_deprecated.m	2011-04-23 13:09:22.000000000 +0100
+++ printdlg_deprecated.m	2011-10-13 23:43:16.827111155 +0100
@@ -707,6 +707,15 @@
 % The dialog will have been dismissed by the time this routine returns.
 
 [optKeys, optVals, driverList] = LocalGetPrintOptions( Data.Fig );
+
+%Workaround for cups/java/printer error when a4letter is set as size, this
+%is not a backwards place so force it to a4 instead djw oct2011
+
+if  strcmp(optVals{1,find(ismember(optKeys, 'PaperSize')==1)-1},'a4letter')
+    optVals{1,find(ismember(optKeys, 'PaperSize')==1)-1}='a4';
+end
+
+
 try
     jDlg = com.mathworks.page.export.printdlg.Printdlg(Data.Fig, ...
         name,optKeys,optVals);