Java Code Examples for java.awt.print.PrinterJob#getPrintService()
The following examples show how to use
java.awt.print.PrinterJob#getPrintService() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DlgAttrsBug.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void printTest() { PrinterJob job = PrinterJob.getPrinterJob(); if (job.getPrintService() == null) { System.out.println("No printers. Test cannot continue"); return; } job.setPrintable(new DlgAttrsBug()); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new Copies(5)); aset.add(new PageRanges(3,4)); aset.add(DialogTypeSelection.NATIVE); job.printDialog(aset); }
Example 2
Source File: DlgAttrsBug.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void printTest() { PrinterJob job = PrinterJob.getPrinterJob(); if (job.getPrintService() == null) { System.out.println("No printers. Test cannot continue"); return; } job.setPrintable(new DlgAttrsBug()); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new Copies(5)); aset.add(new PageRanges(3,4)); aset.add(DialogTypeSelection.NATIVE); job.printDialog(aset); }
Example 3
Source File: DlgAttrsBug.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void printTest() { PrinterJob job = PrinterJob.getPrinterJob(); if (job.getPrintService() == null) { System.out.println("No printers. Test cannot continue"); return; } job.setPrintable(new DlgAttrsBug()); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new Copies(5)); aset.add(new PageRanges(3,4)); aset.add(DialogTypeSelection.NATIVE); job.printDialog(aset); }
Example 4
Source File: DlgAttrsBug.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void printTest() { PrinterJob job = PrinterJob.getPrinterJob(); if (job.getPrintService() == null) { System.out.println("No printers. Test cannot continue"); return; } job.setPrintable(new DlgAttrsBug()); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new Copies(5)); aset.add(new PageRanges(3,4)); aset.add(DialogTypeSelection.NATIVE); job.printDialog(aset); }
Example 5
Source File: DlgAttrsBug.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void printTest() { PrinterJob job = PrinterJob.getPrinterJob(); if (job.getPrintService() == null) { System.out.println("No printers. Test cannot continue"); return; } job.setPrintable(new DlgAttrsBug()); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new Copies(5)); aset.add(new PageRanges(3,4)); aset.add(DialogTypeSelection.NATIVE); job.printDialog(aset); }
Example 6
Source File: TestUnsupportedResolution.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void printWorks(String[] args) { PrinterJob job=PrinterJob.getPrinterJob(); job.setPrintable(this); PrintRequestAttributeSet settings=new HashPrintRequestAttributeSet(); PrinterResolution pr = new PrinterResolution(300, 300, ResolutionSyntax.DPI); if (args.length > 0 && (args[0].compareTo("600") == 0)) { pr = new PrinterResolution(600, 600, ResolutionSyntax.DPI); System.out.println("Adding 600 Dpi attribute"); } else { System.out.println("Adding 300 Dpi attribute"); } PrintService ps = job.getPrintService(); boolean resolutionSupported = ps.isAttributeValueSupported(pr, null, null); System.out.println("Is "+pr+" supported by "+ps+"? "+resolutionSupported); if (resolutionSupported) { System.out.println("Resolution is supported.\nTest is not applicable, PASSED"); } settings.add(pr); if (args.length > 0 && (args[0].equalsIgnoreCase("fidelity"))) { settings.add(Fidelity.FIDELITY_TRUE); System.out.println("Adding Fidelity.FIDELITY_TRUE attribute"); } if (job.printDialog(settings)) { try { job.print(settings); } catch (PrinterException e) { e.printStackTrace(); } } }
Example 7
Source File: DlgAttrsBug.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void printTest() { PrinterJob job = PrinterJob.getPrinterJob(); if (job.getPrintService() == null) { System.out.println("No printers. Test cannot continue"); return; } job.setPrintable(new DlgAttrsBug()); PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(new Copies(5)); aset.add(new PageRanges(3,4)); aset.add(DialogTypeSelection.NATIVE); job.printDialog(aset); }