aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/render/pcl/PCLRenderer.java
diff options
context:
space:
mode:
authorSteve Coffman <gears@apache.org>2001-08-01 22:12:54 +0000
committerSteve Coffman <gears@apache.org>2001-08-01 22:12:54 +0000
commiteeb2adff569057e2b6deb089ba9dffb21fb3a00b (patch)
treec8968573d60b496aa17befb1afbec840ddc1b355 /src/org/apache/fop/render/pcl/PCLRenderer.java
parenta5bc30d4a3977d60f0e70c2792bc4e3a37913a3d (diff)
downloadxmlgraphics-fop-eeb2adff569057e2b6deb089ba9dffb21fb3a00b.tar.gz
xmlgraphics-fop-eeb2adff569057e2b6deb089ba9dffb21fb3a00b.zip
Adds Mark Lillywhite's performance and memory patch in all it's glory.
Unfortunately breaks marker support. (AreaTree getNextPage and getPreviousPage return the current page) XSL-FO with markers is not a good idea until it is fixed. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194385 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/render/pcl/PCLRenderer.java')
-rwxr-xr-xsrc/org/apache/fop/render/pcl/PCLRenderer.java79
1 files changed, 35 insertions, 44 deletions
diff --git a/src/org/apache/fop/render/pcl/PCLRenderer.java b/src/org/apache/fop/render/pcl/PCLRenderer.java
index d47da9a59..9ccd4f39f 100755
--- a/src/org/apache/fop/render/pcl/PCLRenderer.java
+++ b/src/org/apache/fop/render/pcl/PCLRenderer.java
@@ -35,6 +35,8 @@ import java.util.Enumeration;
* Renderer that renders areas to PCL
* Created by Arthur E Welch III while at M&I EastPoint Technology
* Donated by EastPoint to the Apache FOP project March 2, 2001.
+ * Modified by Mark Lillywhite mark-fop@inomial.com to use the
+ * new Renderer interface.
*/
public class PCLRenderer extends PrintRenderer {
@@ -79,50 +81,7 @@ public class PCLRenderer extends PrintRenderer {
* @param producer string indicating application producing PCL
*/
public void setProducer(String producer) {}
-
- /**
- * render the areas into PCL
- *
- * @param areaTree the laid-out area tree
- * @param stream the Outputstream to write the PCL to
- */
- public void render(AreaTree areaTree,
- OutputStream stream) throws IOException, FOPException {
- MessageHandler.logln("rendering areas to PCL");
- idReferences = areaTree.getIDReferences();
- // this.pdfResources = this.pdfDoc.getResources();
- // this.pdfDoc.setIDReferences(idReferences);
- Enumeration e = areaTree.getPages().elements();
-
- currentStream = new PCLStream(stream);
-
- // Set orientation.
- if (orientation > -1)
- currentStream.add("\033&l" + orientation + "O");
- else
- currentStream.add("\033&l0O");
- if (orientation == 1 || orientation == 3)
- xoffset = -144;
- else
- xoffset = -180;
-
- // Reset the margins.
- currentStream.add("\033" + "9\033&l0E");
-
-
- while (e.hasMoreElements()) {
- this.renderPage((Page)e.nextElement());
- }
- if (!idReferences.isEveryIdValid()) {
- // throw new FOPException("The following id's were referenced but not found: "+idReferences.getInvalidIds()+"\n");
- MessageHandler.errorln("Warning: The following id's were referenced but not found: "
- + idReferences.getInvalidIds() + "\n");
- }
-
- MessageHandler.logln("writing out PCL");
- stream.flush();
- }
-
+
/**
* add a line to the current stream
*
@@ -749,5 +708,37 @@ public class PCLRenderer extends PrintRenderer {
* }
*/
}
+ public void startRenderer(OutputStream outputStream)
+ throws IOException
+ { MessageHandler.logln("rendering areas to PCL");
+ currentStream = new PCLStream(outputStream);
+
+ // Set orientation.
+ if (orientation > -1)
+ currentStream.add("\033&l" + orientation + "O");
+ else
+ currentStream.add("\033&l0O");
+ if (orientation == 1 || orientation == 3)
+ xoffset = -144;
+ else
+ xoffset = -180;
+
+ // Reset the margins.
+ currentStream.add("\033" + "9\033&l0E");
+ }
+
+ public void stopRenderer(OutputStream outputStream)
+ throws IOException
+ {
+ MessageHandler.logln("writing out PCL");
+ outputStream.flush();
+ }
+
+ public void render(Page page, OutputStream outputStream)
+ throws IOException
+ {
+ idReferences = page.getIDReferences();
+ this.renderPage(page);
+ }
}