Browse Source

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.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@653311 13f79535-47bb-0310-9956-ffa450edef68
pull/37/head
Jeremias Maerki 16 years ago
parent
commit
ae5b682934
2 changed files with 40 additions and 26 deletions
  1. 32
    22
      src/java/org/apache/fop/render/pcl/PCLRenderer.java
  2. 8
    4
      status.xml

+ 32
- 22
src/java/org/apache/fop/render/pcl/PCLRenderer.java View File

@@ -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. */

+ 8
- 4
status.xml View File

@@ -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>

Loading…
Cancel
Save