src/macosx/classes/sun/lwawt/macosx/CPrinterJob.java

Print this page

        

*** 207,217 **** /* Get the range of pages we are to print. If the * last page to print is unknown, then we print to * the end of the document. Note that firstPage * and lastPage are 0 based page indices. */ - int numPages = mDocument.getNumberOfPages(); int firstPage = getFirstPage(); int lastPage = getLastPage(); if(lastPage == Pageable.UNKNOWN_NUMBER_OF_PAGES) { int totalPages = mDocument.getNumberOfPages(); --- 207,216 ----
*** 224,233 **** --- 223,238 ---- synchronized (this) { performingPrinting = true; userCancelled = false; } + //Add support for PageRange + PageRanges pr = (attributes == null) ? null + : (PageRanges)attributes.get(PageRanges.class); + int[][] prMembers = (pr == null) ? new int[0][0] : pr.getMembers(); + int loopi = 0; + do { if (EventQueue.isDispatchThread()) { // This is an AWT EventQueue, and this print rendering loop needs to block it. onEventThread = true;
*** 256,265 **** --- 261,275 ---- printLoop(true, firstPage, lastPage); } catch (Exception e) { e.printStackTrace(); } } + if (++loopi < prMembers.length) { + firstPage = prMembers[loopi][0]-1; + lastPage = prMembers[loopi][1] -1; + } + } while (loopi < prMembers.length); } finally { synchronized (this) { // NOTE: Native code shouldn't allow exceptions out while // printing. They should cancel the print loop. performingPrinting = false;