diff options
author | smallsql <smallsql> | 2012-08-24 13:11:44 +0400 |
---|---|---|
committer | smallsql <smallsql> | 2012-08-24 13:11:44 +0400 |
commit | 1bb5da858352b9efe7ee9be57bc8aa3dd0f62bbe (patch) | |
tree | 9fb96f648e2c41d4f3fdabc11b96fa43e34f7dea /openjdk/sun/print | |
parent | 4e0b735683e6124fbcde30582966c72f5eb0d3f8 (diff) |
If the page count was not known before printing then an additional blank page was printed.
Diffstat (limited to 'openjdk/sun/print')
-rw-r--r-- | openjdk/sun/print/Win32PrintJob.java | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/openjdk/sun/print/Win32PrintJob.java b/openjdk/sun/print/Win32PrintJob.java index e07bd713..654f742b 100644 --- a/openjdk/sun/print/Win32PrintJob.java +++ b/openjdk/sun/print/Win32PrintJob.java @@ -1,5 +1,5 @@ /* - Copyright (C) 2009 Volker Berlin (i-net software) + Copyright (C) 2009, 2012 Volker Berlin (i-net software) Copyright (C) 2010, 2011 Karsten Heinrich (i-net software) This software is provided 'as-is', without any express or implied @@ -906,22 +906,21 @@ public class Win32PrintJob implements CancelablePrintJob{ return; } } - Graphics printGraphics = peer.createGraphics(ev.get_Graphics()); - if( printGraphics instanceof Graphics2D ){ - Graphics2D g2d = ((Graphics2D)printGraphics); - int tX = (int) pageFormat.getWidth(); - int tY = (int) pageFormat.getHeight(); - // apply Java to .NET scaling (1/72 inch to 1/100 inch) - g2d.scale(100d/72d, 100d/72d); - // NOTE on Landscape printing: - // Setting landscape to true on the printer settings - // of a page already rotates the page! The orig. java code rotates the page itself, - // for .NET this is not required. - if( orient == OrientationRequested.REVERSE_LANDSCAPE){ - g2d.translate( tX, tY ); - g2d.rotate( Math.PI ); - } - } + Graphics2D printGraphics = peer.createGraphics(ev.get_Graphics()); + Graphics2D g2d = ((Graphics2D)printGraphics); + int tX = (int) pageFormat.getWidth(); + int tY = (int) pageFormat.getHeight(); + // apply Java to .NET scaling (1/72 inch to 1/100 inch) + g2d.scale(100d/72d, 100d/72d); + // NOTE on Landscape printing: + // Setting landscape to true on the printer settings + // of a page already rotates the page! The orig. java code rotates the page itself, + // for .NET this is not required. + if( orient == OrientationRequested.REVERSE_LANDSCAPE){ + g2d.translate( tX, tY ); + g2d.rotate( Math.PI ); + } + printable.print(printGraphics, pageFormat, realPage); realPage = pageRanges.getPageForIndex(++pageIndex); @@ -929,15 +928,7 @@ public class Win32PrintJob implements CancelablePrintJob{ printable = pageable.getPrintable(realPage); pageFormat = pageable.getPageFormat(realPage); int pageResult = printable.print(peekGraphics, pageFormat, realPage); - if( pageResult == Printable.PAGE_EXISTS ){ - ev.set_HasMorePages( true ); - } else { - if( pageRanges.checkJobComplete(pageIndex) ){ - ev.set_HasMorePages( false ); - } else { - ev.set_HasMorePages( true ); - } - } + ev.set_HasMorePages( pageResult == Printable.PAGE_EXISTS ); } else { ev.set_HasMorePages( false ); } |