aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/tools/anttasks
diff options
context:
space:
mode:
authorKelly Campbell <kellyc@apache.org>2001-03-03 07:06:04 +0000
committerKelly Campbell <kellyc@apache.org>2001-03-03 07:06:04 +0000
commit506dc799d08fece47bd72f1d0ede606a80013c52 (patch)
tree381a245304b2a10722f585f51c072ed24d7d0a3f /src/org/apache/fop/tools/anttasks
parent9902c22a0e180d5a3cc8f683be8ebcbcd8a23c23 (diff)
downloadxmlgraphics-fop-506dc799d08fece47bd72f1d0ede606a80013c52.tar.gz
xmlgraphics-fop-506dc799d08fece47bd72f1d0ede606a80013c52.zip
Refactored Driver to simplify usage required for other apps
to integrate Fop. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194114 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/tools/anttasks')
-rw-r--r--src/org/apache/fop/tools/anttasks/Fop.java48
1 files changed, 19 insertions, 29 deletions
diff --git a/src/org/apache/fop/tools/anttasks/Fop.java b/src/org/apache/fop/tools/anttasks/Fop.java
index ccdbfa8db..cf72a2400 100644
--- a/src/org/apache/fop/tools/anttasks/Fop.java
+++ b/src/org/apache/fop/tools/anttasks/Fop.java
@@ -99,42 +99,32 @@ public class Fop extends Starter {
}
- public void run () {
- Driver driver = new Driver();
- Options options = new Options();
- boolean errors = false;
+ public void run () {
+ Options options = new Options();
+ boolean errors = false;
String version = Version.getVersion();
-
- File fofileF = new File (fofile);
- Configuration.put("baseDir",new File(fofileF.getAbsolutePath()).getParent());
- if (!fofileF.exists()) {
+
+ File fofileF = new File (fofile);
+ Configuration.put("baseDir",new File(fofileF.getAbsolutePath()).getParent());
+ if (!fofileF.exists()) {
errors = true;
- MessageHandler.errorln(
- "Task Fop - ERROR: Formatting objects file " +
- fofile + " missing.");
+ MessageHandler.errorln("Task Fop - ERROR: Formatting objects file " +
+ fofile + " missing.");
}
-
- InputHandler inputHandler = new FOInputHandler(fofileF);
+
+ InputHandler inputHandler = new FOInputHandler(fofileF);
XMLReader parser = inputHandler.getParser();
- super.setParserFeatures(parser);
-
+ super.setParserFeatures(parser);
+
MessageHandler.logln("=======================\nTask " +
version + "\nconverting file " + fofile + " to " + pdffile);
-
+
if (!errors) {
try {
- driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
- version);
- driver.addElementMapping("org.apache.fop.fo.StandardElementMapping");
- driver.addElementMapping("org.apache.fop.svg.SVGElementMapping");
- driver.addElementMapping("org.apache.fop.extensions.ExtensionElementMapping");
- driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping");
- driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping");
- driver.addPropertyList("org.apache.fop.extensions.ExtensionPropertyListMapping");
- driver.setOutputStream(new FileOutputStream(pdffile));
- driver.buildFOTree(parser, inputHandler.fileInputSource(fofileF));
- driver.format();
- driver.render();
+ Driver driver = new Driver(inputHandler.fileInputSource(fofileF), new FileOutputStream(pdffile));
+ driver.setRenderer(Driver.RENDER_PDF);
+ driver.setXMLReader(parser);
+ driver.run();
} catch (Exception e) {
MessageHandler.errorln("Task Fop - FATAL ERROR: " +
e.getMessage());
@@ -142,7 +132,7 @@ public class Fop extends Starter {
}
}
MessageHandler.logln("=======================\n");
- }
+ }
/**
* main method, starts execution of this task