src/solaris/classes/sun/print/CUPSPrinter.java

Print this page

        

@@ -138,10 +138,13 @@
     public CustomMediaSizeName[] getCustomMediaSizeNames() {
         initMedia();
         return cupsCustomMediaSNames;
     }
 
+    public int getDefaultMediaIndex() {
+        return ((pageSizes.length >1) ? (int)(pageSizes[pageSizes.length -1]) : 0);
+    }
 
     /**
      * Returns array of MediaPrintableArea derived from PPD.
      */
     public MediaPrintableArea[] getMediaPrintableArea() {

@@ -199,12 +202,19 @@
                 // add custom if no matching standard media
                 cupsMediaSNames[i] = msn;
 
                 // add this new custom msn to MediaSize array
                 if ((width > 0.0) && (length > 0.0)) {
+                    try {
                     new MediaSize(width, length,
                                   Size2DSyntax.INCH, msn);
+                    } catch (IllegalArgumentException e) {
+                        /* PDF printer in Linux for Ledger paper causes
+                        "IllegalArgumentException: X dimension > Y dimension".
+                        We rotate based on IPP spec. */
+                        new MediaSize(length, width, Size2DSyntax.INCH, msn);
+                    }
                 }
             }
 
             // add to list of custom MediaSizeName
             // for internal use of IPPPrintService