javax.print.attribute.standard.MediaSize Java Examples
The following examples show how to use
javax.print.attribute.standard.MediaSize.
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 TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** MediaSizeName / dmPaper */ private final int[] getWin32MediaAttrib() { int wid_ht[] = {0, 0}; if (attributes != null) { Media media = (Media)attributes.get(Media.class); if (media instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media; MediaSize ms = MediaSize.getMediaSizeForName(msn); if (ms != null) { wid_ht[0] = (int)(ms.getX(MediaSize.INCH) * 72.0); wid_ht[1] = (int)(ms.getY(MediaSize.INCH) * 72.0); } } } return wid_ht; }
Example #2
Source File: Win32PrintService.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public MediaSizeName findMatchingMediaSizeNameMM (float w, float h){ if (predefMedia != null) { for (int k=0; k<predefMedia.length;k++) { if (predefMedia[k] == null) { continue; } if (isSameSize(predefMedia[k].getX(MediaSize.MM), predefMedia[k].getY(MediaSize.MM), w, h)) { return predefMedia[k].getMediaSizeName(); } } } return null; }
Example #3
Source File: UnixPrintService.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private MediaPrintableArea[] getAllPrintableAreas() { if (mpas == null) { Media[] media = (Media[])getSupportedAttributeValues(Media.class, null, null); mpas = new MediaPrintableArea[media.length]; for (int i=0; i< mpas.length; i++) { if (media[i] instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media[i]; MediaSize mediaSize = MediaSize.getMediaSizeForName(msn); if (mediaSize == null) { mpas[i] = (MediaPrintableArea) getDefaultAttributeValue(MediaPrintableArea.class); } else { mpas[i] = new MediaPrintableArea(0.25f, 0.25f, mediaSize.getX(MediaSize.INCH)-0.5f, mediaSize.getY(MediaSize.INCH)-0.5f, MediaSize.INCH); } } } } MediaPrintableArea[] mpasCopy = new MediaPrintableArea[mpas.length]; System.arraycopy(mpas, 0, mpasCopy, 0, mpas.length); return mpasCopy; }
Example #4
Source File: WrongPaperPrintingTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static void doTest() { PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(Chromaticity.MONOCHROME); MediaSize isoA5Size = MediaSize.getMediaSizeForName(MediaSizeName.ISO_A5); float[] size = isoA5Size.getSize(Size2DSyntax.INCH); Paper paper = new Paper(); paper.setSize(size[0] * 72.0, size[1] * 72.0); paper.setImageableArea(0.0, 0.0, size[0] * 72.0, size[1] * 72.0); PageFormat pf = new PageFormat(); pf.setPaper(paper); PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(new WrongPaperPrintingTest(), job.validatePage(pf)); if (job.printDialog()) { try { job.print(aset); } catch (PrinterException pe) { throw new RuntimeException(pe); } } }
Example #5
Source File: WPrinterJob.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** MediaSizeName / dmPaper */ private final int[] getWin32MediaAttrib() { int wid_ht[] = {0, 0}; if (attributes != null) { Media media = (Media)attributes.get(Media.class); if (media instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media; MediaSize ms = MediaSize.getMediaSizeForName(msn); if (ms != null) { wid_ht[0] = (int)(ms.getX(MediaSize.INCH) * 72.0); wid_ht[1] = (int)(ms.getY(MediaSize.INCH) * 72.0); } } } return wid_ht; }
Example #6
Source File: WrongPaperForBookPrintingTest.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static void doTest() { PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(Chromaticity.MONOCHROME); MediaSize isoA5Size = MediaSize.getMediaSizeForName(MediaSizeName.ISO_A5); float[] size = isoA5Size.getSize(Size2DSyntax.INCH); Paper paper = new Paper(); paper.setSize(size[0] * 72.0, size[1] * 72.0); paper.setImageableArea(0.0, 0.0, size[0] * 72.0, size[1] * 72.0); PageFormat pf = new PageFormat(); pf.setPaper(paper); Book pageable = new Book(); pageable.append(new WrongPaperForBookPrintingTest(), pf); PrinterJob job = PrinterJob.getPrinterJob(); job.setPageable(pageable); if (job.printDialog()) { try { job.print(aset); } catch (PrinterException pe) { throw new RuntimeException(pe); } } }
Example #7
Source File: Win32PrintService.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public MediaSizeName findMatchingMediaSizeNameMM (float w, float h){ if (predefMedia != null) { for (int k=0; k<predefMedia.length;k++) { if (predefMedia[k] == null) { continue; } if (isSameSize(predefMedia[k].getX(MediaSize.MM), predefMedia[k].getY(MediaSize.MM), w, h)) { return predefMedia[k].getMediaSizeName(); } } } return null; }
Example #8
Source File: WPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** MediaSizeName / dmPaper */ private final int[] getWin32MediaAttrib() { int wid_ht[] = {0, 0}; if (attributes != null) { Media media = (Media)attributes.get(Media.class); if (media instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media; MediaSize ms = MediaSize.getMediaSizeForName(msn); if (ms != null) { wid_ht[0] = (int)(ms.getX(MediaSize.INCH) * 72.0); wid_ht[1] = (int)(ms.getY(MediaSize.INCH) * 72.0); } } } return wid_ht; }
Example #9
Source File: WPrinterJob.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** MediaSizeName / dmPaper */ private final int[] getWin32MediaAttrib() { int wid_ht[] = {0, 0}; if (attributes != null) { Media media = (Media)attributes.get(Media.class); if (media instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media; MediaSize ms = MediaSize.getMediaSizeForName(msn); if (ms != null) { wid_ht[0] = (int)(ms.getX(MediaSize.INCH) * 72.0); wid_ht[1] = (int)(ms.getY(MediaSize.INCH) * 72.0); } } } return wid_ht; }
Example #10
Source File: Win32PrintService.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public MediaSizeName findMatchingMediaSizeNameMM (float w, float h){ if (predefMedia != null) { for (int k=0; k<predefMedia.length;k++) { if (predefMedia[k] == null) { continue; } if (isSameSize(predefMedia[k].getX(MediaSize.MM), predefMedia[k].getY(MediaSize.MM), w, h)) { return predefMedia[k].getMediaSizeName(); } } } return null; }
Example #11
Source File: UnixPrintService.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private MediaPrintableArea[] getAllPrintableAreas() { if (mpas == null) { Media[] media = (Media[])getSupportedAttributeValues(Media.class, null, null); mpas = new MediaPrintableArea[media.length]; for (int i=0; i< mpas.length; i++) { if (media[i] instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media[i]; MediaSize mediaSize = MediaSize.getMediaSizeForName(msn); if (mediaSize == null) { mpas[i] = (MediaPrintableArea) getDefaultAttributeValue(MediaPrintableArea.class); } else { mpas[i] = new MediaPrintableArea(0.25f, 0.25f, mediaSize.getX(MediaSize.INCH)-0.5f, mediaSize.getY(MediaSize.INCH)-0.5f, MediaSize.INCH); } } } } MediaPrintableArea[] mpasCopy = new MediaPrintableArea[mpas.length]; System.arraycopy(mpas, 0, mpasCopy, 0, mpas.length); return mpasCopy; }
Example #12
Source File: Win32PrintService.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public MediaSizeName findMatchingMediaSizeNameMM (float w, float h){ if (predefMedia != null) { for (int k=0; k<predefMedia.length;k++) { if (predefMedia[k] == null) { continue; } if (isSameSize(predefMedia[k].getX(MediaSize.MM), predefMedia[k].getY(MediaSize.MM), w, h)) { return predefMedia[k].getMediaSizeName(); } } } return null; }
Example #13
Source File: WPrinterJob.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** MediaSizeName / dmPaper */ private final int[] getWin32MediaAttrib() { int wid_ht[] = {0, 0}; if (attributes != null) { Media media = (Media)attributes.get(Media.class); if (media instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media; MediaSize ms = MediaSize.getMediaSizeForName(msn); if (ms != null) { wid_ht[0] = (int)(ms.getX(MediaSize.INCH) * 72.0); wid_ht[1] = (int)(ms.getY(MediaSize.INCH) * 72.0); } } } return wid_ht; }
Example #14
Source File: Win32PrintService.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public MediaSizeName findMatchingMediaSizeNameMM (float w, float h){ if (predefMedia != null) { for (int k=0; k<predefMedia.length;k++) { if (predefMedia[k] == null) { continue; } if (isSameSize(predefMedia[k].getX(MediaSize.MM), predefMedia[k].getY(MediaSize.MM), w, h)) { return predefMedia[k].getMediaSizeName(); } } } return null; }
Example #15
Source File: UnixPrintService.java From hottub with GNU General Public License v2.0 | 6 votes |
private MediaPrintableArea[] getAllPrintableAreas() { if (mpas == null) { Media[] media = (Media[])getSupportedAttributeValues(Media.class, null, null); mpas = new MediaPrintableArea[media.length]; for (int i=0; i< mpas.length; i++) { if (media[i] instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media[i]; MediaSize mediaSize = MediaSize.getMediaSizeForName(msn); if (mediaSize == null) { mpas[i] = (MediaPrintableArea) getDefaultAttributeValue(MediaPrintableArea.class); } else { mpas[i] = new MediaPrintableArea(0.25f, 0.25f, mediaSize.getX(MediaSize.INCH)-0.5f, mediaSize.getY(MediaSize.INCH)-0.5f, MediaSize.INCH); } } } } MediaPrintableArea[] mpasCopy = new MediaPrintableArea[mpas.length]; System.arraycopy(mpas, 0, mpasCopy, 0, mpas.length); return mpasCopy; }
Example #16
Source File: Win32PrintService.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public MediaSizeName findMatchingMediaSizeNameMM (float w, float h){ if (predefMedia != null) { for (int k=0; k<predefMedia.length;k++) { if (predefMedia[k] == null) { continue; } if (isSameSize(predefMedia[k].getX(MediaSize.MM), predefMedia[k].getY(MediaSize.MM), w, h)) { return predefMedia[k].getMediaSizeName(); } } } return null; }
Example #17
Source File: UnixPrintService.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private MediaPrintableArea[] getAllPrintableAreas() { if (mpas == null) { Media[] media = (Media[])getSupportedAttributeValues(Media.class, null, null); mpas = new MediaPrintableArea[media.length]; for (int i=0; i< mpas.length; i++) { if (media[i] instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media[i]; MediaSize mediaSize = MediaSize.getMediaSizeForName(msn); if (mediaSize == null) { mpas[i] = (MediaPrintableArea) getDefaultAttributeValue(MediaPrintableArea.class); } else { mpas[i] = new MediaPrintableArea(0.25f, 0.25f, mediaSize.getX(MediaSize.INCH)-0.5f, mediaSize.getY(MediaSize.INCH)-0.5f, MediaSize.INCH); } } } } MediaPrintableArea[] mpasCopy = new MediaPrintableArea[mpas.length]; System.arraycopy(mpas, 0, mpasCopy, 0, mpas.length); return mpasCopy; }
Example #18
Source File: WrongPaperPrintingTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static void doTest() { PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet(); aset.add(Chromaticity.MONOCHROME); MediaSize isoA5Size = MediaSize.getMediaSizeForName(MediaSizeName.ISO_A5); float[] size = isoA5Size.getSize(Size2DSyntax.INCH); Paper paper = new Paper(); paper.setSize(size[0] * 72.0, size[1] * 72.0); paper.setImageableArea(0.0, 0.0, size[0] * 72.0, size[1] * 72.0); PageFormat pf = new PageFormat(); pf.setPaper(paper); PrinterJob job = PrinterJob.getPrinterJob(); job.setPrintable(new WrongPaperPrintingTest(), job.validatePage(pf)); if (job.printDialog()) { try { job.print(aset); } catch (PrinterException pe) { throw new RuntimeException(pe); } } }
Example #19
Source File: UnixPrintService.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private MediaPrintableArea[] getAllPrintableAreas() { if (mpas == null) { Media[] media = (Media[])getSupportedAttributeValues(Media.class, null, null); mpas = new MediaPrintableArea[media.length]; for (int i=0; i< mpas.length; i++) { if (media[i] instanceof MediaSizeName) { MediaSizeName msn = (MediaSizeName)media[i]; MediaSize mediaSize = MediaSize.getMediaSizeForName(msn); if (mediaSize == null) { mpas[i] = (MediaPrintableArea) getDefaultAttributeValue(MediaPrintableArea.class); } else { mpas[i] = new MediaPrintableArea(0.25f, 0.25f, mediaSize.getX(MediaSize.INCH)-0.5f, mediaSize.getY(MediaSize.INCH)-0.5f, MediaSize.INCH); } } } } MediaPrintableArea[] mpasCopy = new MediaPrintableArea[mpas.length]; System.arraycopy(mpas, 0, mpasCopy, 0, mpas.length); return mpasCopy; }
Example #20
Source File: PrintJob2D.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static MediaSizeName mapMedia(MediaType mType) { MediaSizeName media = null; // JAVAXSIZES.length and SIZES.length must be equal! // Attempt to recover by getting the smaller size. int length = Math.min(SIZES.length, JAVAXSIZES.length); for (int i=0; i < length; i++) { if (SIZES[i] == mType) { if ((JAVAXSIZES[i] != null) && MediaSize.getMediaSizeForName(JAVAXSIZES[i]) != null) { media = JAVAXSIZES[i]; break; } else { /* create Custom Media */ media = new CustomMediaSizeName(SIZES[i].toString()); float w = (float)Math.rint(WIDTHS[i] / 72.0); float h = (float)Math.rint(LENGTHS[i] / 72.0); if (w > 0.0 && h > 0.0) { // add new created MediaSize to our static map // so it will be found when we call findMedia new MediaSize(w, h, Size2DSyntax.INCH, media); } break; } } } return media; }
Example #21
Source File: MediaMappingsTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { MediaSize sizeA = MediaSize.getMediaSizeForName(MediaSizeName.A); new MediaSize(1.0f, 2.0f, MediaSize.MM, MediaSizeName.A); if (!sizeA.equals(MediaSize.getMediaSizeForName(MediaSizeName.A))) { throw new RuntimeException("mapping changed"); } MediaSize sizeB = MediaSize.getMediaSizeForName(MediaSizeName.B); new MediaSize(1, 2, MediaSize.MM, MediaSizeName.B); if (!sizeB.equals(MediaSize.getMediaSizeForName(MediaSizeName.B))) { throw new RuntimeException("mapping changed"); } }
Example #22
Source File: MediaMappingsTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { MediaSize sizeA = MediaSize.getMediaSizeForName(MediaSizeName.A); new MediaSize(1.0f, 2.0f, MediaSize.MM, MediaSizeName.A); if (!sizeA.equals(MediaSize.getMediaSizeForName(MediaSizeName.A))) { throw new RuntimeException("mapping changed"); } MediaSize sizeB = MediaSize.getMediaSizeForName(MediaSizeName.B); new MediaSize(1, 2, MediaSize.MM, MediaSizeName.B); if (!sizeB.equals(MediaSize.getMediaSizeForName(MediaSizeName.B))) { throw new RuntimeException("mapping changed"); } }
Example #23
Source File: CPrinterJob.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private MediaSize getDefaultMediaSize(PageFormat page){ final int inch = 72; Paper paper = page.getPaper(); float width = (float) (paper.getWidth() / inch); float height = (float) (paper.getHeight() / inch); return new MediaSize(width, height, MediaSize.INCH); }
Example #24
Source File: PrintJob2D.java From Bytecoder with Apache License 2.0 | 5 votes |
public static MediaSizeName mapMedia(MediaType mType) { MediaSizeName media = null; // JAVAXSIZES.length and SIZES.length must be equal! // Attempt to recover by getting the smaller size. int length = Math.min(SIZES.length, JAVAXSIZES.length); for (int i=0; i < length; i++) { if (SIZES[i] == mType) { if ((JAVAXSIZES[i] != null) && MediaSize.getMediaSizeForName(JAVAXSIZES[i]) != null) { media = JAVAXSIZES[i]; break; } else { /* create Custom Media */ media = new CustomMediaSizeName(SIZES[i].toString()); float w = (float)Math.rint(WIDTHS[i] / 72.0); float h = (float)Math.rint(LENGTHS[i] / 72.0); if (w > 0.0 && h > 0.0) { // add new created MediaSize to our static map // so it will be found when we call findMedia new MediaSize(w, h, Size2DSyntax.INCH, media); } break; } } } return media; }
Example #25
Source File: PSStreamPrintJob.java From hottub with GNU General Public License v2.0 | 5 votes |
public void printableJob(Printable printable, PrintRequestAttributeSet attributes) throws PrintException { try { synchronized(this) { if (job != null) { // shouldn't happen throw new PrintException("already printing"); } else { job = new PSPrinterJob(); } } job.setPrintService(getPrintService()); PageFormat pf = new PageFormat(); if (mediaSize != null) { Paper p = new Paper(); p.setSize(mediaSize.getX(MediaSize.INCH)*72.0, mediaSize.getY(MediaSize.INCH)*72.0); p.setImageableArea(72.0, 72.0, p.getWidth()-144.0, p.getHeight()-144.0); pf.setPaper(p); } if (orient == OrientationRequested.REVERSE_LANDSCAPE) { pf.setOrientation(PageFormat.REVERSE_LANDSCAPE); } else if (orient == OrientationRequested.LANDSCAPE) { pf.setOrientation(PageFormat.LANDSCAPE); } job.setPrintable(printable, pf); job.print(attributes); notifyEvent(PrintJobEvent.JOB_COMPLETE); return; } catch (PrinterException pe) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException(pe); } finally { printReturned = true; } }
Example #26
Source File: MediaMappingsTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String args[]) { MediaSize sizeA = MediaSize.getMediaSizeForName(MediaSizeName.A); new MediaSize(1.0f, 2.0f, MediaSize.MM, MediaSizeName.A); if (!sizeA.equals(MediaSize.getMediaSizeForName(MediaSizeName.A))) { throw new RuntimeException("mapping changed"); } MediaSize sizeB = MediaSize.getMediaSizeForName(MediaSizeName.B); new MediaSize(1, 2, MediaSize.MM, MediaSizeName.B); if (!sizeB.equals(MediaSize.getMediaSizeForName(MediaSizeName.B))) { throw new RuntimeException("mapping changed"); } }
Example #27
Source File: UnixPrintJob.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void printableJob(Printable printable) throws PrintException { try { synchronized(this) { if (job != null) { // shouldn't happen throw new PrintException("already printing"); } else { job = new PSPrinterJob(); } } job.setPrintService(getPrintService()); job.setCopies(copies); job.setJobName(jobName); PageFormat pf = new PageFormat(); if (mediaSize != null) { Paper p = new Paper(); p.setSize(mediaSize.getX(MediaSize.INCH)*72.0, mediaSize.getY(MediaSize.INCH)*72.0); p.setImageableArea(72.0, 72.0, p.getWidth()-144.0, p.getHeight()-144.0); pf.setPaper(p); } if (orient == OrientationRequested.REVERSE_LANDSCAPE) { pf.setOrientation(PageFormat.REVERSE_LANDSCAPE); } else if (orient == OrientationRequested.LANDSCAPE) { pf.setOrientation(PageFormat.LANDSCAPE); } job.setPrintable(printable, pf); job.print(reqAttrSet); notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE); return; } catch (PrinterException pe) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException(pe); } finally { printReturned = true; notifyEvent(PrintJobEvent.NO_MORE_EVENTS); } }
Example #28
Source File: CustomMediaSizeName.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public CustomMediaSizeName(String name, String choice, float width, float length) { super(nextValue(name)); choiceName = choice; customEnumTable.add(this); mediaName = null; try { mediaName = MediaSize.findMedia(width, length, MediaSize.INCH); } catch (IllegalArgumentException iae) { } // The public API method finds a closest match even if it not // all that close. Here we want to be sure its *really* close. if (mediaName != null) { MediaSize sz = MediaSize.getMediaSizeForName(mediaName); if (sz == null) { mediaName = null; } else { float w = sz.getX(MediaSize.INCH); float h = sz.getY(MediaSize.INCH); float dw = Math.abs(w - width); float dh = Math.abs(h - length); if (dw > 0.1 || dh > 0.1) { mediaName = null; } } } }
Example #29
Source File: CPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private MediaSize getDefaultMediaSize(PageFormat page){ final int inch = 72; Paper paper = page.getPaper(); float width = (float) (paper.getWidth() / inch); float height = (float) (paper.getHeight() / inch); return new MediaSize(width, height, MediaSize.INCH); }
Example #30
Source File: UnixPrintJob.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public void printableJob(Printable printable) throws PrintException { try { synchronized(this) { if (job != null) { // shouldn't happen throw new PrintException("already printing"); } else { job = new PSPrinterJob(); } } job.setPrintService(getPrintService()); job.setCopies(copies); job.setJobName(jobName); PageFormat pf = new PageFormat(); if (mediaSize != null) { Paper p = new Paper(); p.setSize(mediaSize.getX(MediaSize.INCH)*72.0, mediaSize.getY(MediaSize.INCH)*72.0); p.setImageableArea(72.0, 72.0, p.getWidth()-144.0, p.getHeight()-144.0); pf.setPaper(p); } if (orient == OrientationRequested.REVERSE_LANDSCAPE) { pf.setOrientation(PageFormat.REVERSE_LANDSCAPE); } else if (orient == OrientationRequested.LANDSCAPE) { pf.setOrientation(PageFormat.LANDSCAPE); } job.setPrintable(printable, pf); job.print(reqAttrSet); notifyEvent(PrintJobEvent.DATA_TRANSFER_COMPLETE); return; } catch (PrinterException pe) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException(pe); } finally { printReturned = true; notifyEvent(PrintJobEvent.NO_MORE_EVENTS); } }