1330 1331 /* 1332 * Services we don't recognize as built-in services can't be 1333 * implemented as subclasses of PrinterJob, therefore we create 1334 * a DocPrintJob from their service and pass a Doc representing 1335 * the application's printjob 1336 */ 1337 // MacOSX - made protected so subclasses can reference it. 1338 protected void spoolToService(PrintService psvc, 1339 PrintRequestAttributeSet attributes) 1340 throws PrinterException { 1341 1342 if (psvc == null) { 1343 throw new PrinterException("No print service found."); 1344 } 1345 1346 DocPrintJob job = psvc.createPrintJob(); 1347 Doc doc = new PageableDoc(getPageable()); 1348 if (attributes == null) { 1349 attributes = new HashPrintRequestAttributeSet(); 1350 } 1351 try { 1352 job.print(doc, attributes); 1353 } catch (PrintException e) { 1354 throw new PrinterException(e.toString()); 1355 } 1356 } 1357 1358 /** 1359 * Prints a set of pages. 1360 * @exception java.awt.print.PrinterException an error in the print system 1361 * caused the job to be aborted 1362 * @see java.awt.print.Book 1363 * @see java.awt.print.Pageable 1364 * @see java.awt.print.Printable 1365 */ 1366 public void print() throws PrinterException { 1367 print(attributes); 1368 } 1369 | 1330 1331 /* 1332 * Services we don't recognize as built-in services can't be 1333 * implemented as subclasses of PrinterJob, therefore we create 1334 * a DocPrintJob from their service and pass a Doc representing 1335 * the application's printjob 1336 */ 1337 // MacOSX - made protected so subclasses can reference it. 1338 protected void spoolToService(PrintService psvc, 1339 PrintRequestAttributeSet attributes) 1340 throws PrinterException { 1341 1342 if (psvc == null) { 1343 throw new PrinterException("No print service found."); 1344 } 1345 1346 DocPrintJob job = psvc.createPrintJob(); 1347 Doc doc = new PageableDoc(getPageable()); 1348 if (attributes == null) { 1349 attributes = new HashPrintRequestAttributeSet(); 1350 attributes.add(new Copies(getCopies())); 1351 attributes.add(new JobName(getJobName(), null)); 1352 } 1353 try { 1354 job.print(doc, attributes); 1355 } catch (PrintException e) { 1356 throw new PrinterException(e.toString()); 1357 } 1358 } 1359 1360 /** 1361 * Prints a set of pages. 1362 * @exception java.awt.print.PrinterException an error in the print system 1363 * caused the job to be aborted 1364 * @see java.awt.print.Book 1365 * @see java.awt.print.Pageable 1366 * @see java.awt.print.Printable 1367 */ 1368 public void print() throws PrinterException { 1369 print(attributes); 1370 } 1371 |