diff options
author | Jeremias Maerki <jeremias@apache.org> | 2007-10-05 14:26:20 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2007-10-05 14:26:20 +0000 |
commit | 9c90d82a757b3ed323455c5604bc2a7d24866b0c (patch) | |
tree | 34418147d0f5575e17574677ab0a6b9d6cbb2e58 | |
parent | 7813671bc4c43b88af41b15304e28fe397162a91 (diff) | |
download | xmlgraphics-fop-9c90d82a757b3ed323455c5604bc2a7d24866b0c.tar.gz xmlgraphics-fop-9c90d82a757b3ed323455c5604bc2a7d24866b0c.zip |
Added a configuration setting to the PCL renderer that lets you disable PJL commands.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@582287 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/documentation/content/xdocs/trunk/output.xml | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/pcl/PCLRenderer.java | 51 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java | 4 | ||||
-rw-r--r-- | status.xml | 3 |
4 files changed, 53 insertions, 12 deletions
diff --git a/src/documentation/content/xdocs/trunk/output.xml b/src/documentation/content/xdocs/trunk/output.xml index 0fd85095c..7a2a79862 100644 --- a/src/documentation/content/xdocs/trunk/output.xml +++ b/src/documentation/content/xdocs/trunk/output.xml @@ -329,6 +329,7 @@ out = proc.getOutputStream();]]></source> <source><![CDATA[<renderer mime="application/vnd.hp-PCL"> <rendering>quality</rendering> <text-rendering>bitmap</text-rendering> + <disable-pjl>false</disable-pjl> </renderer>]]></source> <p> The default value for the "rendering" setting is "speed" which causes borders @@ -344,6 +345,12 @@ out = proc.getOutputStream();]]></source> to "bitmap" which causes all text to be rendered as bitmaps. </p> <p> + The default value for the "disable-pjl" setting is "false". This means that + the PCL renderer usually generates PJL commands before and after the document + in order to switch a printer into PCL language. PJL commands can be disabled + if you set this value to "true". + </p> + <p> You can control the output resolution for the PCL using the "target resolution" setting on the FOUserAgent. The actual value will be rounded up to the next supported PCL resolution. Currently, only 300 and 600 dpi are supported which diff --git a/src/java/org/apache/fop/render/pcl/PCLRenderer.java b/src/java/org/apache/fop/render/pcl/PCLRenderer.java index 9ac5d503e..095c3bba7 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRenderer.java +++ b/src/java/org/apache/fop/render/pcl/PCLRenderer.java @@ -48,11 +48,6 @@ import java.util.List; import java.util.Map; import java.util.Stack; -import org.w3c.dom.Document; - -import org.apache.xmlgraphics.java2d.GraphicContext; - -// FOP import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.fop.apps.FOPException; @@ -91,6 +86,8 @@ import org.apache.fop.render.pcl.extensions.PCLElementMapping; import org.apache.fop.traits.BorderProps; import org.apache.fop.util.QName; import org.apache.fop.util.UnitConv; +import org.apache.xmlgraphics.java2d.GraphicContext; +import org.w3c.dom.Document; /** * Renderer for the PCL 5 printer language. It also uses HP GL/2 for certain graphic elements. @@ -134,6 +131,11 @@ public class PCLRenderer extends PrintRenderer { * the mixture of native and bitmapped text does not provide the necessary quality. */ private boolean allTextAsBitmaps = false; + + /** + * Controls whether the generation of PJL commands gets disabled. + */ + private boolean disabledPJL = false; /** * Create the PCL renderer @@ -141,11 +143,32 @@ public class PCLRenderer extends PrintRenderer { public PCLRenderer() { } + /** + * Configures the renderer to trade speed for quality if desired. One example here is the way + * that borders are rendered. + * @param qualityBeforeSpeed true if quality is more important than speed + */ public void setQualityBeforeSpeed(boolean qualityBeforeSpeed) { this.qualityBeforeSpeed = qualityBeforeSpeed; } /** + * Controls whether PJL commands shall be generated by the PCL renderer. + * @param disable true to disable PJL commands + */ + public void setPJLDisabled(boolean disable) { + this.disabledPJL = disable; + } + + /** + * Indicates whether PJL generation is disabled. + * @return true if PJL generation is disabled. + */ + public boolean isPJLDisabled() { + return this.disabledPJL; + } + + /** * {@inheritDoc} */ public void setupFontInfo(FontInfo inFontInfo) { @@ -318,13 +341,15 @@ public class PCLRenderer extends PrintRenderer { this.out = outputStream; this.gen = new PCLGenerator(out, getResolution()); - gen.universalEndOfLanguage(); - gen.writeText("@PJL COMMENT Produced by " + userAgent.getProducer() + "\n"); - if (userAgent.getTitle() != null) { - gen.writeText("@PJL JOB NAME = \"" + userAgent.getTitle() + "\"\n"); + if (!isPJLDisabled()) { + gen.universalEndOfLanguage(); + gen.writeText("@PJL COMMENT Produced by " + userAgent.getProducer() + "\n"); + if (userAgent.getTitle() != null) { + gen.writeText("@PJL JOB NAME = \"" + userAgent.getTitle() + "\"\n"); + } + gen.writeText("@PJL SET RESOLUTION = " + getResolution() + "\n"); + gen.writeText("@PJL ENTER LANGUAGE = PCL\n"); } - gen.writeText("@PJL SET RESOLUTION = " + getResolution() + "\n"); - gen.writeText("@PJL ENTER LANGUAGE = PCL\n"); gen.resetPrinter(); gen.setUnitOfMeasure(getResolution()); gen.setRasterGraphicsResolution(getResolution()); @@ -334,7 +359,9 @@ public class PCLRenderer extends PrintRenderer { public void stopRenderer() throws IOException { gen.separateJobs(); gen.resetPrinter(); - gen.universalEndOfLanguage(); + if (!isPJLDisabled()) { + gen.universalEndOfLanguage(); + } } /** {@inheritDoc} */ diff --git a/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java b/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java index e0f0023c1..1330a46ac 100644 --- a/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java +++ b/src/java/org/apache/fop/render/pcl/PCLRendererConfigurator.java @@ -48,6 +48,7 @@ public class PCLRendererConfigurator extends PrintRendererConfigurator { Configuration cfg = super.getRendererConfig(renderer); if (cfg != null) { PCLRenderer pclRenderer = (PCLRenderer)renderer; + String rendering = cfg.getChild("rendering").getValue(null); if ("quality".equalsIgnoreCase(rendering)) { pclRenderer.setQualityBeforeSpeed(true); @@ -58,6 +59,7 @@ public class PCLRendererConfigurator extends PrintRendererConfigurator { "Valid values for 'rendering' are 'quality' and 'speed'. Value found: " + rendering); } + String textRendering = cfg.getChild("text-rendering").getValue(null); if ("bitmap".equalsIgnoreCase(textRendering)) { pclRenderer.setAllTextAsBitmaps(true); @@ -68,6 +70,8 @@ public class PCLRendererConfigurator extends PrintRendererConfigurator { "Valid values for 'text-rendering' are 'auto' and 'bitmap'. Value found: " + textRendering); } + + pclRenderer.setPJLDisabled(cfg.getChild("disable-pjl").getValueAsBoolean(false)); } } } diff --git a/status.xml b/status.xml index f04c2b081..18eb6c61c 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,9 @@ <changes> <release version="FOP Trunk"> + <action context="Code" dev="JM" type="add"> + Added a configuration setting to the PCL renderer to disable PJL commands. + </action> <action context="Code" dev="JM" type="fix" fixes-bug="43464" due-to="Bruno Feurer"> Fix to avoid a ClassCastException in renderer configuration. </action> |