aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/documentation/content/xdocs/trunk/output.xml25
-rw-r--r--src/java/org/apache/fop/render/pcl/PCLGenerator.java13
-rw-r--r--src/java/org/apache/fop/render/pcl/PCLRenderer.java11
-rw-r--r--status.xml4
4 files changed, 50 insertions, 3 deletions
diff --git a/src/documentation/content/xdocs/trunk/output.xml b/src/documentation/content/xdocs/trunk/output.xml
index 628df1248..22d916d31 100644
--- a/src/documentation/content/xdocs/trunk/output.xml
+++ b/src/documentation/content/xdocs/trunk/output.xml
@@ -422,6 +422,31 @@ out = proc.getOutputStream();]]></source>
Consult the technical reference for your printer for all available values.
</p>
</section>
+ <section id="pcl-duplex-mode">
+ <title>Page Duplex Mode</title>
+ <p>
+ The duplex-mode extension attribute on fo:simple-page-master allows to
+ select the duplex mode to be used for a particular simple-page-master.
+ Example:
+ </p>
+ <source><![CDATA[
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="simple" pcl:duplex-mode="0">
+ ...
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+]]></source>
+ <p>
+ Note: the duplex is a positive integer and the value depends on
+ the target printer. Not all PCL printers support duplexing.
+ Usually,
+ "0" is simplex,
+ "1" is duplex (long-edge binding),
+ "2" is duplex (short-edge binding).
+
+ Consult the technical reference for your printer for all available values.
+ </p>
+ </section>
</section>
</section>
<section id="afp">
diff --git a/src/java/org/apache/fop/render/pcl/PCLGenerator.java b/src/java/org/apache/fop/render/pcl/PCLGenerator.java
index 5ca9a8bf9..6a4425012 100644
--- a/src/java/org/apache/fop/render/pcl/PCLGenerator.java
+++ b/src/java/org/apache/fop/render/pcl/PCLGenerator.java
@@ -230,6 +230,19 @@ public class PCLGenerator {
}
/**
+ * Selects the duplexing mode for the page.
+ * The parameter is usually printer-specific.
+ * "0" means Simplex,
+ * "1" means Duplex, Long-Edge Binding,
+ * "2" means Duplex, Short-Edge Binding.
+ * @param selector the integer representing the duplexing mode of the page
+ * @throws IOException In case of an I/O error
+ */
+ public void selectDuplexMode(int selector) throws IOException {
+ writeCommand("&l" + selector + "S");
+ }
+
+ /**
* Clears the horizontal margins.
* @throws IOException In case of an I/O error
*/
diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderer.java b/src/java/org/apache/fop/render/pcl/PCLRenderer.java
index 007ce4828..988517cc7 100644
--- a/src/java/org/apache/fop/render/pcl/PCLRenderer.java
+++ b/src/java/org/apache/fop/render/pcl/PCLRenderer.java
@@ -395,9 +395,7 @@ public class PCLRenderer extends PrintRenderer {
return MIME_TYPE;
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public void renderPage(PageViewport page) throws IOException, FOPException {
saveGraphicsState();
@@ -408,6 +406,13 @@ public class PCLRenderer extends PrintRenderer {
gen.selectPaperSource(Integer.parseInt(paperSource));
}
+ // Is Page duplex?
+ String pageDuplex = page.getForeignAttributeValue(
+ new QName(PCLElementMapping.NAMESPACE, null, "duplex-mode"));
+ if (pageDuplex != null) {
+ gen.selectDuplexMode(Integer.parseInt(pageDuplex));
+ }
+
//Page size
final long pagewidth = Math.round(page.getViewArea().getWidth());
final long pageheight = Math.round(page.getViewArea().getHeight());
diff --git a/status.xml b/status.xml
index 2cfc7658e..c82fca331 100644
--- a/status.xml
+++ b/status.xml
@@ -57,6 +57,10 @@
<action context="Renderers" dev="AC" importance="high" type="add">
Added SVG support for AFP (GOCA).
</action -->
+ <action context="Renderers" dev="JM" type="add" fixes-bug="45115" due-to="Martin Edge">
+ Added a PCL-specific extension attribute on simple-page-master for controlling
+ the simplex/duplex mode.
+ </action>
<action context="Code" dev="AD" type="fix" fixes-bug="45097">
Corrected white-space-treatment for situations where an inline-node is the first/last
child node of an fo:block, without preceding/following text.