import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.PageMaster;
+import org.apache.fop.layout.BodyRegionArea;
import org.apache.fop.apps.FOPException;
import java.util.*;
this.pageMaster = new PageMaster(pageWidth, pageHeight);
if (getRegion(RegionBody.REGION_CLASS) != null) {
- this.pageMaster.addBody(getRegion(RegionBody.REGION_CLASS).makeRegionArea(contentRectangleXPosition,contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight));
+ this.pageMaster.addBody((BodyRegionArea)getRegion(RegionBody.REGION_CLASS).makeRegionArea(contentRectangleXPosition,contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight));
}
else {
MessageHandler.errorln("ERROR: simple-page-master must have a region of class "+RegionBody.REGION_CLASS);
import org.apache.fop.layout.*;
// Java
-import java.io.PrintWriter;
+import java.io.OutputStream;
import java.io.IOException;
/**
/** set the producer of the rendering */
public void setProducer(String producer);
- /** render the given area tree to the given writer */
- public void render(AreaTree areaTree, PrintWriter writer) throws IOException, FOPException;
+ /** render the given area tree to the given stream */
+ public void render(AreaTree areaTree, OutputStream stream) throws IOException, FOPException;
/** render the given area container */
public void renderAreaContainer(AreaContainer area);
}
public void render(AreaTree areaTree,
- PrintWriter writer) throws IOException {
+ OutputStream stream) throws IOException {
tree = areaTree;
render(areaTree, 0);
}
// Java
import java.io.IOException;
-import java.io.PrintWriter;
+import java.io.OutputStream;
import java.util.Enumeration;
import java.awt.Rectangle;
import java.util.Vector;
* render the areas into PDF
*
* @param areaTree the laid-out area tree
- * @param writer the PrintWriter to write the PDF with
+ * @param stream the OutputStream to write the PDF to
*/
public void render(AreaTree areaTree,
- PrintWriter writer) throws IOException, FOPException {
+ OutputStream stream) throws IOException, FOPException {
MessageHandler.logln("rendering areas to PDF");
idReferences = areaTree.getIDReferences();
this.pdfResources = this.pdfDoc.getResources();
}
MessageHandler.logln("writing out PDF");
- this.pdfDoc.output(writer);
+ this.pdfDoc.output(stream);
}
/**
// Java
import java.io.IOException;
import java.io.PrintWriter;
+import java.io.OutputStream;
import java.util.Enumeration;
/**
* render the areas into XML
*
* @param areaTree the laid-out area tree
- * @param writer the PrintWriter to give the XML to
+ * @param stream the OutputStream to give the XML to
*/
- public void render(AreaTree areaTree, PrintWriter writer)
+ public void render(AreaTree areaTree, OutputStream stream)
throws IOException {
MessageHandler.logln("rendering areas to XML");
- this.writer = writer;
+ this.writer = new PrintWriter(stream);
this.writer.write("<?xml version=\"1.0\"?>\n<!-- produced by "
+ this.producer + " -->\n");
writeStartTag("<AreaTree>");