diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java index 791182c1565..e198024dd0c 100644 --- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java +++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java @@ -35,6 +35,7 @@ import java.security.PrivilegedAction; import javax.print.*; import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.HashPrintRequestAttributeSet; import sun.java2d.*; import sun.print.*; @@ -96,6 +97,14 @@ public class CPrinterJob extends RasterPrinterJob { return false; } + if (attributes == null) { + attributes = new HashPrintRequestAttributeSet(); + } + + if (getPrintService() instanceof StreamPrintService) { + return super.printDialog(attributes); + } + return jobSetup(getPageable(), checkAllowedToPrintToFile()); } @@ -130,6 +139,10 @@ public class CPrinterJob extends RasterPrinterJob { return page; } + if (getPrintService() instanceof StreamPrintService) { + return super.pageDialog(page); + } + PageFormat pageClone = (PageFormat) page.clone(); boolean doIt = pageSetup(pageClone, null); return doIt ? pageClone : page; diff --git a/jdk/src/share/classes/sun/print/RasterPrinterJob.java b/jdk/src/share/classes/sun/print/RasterPrinterJob.java index 24bece595f8..1752016288e 100644 --- a/jdk/src/share/classes/sun/print/RasterPrinterJob.java +++ b/jdk/src/share/classes/sun/print/RasterPrinterJob.java @@ -607,13 +607,17 @@ public abstract class RasterPrinterJob extends PrinterJob { protected void updatePageAttributes(PrintService service, PageFormat page) { + if (this.attributes == null) { + this.attributes = new HashPrintRequestAttributeSet(); + } + updateAttributesWithPageFormat(service, page, this.attributes); } protected void updateAttributesWithPageFormat(PrintService service, PageFormat page, - PrintRequestAttributeSet attributes) { - if (service == null || page == null) { + PrintRequestAttributeSet pageAttributes) { + if (service == null || page == null || pageAttributes == null) { return; } @@ -653,13 +657,10 @@ public abstract class RasterPrinterJob extends PrinterJob { orient = OrientationRequested.PORTRAIT; } - if (attributes == null) { - attributes = new HashPrintRequestAttributeSet(); - } if (media != null) { - attributes.add(media); + pageAttributes.add(media); } - attributes.add(orient); + pageAttributes.add(orient); float ix = (float)(page.getPaper().getImageableX()/DPI); float iw = (float)(page.getPaper().getImageableWidth()/DPI); @@ -667,7 +668,7 @@ public abstract class RasterPrinterJob extends PrinterJob { float ih = (float)(page.getPaper().getImageableHeight()/DPI); if (ix < 0) ix = 0f; if (iy < 0) iy = 0f; try { - attributes.add(new MediaPrintableArea(ix, iy, iw, ih, + pageAttributes.add(new MediaPrintableArea(ix, iy, iw, ih, MediaPrintableArea.INCH)); } catch (IllegalArgumentException iae) { }