< prev index next >

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

Print this page

        

@@ -244,10 +244,15 @@
         } else {
             r.run();
         }
     }
 
+    boolean isPrintToFile = false;
+    private void setPrintToFile(boolean printToFile) {
+        isPrintToFile = printToFile;
+    }
+
     @Override
     public void print(PrintRequestAttributeSet attributes) throws PrinterException {
         // NOTE: Some of this code is copied from RasterPrinterJob.
 
 

@@ -255,11 +260,11 @@
         // this will make it print directly to the printer
         // this will not work if the user clicks on the "Preview" button
         // However if the printer is a StreamPrintService, its the right path.
         PrintService psvc = getPrintService();
 
-        if (psvc == null) {
+        if (psvc == null && !isPrintToFile) {
             throw new PrinterException("No print service found.");
         }
 
         if (psvc instanceof StreamPrintService) {
             spoolToService(psvc, attributes);
< prev index next >