/** the PrintWriter to use to output the results of the renderer */
protected PrintWriter writer;
+ /** the stream to use to output the results of the renderer */
+ protected OutputStream stream;
+
private boolean keepOpen;
//////////////////////////////////////////////////////////////////////////////////////
*/
public PDFOutputHandler(OutputStream out) {
this();
- this.writer = new PrintWriter(out);
+ this.stream = out;
}
//////////////////////////////////////////////////////////////////////////////////////
/**
*/
public DocumentHandler init(Destination dest, AttributeList atts) throws IOException {
- this.writer = new PrintWriter(dest.getOutputStream("application/pdf", null));
+ this.stream = dest.getOutputStream("application/pdf", null);
this.keepOpen = dest.keepOpen();
String version = org.apache.fop.apps.Version.getVersion();
*/
public void doRender()
throws IOException,FOPException {
- this.renderer.render(areaTree, this.writer);
+ this.renderer.render(areaTree, this.stream);
}
//////////////////////////////////////////////////////////////////////////////////////
driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
- driver.setOutputStream(new FileOutputStream(args[2]));
+ OutputStream stream = new BufferedOutputStream(new FileOutputStream(args[2]));
+ driver.setOutputStream(stream);
driver.buildFOTree(xslProcessor, fileInputSource(args[0]));
driver.format();
driver.render();
import org.xml.sax.helpers.AttributesImpl;
// Java
-import java.io.PrintWriter;
-import java.io.IOException;
+import java.io.*;
/**
* <P>Primary class that drives overall FOP process.
/** the PrintWriter to use to output the results of the renderer */
protected PrintWriter writer;
+ /** the stream to use to output the results of the renderer */
+ protected OutputStream stream;
+
/** create a new Driver */
public XTDriver() {
this.treeBuilder = new XTFOTreeBuilder();
this.writer = writer;
}
+ /**
+ * set the OutputStream to use to output the result of the Renderer
+ * (if applicable)
+ */
+ public void setOutputStream(OutputStream stream) {
+ this.stream = stream;
+ }
+
/**
* format the formatting object tree into an area tree
*/
*/
public void render()
throws IOException, FOPException {
- this.renderer.render(areaTree, this.writer);
+ this.renderer.render(areaTree, this.stream);
}
}