src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java

Print this page

        

@@ -31,10 +31,11 @@
 import java.awt.image.BufferedImage;
 import java.awt.print.*;
 
 import javax.print.*;
 import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.attribute.standard.PageRanges;
 
 import sun.java2d.*;
 import sun.print.*;
 
 public class CPrinterJob extends RasterPrinterJob {

@@ -143,10 +144,21 @@
         getDefaultPage(newPage);
         return newPage;
     }
 
     protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
+        if (attributes != null) {
+            PageRanges pageRangesAttr =
+                (PageRanges)attributes.get(PageRanges.class);
+            if (pageRangesAttr != null) {
+                SunPageSelection psel = (SunPageSelection)attributes.get(SunPageSelection.class);
+                if (psel == null) {
+                    attributes.add(SunPageSelection.RANGE);
+                }
+            }
+        }
+
         super.setAttributes(attributes);
 
         if (attributes == null) {
             return;
         }