jeremias
Sun, 04 May 2008 23:51:28 -0700
Author: jeremias Date: Sun May 4 23:50:54 2008 New Revision: 653311 URL: http://svn.apache.org/viewvc?rev=653311&view=rev Log: Bugzilla #43650: PCL Renderer: Improved page format selection so it doesn't interfere with duplex printing. Submitted by: Thomas Margreiter <tm.at.felder.at> Note: I've only been able to verify that the change doesn't have any negative effects on simplex printers. Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java xmlgraphics/fop/trunk/status.xml Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java?rev=653311&r1=653310&r2=653311&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/pcl/PCLRenderer.java Sun May 4 23:50:54 2008 @@ -156,6 +156,11 @@ */ private boolean disabledPJL = false; + /** contains the pageWith of the last printed page */ + private long pageWidth = 0; + /** contains the pageHeight of the last printed page */ + private long pageHeight = 0; + /** * Create the PCL renderer */ @@ -416,29 +421,34 @@ } private void selectPageFormat(long pagewidth, long pageheight) throws IOException { - this.currentPageDefinition = PCLPageDefinition.getPageDefinition( - pagewidth, pageheight, 1000); - - if (this.currentPageDefinition == null) { - this.currentPageDefinition = PCLPageDefinition.getDefaultPageDefinition(); - PCLEventProducer eventProducer = PCLEventProducer.Provider.get( - getUserAgent().getEventBroadcaster()); - eventProducer.paperTypeUnavailable(this, pagewidth, pageheight, - this.currentPageDefinition.getName()); - } - if (log.isDebugEnabled()) { - log.debug("page size: " + currentPageDefinition.getPhysicalPageSize()); - log.debug("logical page: " + currentPageDefinition.getLogicalPageRect()); - } - if (this.currentPageDefinition.isLandscapeFormat()) { - gen.writeCommand("&l1O"); //Orientation - } else { - gen.writeCommand("&l0O"); //Orientation + //Only set the page format if it changes (otherwise duplex printing won't work) + if ((pagewidth != this.pageWidth) || (pageheight != this.pageHeight)) { + this.pageWidth = pagewidth; + this.pageHeight = pageheight; + + this.currentPageDefinition = PCLPageDefinition.getPageDefinition( + pagewidth, pageheight, 1000); + + if (this.currentPageDefinition == null) { + this.currentPageDefinition = PCLPageDefinition.getDefaultPageDefinition(); + log.warn("Paper type could not be determined. Falling back to: " + + this.currentPageDefinition.getName()); + } + if (log.isDebugEnabled()) { + log.debug("page size: " + currentPageDefinition.getPhysicalPageSize()); + log.debug("logical page: " + currentPageDefinition.getLogicalPageRect()); + } + + if (this.currentPageDefinition.isLandscapeFormat()) { + gen.writeCommand("&l1O"); //Landscape Orientation + } else { + gen.writeCommand("&l0O"); //Portrait Orientation + } + gen.selectPageSize(this.currentPageDefinition.getSelector()); + + gen.clearHorizontalMargins(); + gen.setTopMargin(0); } - gen.selectPageSize(this.currentPageDefinition.getSelector()); - - gen.clearHorizontalMargins(); - gen.setTopMargin(0); } /** Saves the current graphics state on the stack. */ Modified: xmlgraphics/fop/trunk/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=653311&r1=653310&r2=653311&view=diff ============================================================================== --- xmlgraphics/fop/trunk/status.xml (original) +++ xmlgraphics/fop/trunk/status.xml Sun May 4 23:50:54 2008 @@ -57,11 +57,15 @@ <action context="Renderers" dev="AC" importance="high" type="add"> Added SVG support for AFP (GOCA). </action --> - <action context="Code" dev="AD" type="fix" fixes-bug="42703"> + <action context="Renderers" dev="JM" type="fix" fixes-bug="43650"> + PCL Renderer: Improved page format selection so it doesn't interfere with + duplex printing. + </action> + <action context="Layout" dev="AD" type="fix" fixes-bug="42703"> Fixed a regression introduced by the fix for - <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=44286">Bugzilla 44286</a>. + <link href="https://issues.apache.org/bugzilla/show_bug.cgi?id=44286">Bugzilla 44286</link>. </action> - <action context="Code" dev="AD" type="fix" fixes-bug="43591"> + <action context="Layout" dev="AD" type="fix" fixes-bug="43591"> Activated min-height/max-height and min-width/max-width properties. </action> <action context="Code" dev="AD" type="fix" fixes-bug="44203"> @@ -69,7 +73,7 @@ If the source had an associated InputStream, an UnsupportedOperationException was triggered. </action> - <action context="Code" dev="AD" type="add" fixes-bug="44634"> + <action context="Renderers" dev="AD" type="add" fixes-bug="44634"> Add partial support for the "show-destination" property on fo:basic-link (PDF output only; see limitations on the compliance page) </action> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]