From e413e9c8a102146703e2f47291f5894476edc48b Mon Sep 17 00:00:00 2001 From: Adrian Cumiskey Date: Tue, 6 May 2008 09:14:47 +0000 Subject: Merged revisions 652821-652822,652835,653036,653045,653048,653106,653144,653202,653204,653311,653564 via svnmerge from https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r652821 | adelmelle | 2008-05-02 17:58:26 +0100 (Fri, 02 May 2008) | 6 lines Cleanup/Correction after r657673 -> added missing file FObj.java -> pushed retrieve-class-name upwards to AbstractRetrieveMarker as a common property -> corrected use of property-name "retrieve-class-name" in source and testcase -> improved consistency in code-style ........ r652822 | adelmelle | 2008-05-02 18:00:33 +0100 (Fri, 02 May 2008) | 1 line Expand imports... ........ r652835 | adelmelle | 2008-05-02 18:28:25 +0100 (Fri, 02 May 2008) | 3 lines Bugzilla 42703: Fixed a regression introduced by the fix for Bugzilla 44286 ........ r653036 | adelmelle | 2008-05-03 11:21:45 +0100 (Sat, 03 May 2008) | 2 lines Cleanup: improve code-readibility ........ r653045 | adelmelle | 2008-05-03 11:51:16 +0100 (Sat, 03 May 2008) | 2 lines Tweak/correction: save local hash-code (as originally intended...) ........ r653048 | adelmelle | 2008-05-03 11:55:07 +0100 (Sat, 03 May 2008) | 2 lines Tweaks: make fobj member final; have default implementations for some methods throw an UnsupportedOperationException instead of merely logging an error ........ r653106 | acumiskey | 2008-05-03 20:07:18 +0100 (Sat, 03 May 2008) | 1 line Fixed the build. Assignment on final variable fobj. ........ r653144 | acumiskey | 2008-05-03 22:29:09 +0100 (Sat, 03 May 2008) | 1 line Fix that preserves the final status of the fobj member variable. ........ r653202 | adelmelle | 2008-05-04 12:37:31 +0100 (Sun, 04 May 2008) | 2 lines Change private element-generating methods to add the elements to a passed List (improves code-readability and reduces the amount of temporary LinkedList instances) ........ r653204 | adelmelle | 2008-05-04 14:04:28 +0100 (Sun, 04 May 2008) | 4 lines Further refinements: -> use cached auxiliary position where possible (analogous to BlockStackingLM) -> consolidate makeXXXPenalty() helpers ........ r653311 | jeremias | 2008-05-05 07:50:54 +0100 (Mon, 05 May 2008) | 6 lines Bugzilla #43650: PCL Renderer: Improved page format selection so it doesn't interfere with duplex printing. Submitted by: Thomas Margreiter Note: I've only been able to verify that the change doesn't have any negative effects on simplex printers. ........ r653564 | adelmelle | 2008-05-05 20:27:10 +0100 (Mon, 05 May 2008) | 2 lines Correction of indentation ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@653718 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/render/pcl/PCLRenderer.java | 54 +++++++++++++--------- 1 file changed, 32 insertions(+), 22 deletions(-) (limited to 'src/java/org/apache/fop/render/pcl') diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderer.java b/src/java/org/apache/fop/render/pcl/PCLRenderer.java index b89fba9c1..921856b07 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRenderer.java +++ b/src/java/org/apache/fop/render/pcl/PCLRenderer.java @@ -156,6 +156,11 @@ public class PCLRenderer extends PrintRenderer { */ 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 @@ public class PCLRenderer extends PrintRenderer { } 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. */ -- cgit v1.2.3