Java Code Examples for javax.print.attribute.standard.PrintQuality#NORMAL
The following examples show how to use
javax.print.attribute.standard.PrintQuality#NORMAL .
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: WPrinterJob.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void setQualityAttrib(Attribute attr) { if (attr == PrintQuality.HIGH) { mAttQuality = -4; // DMRES_HIGH } else if (attr == PrintQuality.NORMAL) { mAttQuality = -3; // DMRES_MEDIUM } else { mAttQuality = -2; // DMRES_LOW } }
Example 2
Source File: WPrinterJob.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private void setQualityAttrib(Attribute attr) { if (attr == PrintQuality.HIGH) { mAttQuality = -4; // DMRES_HIGH } else if (attr == PrintQuality.NORMAL) { mAttQuality = -3; // DMRES_MEDIUM } else { mAttQuality = -2; // DMRES_LOW } }
Example 3
Source File: WPrinterJob.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void setQualityAttrib(Attribute attr) { if (attr == PrintQuality.HIGH) { mAttQuality = -4; // DMRES_HIGH } else if (attr == PrintQuality.NORMAL) { mAttQuality = -3; // DMRES_MEDIUM } else { mAttQuality = -2; // DMRES_LOW } }
Example 4
Source File: WPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void setQualityAttrib(Attribute attr) { if (attr == PrintQuality.HIGH) { mAttQuality = -4; // DMRES_HIGH } else if (attr == PrintQuality.NORMAL) { mAttQuality = -3; // DMRES_MEDIUM } else { mAttQuality = -2; // DMRES_LOW } }
Example 5
Source File: WPrinterJob.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void setQualityAttrib(Attribute attr) { if (attr == PrintQuality.HIGH) { mAttQuality = -4; // DMRES_HIGH } else if (attr == PrintQuality.NORMAL) { mAttQuality = -3; // DMRES_MEDIUM } else { mAttQuality = -2; // DMRES_LOW } }
Example 6
Source File: WPrinterJob.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void setQualityAttrib(Attribute attr) { if (attr == PrintQuality.HIGH) { mAttQuality = -4; // DMRES_HIGH } else if (attr == PrintQuality.NORMAL) { mAttQuality = -3; // DMRES_MEDIUM } else { mAttQuality = -2; // DMRES_LOW } }
Example 7
Source File: WPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private final void setJobAttributes(PrintRequestAttributeSet attributes, int fields, int values, short copies, short dmPaperSize, short dmPaperWidth, short dmPaperLength, short dmDefaultSource, short xRes, short yRes) { if (attributes == null) { return; } if ((fields & DM_COPIES) != 0) { attributes.add(new Copies(copies)); } if ((fields & DM_COLLATE) != 0) { if ((values & SET_COLLATED) != 0) { attributes.add(SheetCollate.COLLATED); } else { attributes.add(SheetCollate.UNCOLLATED); } } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { attributes.add(OrientationRequested.LANDSCAPE); } else { attributes.add(OrientationRequested.PORTRAIT); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { attributes.add(Chromaticity.COLOR); } else { attributes.add(Chromaticity.MONOCHROME); } } if ((fields & DM_PRINTQUALITY) != 0) { /* value < 0 indicates quality setting. * value > 0 indicates X resolution. In that case * hopefully we will also find y-resolution specified. * If its not, assume its the same as x-res. * Maybe Java code should try to reconcile this against * the printers claimed set of supported resolutions. */ if (xRes < 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } attributes.add(quality); } else if (xRes > 0 && yRes > 0) { attributes.add( new PrinterResolution(xRes, yRes, PrinterResolution.DPI)); } } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } attributes.add(sides); } if ((fields & DM_PAPERSIZE) != 0) { addPaperSize(attributes, dmPaperSize, dmPaperWidth, dmPaperLength); } if ((fields & DM_DEFAULTSOURCE) != 0) { MediaTray tray = ((Win32PrintService)myService).findMediaTray(dmDefaultSource); attributes.add(new SunAlternateMedia(tray)); } }
Example 8
Source File: WPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private final void setJobAttributes(PrintRequestAttributeSet attributes, int fields, int values, short copies, short dmPaperSize, short dmPaperWidth, short dmPaperLength, short dmDefaultSource, short xRes, short yRes) { if (attributes == null) { return; } if ((fields & DM_COPIES) != 0) { attributes.add(new Copies(copies)); } if ((fields & DM_COLLATE) != 0) { if ((values & SET_COLLATED) != 0) { attributes.add(SheetCollate.COLLATED); } else { attributes.add(SheetCollate.UNCOLLATED); } } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { attributes.add(OrientationRequested.LANDSCAPE); } else { attributes.add(OrientationRequested.PORTRAIT); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { attributes.add(Chromaticity.COLOR); } else { attributes.add(Chromaticity.MONOCHROME); } } if ((fields & DM_PRINTQUALITY) != 0) { /* value < 0 indicates quality setting. * value > 0 indicates X resolution. In that case * hopefully we will also find y-resolution specified. * If its not, assume its the same as x-res. * Maybe Java code should try to reconcile this against * the printers claimed set of supported resolutions. */ if (xRes < 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } attributes.add(quality); } else if (xRes > 0 && yRes > 0) { attributes.add( new PrinterResolution(xRes, yRes, PrinterResolution.DPI)); } } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } attributes.add(sides); } if ((fields & DM_PAPERSIZE) != 0) { addPaperSize(attributes, dmPaperSize, dmPaperWidth, dmPaperLength); } if ((fields & DM_DEFAULTSOURCE) != 0) { MediaTray tray = ((Win32PrintService)myService).findMediaTray(dmDefaultSource); attributes.add(new SunAlternateMedia(tray)); } }
Example 9
Source File: WPrinterJob.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private void setNativeAttributes(int flags, int fields, int values) { if (attributes == null) { return; } if ((flags & PD_PRINTTOFILE) != 0) { Destination destPrn = (Destination)attributes.get( Destination.class); if (destPrn == null) { try { attributes.add(new Destination( new File("./out.prn").toURI())); } catch (SecurityException se) { try { attributes.add(new Destination( new URI("file:out.prn"))); } catch (URISyntaxException e) { } } } } else { attributes.remove(Destination.class); } if ((flags & PD_COLLATE) != 0) { setCollateAttrib(SheetCollate.COLLATED, attributes); } else { setCollateAttrib(SheetCollate.UNCOLLATED, attributes); } if ((flags & PD_NOSELECTION) != PD_NOSELECTION) { if ((flags & PD_PAGENUMS) != 0) { attributes.add(SunPageSelection.RANGE); } else if ((flags & PD_SELECTION) != 0) { attributes.add(SunPageSelection.SELECTION); } else { attributes.add(SunPageSelection.ALL); } } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { setOrientAttrib(OrientationRequested.LANDSCAPE, attributes); } else { setOrientAttrib(OrientationRequested.PORTRAIT, attributes); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { setColorAttrib(Chromaticity.COLOR, attributes); } else { setColorAttrib(Chromaticity.MONOCHROME, attributes); } } if ((fields & DM_PRINTQUALITY) != 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } setQualityAttrib(quality, attributes); } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } setSidesAttrib(sides, attributes); } }
Example 10
Source File: WPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private final void setNativeAttributes(int flags, int fields, int values) { if (attributes == null) { return; } if ((flags & PD_PRINTTOFILE) != 0) { Destination destPrn = (Destination)attributes.get( Destination.class); if (destPrn == null) { try { attributes.add(new Destination( new File("./out.prn").toURI())); } catch (SecurityException se) { try { attributes.add(new Destination( new URI("file:out.prn"))); } catch (URISyntaxException e) { } } } } else { attributes.remove(Destination.class); } if ((flags & PD_COLLATE) != 0) { setCollateAttrib(SheetCollate.COLLATED, attributes); } else { setCollateAttrib(SheetCollate.UNCOLLATED, attributes); } if ((flags & PD_PAGENUMS) != 0) { attributes.add(SunPageSelection.RANGE); } else if ((flags & PD_SELECTION) != 0) { attributes.add(SunPageSelection.SELECTION); } else { attributes.add(SunPageSelection.ALL); } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { setOrientAttrib(OrientationRequested.LANDSCAPE, attributes); } else { setOrientAttrib(OrientationRequested.PORTRAIT, attributes); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { setColorAttrib(Chromaticity.COLOR, attributes); } else { setColorAttrib(Chromaticity.MONOCHROME, attributes); } } if ((fields & DM_PRINTQUALITY) != 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } setQualityAttrib(quality, attributes); } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } setSidesAttrib(sides, attributes); } }
Example 11
Source File: WPrinterJob.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private final void setJobAttributes(PrintRequestAttributeSet attributes, int fields, int values, short copies, short dmPaperSize, short dmPaperWidth, short dmPaperLength, short dmDefaultSource, short xRes, short yRes) { if (attributes == null) { return; } if ((fields & DM_COPIES) != 0) { attributes.add(new Copies(copies)); } if ((fields & DM_COLLATE) != 0) { if ((values & SET_COLLATED) != 0) { attributes.add(SheetCollate.COLLATED); } else { attributes.add(SheetCollate.UNCOLLATED); } } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { attributes.add(OrientationRequested.LANDSCAPE); } else { attributes.add(OrientationRequested.PORTRAIT); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { attributes.add(Chromaticity.COLOR); } else { attributes.add(Chromaticity.MONOCHROME); } } if ((fields & DM_PRINTQUALITY) != 0) { /* value < 0 indicates quality setting. * value > 0 indicates X resolution. In that case * hopefully we will also find y-resolution specified. * If its not, assume its the same as x-res. * Maybe Java code should try to reconcile this against * the printers claimed set of supported resolutions. */ if (xRes < 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } attributes.add(quality); } else if (xRes > 0 && yRes > 0) { attributes.add( new PrinterResolution(xRes, yRes, PrinterResolution.DPI)); } } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } attributes.add(sides); } if ((fields & DM_PAPERSIZE) != 0) { addPaperSize(attributes, dmPaperSize, dmPaperWidth, dmPaperLength); } if ((fields & DM_DEFAULTSOURCE) != 0) { MediaTray tray = ((Win32PrintService)myService).findMediaTray(dmDefaultSource); attributes.add(new SunAlternateMedia(tray)); } }
Example 12
Source File: WPrinterJob.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private final void setNativeAttributes(int flags, int fields, int values) { if (attributes == null) { return; } if ((flags & PD_PRINTTOFILE) != 0) { Destination destPrn = (Destination)attributes.get( Destination.class); if (destPrn == null) { try { attributes.add(new Destination( new File("./out.prn").toURI())); } catch (SecurityException se) { try { attributes.add(new Destination( new URI("file:out.prn"))); } catch (URISyntaxException e) { } } } } else { attributes.remove(Destination.class); } if ((flags & PD_COLLATE) != 0) { setCollateAttrib(SheetCollate.COLLATED, attributes); } else { setCollateAttrib(SheetCollate.UNCOLLATED, attributes); } if ((flags & PD_PAGENUMS) != 0) { attributes.add(SunPageSelection.RANGE); } else if ((flags & PD_SELECTION) != 0) { attributes.add(SunPageSelection.SELECTION); } else { attributes.add(SunPageSelection.ALL); } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { setOrientAttrib(OrientationRequested.LANDSCAPE, attributes); } else { setOrientAttrib(OrientationRequested.PORTRAIT, attributes); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { setColorAttrib(Chromaticity.COLOR, attributes); } else { setColorAttrib(Chromaticity.MONOCHROME, attributes); } } if ((fields & DM_PRINTQUALITY) != 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } setQualityAttrib(quality, attributes); } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } setSidesAttrib(sides, attributes); } }
Example 13
Source File: WPrinterJob.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private final void setJobAttributes(PrintRequestAttributeSet attributes, int fields, int values, short copies, short dmPaperSize, short dmPaperWidth, short dmPaperLength, short dmDefaultSource, short xRes, short yRes) { if (attributes == null) { return; } if ((fields & DM_COPIES) != 0) { attributes.add(new Copies(copies)); } if ((fields & DM_COLLATE) != 0) { if ((values & SET_COLLATED) != 0) { attributes.add(SheetCollate.COLLATED); } else { attributes.add(SheetCollate.UNCOLLATED); } } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { attributes.add(OrientationRequested.LANDSCAPE); } else { attributes.add(OrientationRequested.PORTRAIT); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { attributes.add(Chromaticity.COLOR); } else { attributes.add(Chromaticity.MONOCHROME); } } if ((fields & DM_PRINTQUALITY) != 0) { /* value < 0 indicates quality setting. * value > 0 indicates X resolution. In that case * hopefully we will also find y-resolution specified. * If its not, assume its the same as x-res. * Maybe Java code should try to reconcile this against * the printers claimed set of supported resolutions. */ if (xRes < 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } attributes.add(quality); } else if (xRes > 0 && yRes > 0) { attributes.add( new PrinterResolution(xRes, yRes, PrinterResolution.DPI)); } } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } attributes.add(sides); } if ((fields & DM_PAPERSIZE) != 0) { addPaperSize(attributes, dmPaperSize, dmPaperWidth, dmPaperLength); } if ((fields & DM_DEFAULTSOURCE) != 0) { MediaTray tray = ((Win32PrintService)myService).findMediaTray(dmDefaultSource); attributes.add(new SunAlternateMedia(tray)); } }
Example 14
Source File: WPrinterJob.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private final void setJobAttributes(PrintRequestAttributeSet attributes, int fields, int values, short copies, short dmPaperSize, short dmPaperWidth, short dmPaperLength, short dmDefaultSource, short xRes, short yRes) { if (attributes == null) { return; } if ((fields & DM_COPIES) != 0) { attributes.add(new Copies(copies)); } if ((fields & DM_COLLATE) != 0) { if ((values & SET_COLLATED) != 0) { attributes.add(SheetCollate.COLLATED); } else { attributes.add(SheetCollate.UNCOLLATED); } } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { attributes.add(OrientationRequested.LANDSCAPE); } else { attributes.add(OrientationRequested.PORTRAIT); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { attributes.add(Chromaticity.COLOR); } else { attributes.add(Chromaticity.MONOCHROME); } } if ((fields & DM_PRINTQUALITY) != 0) { /* value < 0 indicates quality setting. * value > 0 indicates X resolution. In that case * hopefully we will also find y-resolution specified. * If its not, assume its the same as x-res. * Maybe Java code should try to reconcile this against * the printers claimed set of supported resolutions. */ if (xRes < 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } attributes.add(quality); } else if (xRes > 0 && yRes > 0) { attributes.add( new PrinterResolution(xRes, yRes, PrinterResolution.DPI)); } } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } attributes.add(sides); } if ((fields & DM_PAPERSIZE) != 0) { addPaperSize(attributes, dmPaperSize, dmPaperWidth, dmPaperLength); } if ((fields & DM_DEFAULTSOURCE) != 0) { MediaTray tray = ((Win32PrintService)myService).findMediaTray(dmDefaultSource); attributes.add(new SunAlternateMedia(tray)); } }
Example 15
Source File: WPrinterJob.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private final void setNativeAttributes(int flags, int fields, int values) { if (attributes == null) { return; } if ((flags & PD_PRINTTOFILE) != 0) { Destination destPrn = (Destination)attributes.get( Destination.class); if (destPrn == null) { try { attributes.add(new Destination( new File("./out.prn").toURI())); } catch (SecurityException se) { try { attributes.add(new Destination( new URI("file:out.prn"))); } catch (URISyntaxException e) { } } } } else { attributes.remove(Destination.class); } if ((flags & PD_COLLATE) != 0) { setCollateAttrib(SheetCollate.COLLATED, attributes); } else { setCollateAttrib(SheetCollate.UNCOLLATED, attributes); } if ((flags & PD_PAGENUMS) != 0) { attributes.add(SunPageSelection.RANGE); } else if ((flags & PD_SELECTION) != 0) { attributes.add(SunPageSelection.SELECTION); } else { attributes.add(SunPageSelection.ALL); } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { setOrientAttrib(OrientationRequested.LANDSCAPE, attributes); } else { setOrientAttrib(OrientationRequested.PORTRAIT, attributes); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { setColorAttrib(Chromaticity.COLOR, attributes); } else { setColorAttrib(Chromaticity.MONOCHROME, attributes); } } if ((fields & DM_PRINTQUALITY) != 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } setQualityAttrib(quality, attributes); } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } setSidesAttrib(sides, attributes); } }
Example 16
Source File: WPrinterJob.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private final void setNativeAttributes(int flags, int fields, int values) { if (attributes == null) { return; } if ((flags & PD_PRINTTOFILE) != 0) { Destination destPrn = (Destination)attributes.get( Destination.class); if (destPrn == null) { try { attributes.add(new Destination( new File("./out.prn").toURI())); } catch (SecurityException se) { try { attributes.add(new Destination( new URI("file:out.prn"))); } catch (URISyntaxException e) { } } } } else { attributes.remove(Destination.class); } if ((flags & PD_COLLATE) != 0) { setCollateAttrib(SheetCollate.COLLATED, attributes); } else { setCollateAttrib(SheetCollate.UNCOLLATED, attributes); } if ((flags & PD_PAGENUMS) != 0) { attributes.add(SunPageSelection.RANGE); } else if ((flags & PD_SELECTION) != 0) { attributes.add(SunPageSelection.SELECTION); } else { attributes.add(SunPageSelection.ALL); } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { setOrientAttrib(OrientationRequested.LANDSCAPE, attributes); } else { setOrientAttrib(OrientationRequested.PORTRAIT, attributes); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { setColorAttrib(Chromaticity.COLOR, attributes); } else { setColorAttrib(Chromaticity.MONOCHROME, attributes); } } if ((fields & DM_PRINTQUALITY) != 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } setQualityAttrib(quality, attributes); } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } setSidesAttrib(sides, attributes); } }
Example 17
Source File: WPrinterJob.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private final void setNativeAttributes(int flags, int fields, int values) { if (attributes == null) { return; } if ((flags & PD_PRINTTOFILE) != 0) { Destination destPrn = (Destination)attributes.get( Destination.class); if (destPrn == null) { try { attributes.add(new Destination( new File("./out.prn").toURI())); } catch (SecurityException se) { try { attributes.add(new Destination( new URI("file:out.prn"))); } catch (URISyntaxException e) { } } } } else { attributes.remove(Destination.class); } if ((flags & PD_COLLATE) != 0) { setCollateAttrib(SheetCollate.COLLATED, attributes); } else { setCollateAttrib(SheetCollate.UNCOLLATED, attributes); } if ((flags & PD_PAGENUMS) != 0) { attributes.add(SunPageSelection.RANGE); } else if ((flags & PD_SELECTION) != 0) { attributes.add(SunPageSelection.SELECTION); } else { attributes.add(SunPageSelection.ALL); } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { setOrientAttrib(OrientationRequested.LANDSCAPE, attributes); } else { setOrientAttrib(OrientationRequested.PORTRAIT, attributes); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { setColorAttrib(Chromaticity.COLOR, attributes); } else { setColorAttrib(Chromaticity.MONOCHROME, attributes); } } if ((fields & DM_PRINTQUALITY) != 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } setQualityAttrib(quality, attributes); } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } setSidesAttrib(sides, attributes); } }
Example 18
Source File: WPrinterJob.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private final void setNativeAttributes(int flags, int fields, int values) { if (attributes == null) { return; } if ((flags & PD_PRINTTOFILE) != 0) { Destination destPrn = (Destination)attributes.get( Destination.class); if (destPrn == null) { try { attributes.add(new Destination( new File("./out.prn").toURI())); } catch (SecurityException se) { try { attributes.add(new Destination( new URI("file:out.prn"))); } catch (URISyntaxException e) { } } } } else { attributes.remove(Destination.class); } if ((flags & PD_COLLATE) != 0) { setCollateAttrib(SheetCollate.COLLATED, attributes); } else { setCollateAttrib(SheetCollate.UNCOLLATED, attributes); } if ((flags & PD_PAGENUMS) != 0) { attributes.add(SunPageSelection.RANGE); } else if ((flags & PD_SELECTION) != 0) { attributes.add(SunPageSelection.SELECTION); } else { attributes.add(SunPageSelection.ALL); } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { setOrientAttrib(OrientationRequested.LANDSCAPE, attributes); } else { setOrientAttrib(OrientationRequested.PORTRAIT, attributes); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { setColorAttrib(Chromaticity.COLOR, attributes); } else { setColorAttrib(Chromaticity.MONOCHROME, attributes); } } if ((fields & DM_PRINTQUALITY) != 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } setQualityAttrib(quality, attributes); } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } setSidesAttrib(sides, attributes); } }
Example 19
Source File: WPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
private final void setJobAttributes(PrintRequestAttributeSet attributes, int fields, int values, short copies, short dmPaperSize, short dmPaperWidth, short dmPaperLength, short dmDefaultSource, short xRes, short yRes) { if (attributes == null) { return; } if ((fields & DM_COPIES) != 0) { attributes.add(new Copies(copies)); } if ((fields & DM_COLLATE) != 0) { if ((values & SET_COLLATED) != 0) { attributes.add(SheetCollate.COLLATED); } else { attributes.add(SheetCollate.UNCOLLATED); } } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { attributes.add(OrientationRequested.LANDSCAPE); } else { attributes.add(OrientationRequested.PORTRAIT); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { attributes.add(Chromaticity.COLOR); } else { attributes.add(Chromaticity.MONOCHROME); } } if ((fields & DM_PRINTQUALITY) != 0) { /* value < 0 indicates quality setting. * value > 0 indicates X resolution. In that case * hopefully we will also find y-resolution specified. * If its not, assume its the same as x-res. * Maybe Java code should try to reconcile this against * the printers claimed set of supported resolutions. */ if (xRes < 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } attributes.add(quality); } else if (xRes > 0 && yRes > 0) { attributes.add( new PrinterResolution(xRes, yRes, PrinterResolution.DPI)); } } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } attributes.add(sides); } if ((fields & DM_PAPERSIZE) != 0) { addPaperSize(attributes, dmPaperSize, dmPaperWidth, dmPaperLength); } if ((fields & DM_DEFAULTSOURCE) != 0) { MediaTray tray = ((Win32PrintService)myService).findMediaTray(dmDefaultSource); attributes.add(new SunAlternateMedia(tray)); } }
Example 20
Source File: WPrinterJob.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private final void setJobAttributes(PrintRequestAttributeSet attributes, int fields, int values, short copies, short dmPaperSize, short dmPaperWidth, short dmPaperLength, short dmDefaultSource, short xRes, short yRes) { if (attributes == null) { return; } if ((fields & DM_COPIES) != 0) { attributes.add(new Copies(copies)); } if ((fields & DM_COLLATE) != 0) { if ((values & SET_COLLATED) != 0) { attributes.add(SheetCollate.COLLATED); } else { attributes.add(SheetCollate.UNCOLLATED); } } if ((fields & DM_ORIENTATION) != 0) { if ((values & SET_ORIENTATION) != 0) { attributes.add(OrientationRequested.LANDSCAPE); } else { attributes.add(OrientationRequested.PORTRAIT); } } if ((fields & DM_COLOR) != 0) { if ((values & SET_COLOR) != 0) { attributes.add(Chromaticity.COLOR); } else { attributes.add(Chromaticity.MONOCHROME); } } if ((fields & DM_PRINTQUALITY) != 0) { /* value < 0 indicates quality setting. * value > 0 indicates X resolution. In that case * hopefully we will also find y-resolution specified. * If its not, assume its the same as x-res. * Maybe Java code should try to reconcile this against * the printers claimed set of supported resolutions. */ if (xRes < 0) { PrintQuality quality; if ((values & SET_RES_LOW) != 0) { quality = PrintQuality.DRAFT; } else if ((fields & SET_RES_HIGH) != 0) { quality = PrintQuality.HIGH; } else { quality = PrintQuality.NORMAL; } attributes.add(quality); } else if (xRes > 0 && yRes > 0) { attributes.add( new PrinterResolution(xRes, yRes, PrinterResolution.DPI)); } } if ((fields & DM_DUPLEX) != 0) { Sides sides; if ((values & SET_DUP_VERTICAL) != 0) { sides = Sides.TWO_SIDED_LONG_EDGE; } else if ((values & SET_DUP_HORIZONTAL) != 0) { sides = Sides.TWO_SIDED_SHORT_EDGE; } else { sides = Sides.ONE_SIDED; } attributes.add(sides); } if ((fields & DM_PAPERSIZE) != 0) { addPaperSize(attributes, dmPaperSize, dmPaperWidth, dmPaperLength); } if ((fields & DM_DEFAULTSOURCE) != 0) { MediaTray tray = ((Win32PrintService)myService).findMediaTray(dmDefaultSource); attributes.add(new SunAlternateMedia(tray)); } }