java.awt.print.Pageable Java Examples
The following examples show how to use
java.awt.print.Pageable.
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: RasterPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #2
Source File: RasterPrinterJob.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #3
Source File: RasterPrinterJob.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #4
Source File: RasterPrinterJob.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #5
Source File: RasterPrinterJob.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #6
Source File: RasterPrinterJob.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #7
Source File: RasterPrinterJob.java From Bytecoder with Apache License 2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #8
Source File: RasterPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #9
Source File: RasterPrinterJob.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #10
Source File: UnixPrintJob.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void pageableJob(Pageable pageable) 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); job.setPageable(pageable); 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 #11
Source File: RasterPrinterJob.java From hottub with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #12
Source File: RasterPrinterJob.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #13
Source File: RasterPrinterJob.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #14
Source File: RasterPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #15
Source File: RasterPrinterJob.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
protected final int getMaxPageAttrib() { if (attributes != null) { SunMinMaxPage s = (SunMinMaxPage)attributes.get(SunMinMaxPage.class); if (s != null) { return s.getMax(); } } Pageable pageable = getPageable(); if (pageable != null) { int numPages = pageable.getNumberOfPages(); if (numPages <= Pageable.UNKNOWN_NUMBER_OF_PAGES) { numPages = MAX_UNKNOWN_PAGES; } return ((numPages == 0) ? 1 : numPages); } return Integer.MAX_VALUE; }
Example #16
Source File: RasterPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #17
Source File: RasterPrinterJob.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
protected PageFormat getPageFormatFromAttributes() { Pageable pageable = null; if (attributes == null || attributes.isEmpty() || !((pageable = getPageable()) instanceof OpenBook)) { return null; } PageFormat newPf = attributeToPageFormat( getPrintService(), attributes); PageFormat oldPf = null; if ((oldPf = pageable.getPageFormat(0)) != null) { // If orientation, media, imageable area attributes are not in // "attributes" set, then use respective values of the existing // page format "oldPf". if (attributes.get(OrientationRequested.class) == null) { newPf.setOrientation(oldPf.getOrientation()); } Paper newPaper = newPf.getPaper(); Paper oldPaper = oldPf.getPaper(); boolean oldPaperValWasSet = false; if (attributes.get(MediaSizeName.class) == null) { newPaper.setSize(oldPaper.getWidth(), oldPaper.getHeight()); oldPaperValWasSet = true; } if (attributes.get(MediaPrintableArea.class) == null) { newPaper.setImageableArea( oldPaper.getImageableX(), oldPaper.getImageableY(), oldPaper.getImageableWidth(), oldPaper.getImageableHeight()); oldPaperValWasSet = true; } if (oldPaperValWasSet) { newPf.setPaper(newPaper); } } return newPf; }
Example #18
Source File: RasterPrinterJob.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #19
Source File: RasterPrinterJob.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #20
Source File: RasterPrinterJob.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #21
Source File: RasterPrinterJob.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #22
Source File: PDFPrinterJob.java From jpexs-decompiler with GNU General Public License v3.0 | 5 votes |
@Override public void setPageable(Pageable document) throws NullPointerException { if (document == null) { throw new NullPointerException("Pageable cannot be null."); } this.pageable = document; }
Example #23
Source File: RasterPrinterJob.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
protected PageFormat getPageFormatFromAttributes() { if (attributes == null || attributes.isEmpty()) { return null; } PageFormat newPf = attributeToPageFormat( getPrintService(), attributes); PageFormat oldPf = null; Pageable pageable = getPageable(); if ((pageable != null) && (pageable instanceof OpenBook) && ((oldPf = pageable.getPageFormat(0)) != null)) { // If orientation, media, imageable area attributes are not in // "attributes" set, then use respective values of the existing // page format "oldPf". if (attributes.get(OrientationRequested.class) == null) { newPf.setOrientation(oldPf.getOrientation()); } Paper newPaper = newPf.getPaper(); Paper oldPaper = oldPf.getPaper(); boolean oldPaperValWasSet = false; if (attributes.get(MediaSizeName.class) == null) { newPaper.setSize(oldPaper.getWidth(), oldPaper.getHeight()); oldPaperValWasSet = true; } if (attributes.get(MediaPrintableArea.class) == null) { newPaper.setImageableArea( oldPaper.getImageableX(), oldPaper.getImageableY(), oldPaper.getImageableWidth(), oldPaper.getImageableHeight()); oldPaperValWasSet = true; } if (oldPaperValWasSet) { newPf.setPaper(newPaper); } } return newPf; }
Example #24
Source File: RasterPrinterJob.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #25
Source File: RasterPrinterJob.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #26
Source File: RasterPrinterJob.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #27
Source File: RasterPrinterJob.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #28
Source File: RasterPrinterJob.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }
Example #29
Source File: RasterPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
protected PageFormat getPageFormatFromAttributes() { Pageable pageable = null; if (attributes == null || attributes.isEmpty() || !((pageable = getPageable()) instanceof OpenBook)) { return null; } PageFormat newPf = attributeToPageFormat( getPrintService(), attributes); PageFormat oldPf = null; if ((oldPf = pageable.getPageFormat(0)) != null) { // If orientation, media, imageable area attributes are not in // "attributes" set, then use respective values of the existing // page format "oldPf". if (attributes.get(OrientationRequested.class) == null) { newPf.setOrientation(oldPf.getOrientation()); } Paper newPaper = newPf.getPaper(); Paper oldPaper = oldPf.getPaper(); boolean oldPaperValWasSet = false; if (attributes.get(MediaSizeName.class) == null) { newPaper.setSize(oldPaper.getWidth(), oldPaper.getHeight()); oldPaperValWasSet = true; } if (attributes.get(MediaPrintableArea.class) == null) { newPaper.setImageableArea( oldPaper.getImageableX(), oldPaper.getImageableY(), oldPaper.getImageableWidth(), oldPaper.getImageableHeight()); oldPaperValWasSet = true; } if (oldPaperValWasSet) { newPf.setPaper(newPaper); } } return newPf; }
Example #30
Source File: RasterPrinterJob.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Set the range of pages from a Book to be printed. * Both 'firstPage' and 'lastPage' are zero based * page indices. If either parameter is less than * zero then the page range is set to be from the * first page to the last. */ protected void setPageRange(int firstPage, int lastPage) { if(firstPage >= 0 && lastPage >= 0) { mFirstPage = firstPage; mLastPage = lastPage; if(mLastPage < mFirstPage) mLastPage = mFirstPage; } else { mFirstPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; mLastPage = Pageable.UNKNOWN_NUMBER_OF_PAGES; } }