summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorGlen Mazza <gmazza@apache.org>2004-07-19 05:33:35 +0000
committerGlen Mazza <gmazza@apache.org>2004-07-19 05:33:35 +0000
commitaf81f828c5b7a480bf9d0674bbfefb9a60524ac5 (patch)
treefe5043083a7ab19c6c5285c351ebd49b23d9a045 /examples
parent74955dc126dccccf831748573270d111e5ca5923 (diff)
downloadxmlgraphics-fop-af81f828c5b7a480bf9d0674bbfefb9a60524ac5.tar.gz
xmlgraphics-fop-af81f828c5b7a480bf9d0674bbfefb9a60524ac5.zip
1.) Driver constructor modified to require RenderType, and setter functions
for RenderType and FOUserAgent removed, to allow for better checking of a valid Driver object at time of construction. (Also, will reduce need to validate Driver object should it be a parameter to a method.) 2.) Added validity checking of renderType to FOTreeBuilder as well, in effect decoupling Driver from FOTreeBuilder (the latter can work on its own now.) 3.) Updated the various examples and the documentation to indicate the new API. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197801 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'examples')
-rw-r--r--examples/embedding/build.xml30
-rw-r--r--examples/embedding/java/embedding/ExampleDOM2PDF.java8
-rw-r--r--examples/embedding/java/embedding/ExampleFO2PDF.java5
-rw-r--r--examples/embedding/java/embedding/ExampleFO2PDFUsingSAX.java5
-rw-r--r--examples/embedding/java/embedding/ExampleObj2PDF.java7
-rw-r--r--examples/embedding/java/embedding/ExampleXML2PDF.java7
6 files changed, 25 insertions, 37 deletions
diff --git a/examples/embedding/build.xml b/examples/embedding/build.xml
index b5c90ae1f..ec382aceb 100644
--- a/examples/embedding/build.xml
+++ b/examples/embedding/build.xml
@@ -84,7 +84,16 @@
</classpath>
</java>
</target>
- <target name="example2" depends="compile" description="Runs the XML to FO example">
+ <target name="example2" depends="compile" description="Runs the FO to PDF example using a SAXParser">
+ <echo message="Running the FO to PDF example using a SAXParser"/>
+ <java classname="${name}.ExampleFO2PDFUsingSAX" fork="yes">
+ <classpath>
+ <path refid="project.class.path"/>
+ <pathelement location="${build.dest}"/>
+ </classpath>
+ </java>
+ </target>
+ <target name="example3" depends="compile" description="Runs the XML to FO example">
<echo message="Running the XML to FO example"/>
<java classname="${name}.ExampleXML2FO" fork="yes">
<classpath>
@@ -93,7 +102,7 @@
</classpath>
</java>
</target>
- <target name="example3" depends="compile" description="Runs the XML to PDF example">
+ <target name="example4" depends="compile" description="Runs the XML to PDF example">
<echo message="Running the XML to PDF example"/>
<java classname="${name}.ExampleXML2PDF" fork="yes">
<classpath>
@@ -102,7 +111,7 @@
</classpath>
</java>
</target>
- <target name="example4" depends="compile" description="Runs the Object to XML example">
+ <target name="example5" depends="compile" description="Runs the Object to XML example">
<echo message="Running the Object to XML example"/>
<java classname="${name}.ExampleObj2XML" fork="yes">
<classpath>
@@ -111,7 +120,7 @@
</classpath>
</java>
</target>
- <target name="example5" depends="compile" description="Runs the Object to PDF example">
+ <target name="example6" depends="compile" description="Runs the Object to PDF example">
<echo message="Running the Object to PDF example"/>
<java classname="${name}.ExampleObj2PDF" fork="yes">
<classpath>
@@ -120,7 +129,7 @@
</classpath>
</java>
</target>
- <target name="example6" depends="compile" description="Runs the DOM to PDF example">
+ <target name="example7" depends="compile" description="Runs the DOM to PDF example">
<echo message="Running the DOM to PDF example"/>
<java classname="${name}.ExampleDOM2PDF" fork="yes">
<classpath>
@@ -129,7 +138,7 @@
</classpath>
</java>
</target>
- <target name="example7" depends="compile" description="Runs the SVG to PDF example">
+ <target name="example8" depends="compile" description="Runs the SVG to PDF example">
<echo message="Running the SVG to PDF example"/>
<java classname="${name}.ExampleSVG2PDF" fork="yes">
<classpath>
@@ -138,15 +147,6 @@
</classpath>
</java>
</target>
- <target name="example8" depends="compile" description="Runs the FO to PDF example using a SAXParser">
- <echo message="Running the FO to PDF example using a SAXParser"/>
- <java classname="${name}.ExampleFO2PDFUsingSAX" fork="yes">
- <classpath>
- <path refid="project.class.path"/>
- <pathelement location="${build.dest}"/>
- </classpath>
- </java>
- </target>
<!-- =================================================================== -->
<!-- Clean targets -->
<!-- =================================================================== -->
diff --git a/examples/embedding/java/embedding/ExampleDOM2PDF.java b/examples/embedding/java/embedding/ExampleDOM2PDF.java
index 17f2dfa37..0612178e9 100644
--- a/examples/embedding/java/embedding/ExampleDOM2PDF.java
+++ b/examples/embedding/java/embedding/ExampleDOM2PDF.java
@@ -61,11 +61,8 @@ public class ExampleDOM2PDF {
*/
public void convertDOM2PDF(Document xslfoDoc, File pdf) {
try {
- // Construct driver
- Driver driver = new Driver();
-
- // Setup Renderer (output format)
- driver.setRenderer(Driver.RENDER_PDF);
+ // Construct driver with desired output format
+ Driver driver = new Driver(Driver.RENDER_PDF);
// Setup output
OutputStream out = new java.io.FileOutputStream(pdf);
@@ -90,7 +87,6 @@ public class ExampleDOM2PDF {
out.close();
}
- System.out.println("Success!");
} catch (Exception e) {
e.printStackTrace(System.err);
System.exit(-1);
diff --git a/examples/embedding/java/embedding/ExampleFO2PDF.java b/examples/embedding/java/embedding/ExampleFO2PDF.java
index bf44f07e1..281bbf02d 100644
--- a/examples/embedding/java/embedding/ExampleFO2PDF.java
+++ b/examples/embedding/java/embedding/ExampleFO2PDF.java
@@ -55,9 +55,8 @@ public class ExampleFO2PDF {
OutputStream out = null;
try {
- // Construct driver and setup output format
- Driver driver = new Driver();
- driver.setRenderer(Driver.RENDER_PDF);
+ // Construct driver with desired output format
+ Driver driver = new Driver(Driver.RENDER_PDF);
// Setup output stream. Note: Using BufferedOutputStream
// for performance reasons (helpful with FileOutputStreams).
diff --git a/examples/embedding/java/embedding/ExampleFO2PDFUsingSAX.java b/examples/embedding/java/embedding/ExampleFO2PDFUsingSAX.java
index ca949f365..74645c3a4 100644
--- a/examples/embedding/java/embedding/ExampleFO2PDFUsingSAX.java
+++ b/examples/embedding/java/embedding/ExampleFO2PDFUsingSAX.java
@@ -64,8 +64,7 @@ public class ExampleFO2PDFUsingSAX {
try {
// Construct driver and setup output format
- Driver driver = new Driver();
- driver.setRenderer(Driver.RENDER_PDF);
+ Driver driver = new Driver(Driver.RENDER_PDF);
// Setup output stream. Note: Using BufferedOutputStream
// for performance reasons (helpful with FileOutputStreams).
@@ -110,7 +109,7 @@ public class ExampleFO2PDFUsingSAX {
//Setup input and output files
File fofile = new File(baseDir, "xml/fo/helloworld.fo");
- File pdffile = new File(outDir, "ResultFO2PDF.pdf");
+ File pdffile = new File(outDir, "ResultFO2PDFUsingSAX.pdf");
System.out.println("Input: XSL-FO (" + fofile + ")");
System.out.println("Output: PDF (" + pdffile + ")");
diff --git a/examples/embedding/java/embedding/ExampleObj2PDF.java b/examples/embedding/java/embedding/ExampleObj2PDF.java
index b59a1a9f5..d41c51d9e 100644
--- a/examples/embedding/java/embedding/ExampleObj2PDF.java
+++ b/examples/embedding/java/embedding/ExampleObj2PDF.java
@@ -55,11 +55,8 @@ public class ExampleObj2PDF {
public void convertProjectTeam2PDF(ProjectTeam team, File xslt, File pdf)
throws IOException, FOPException, TransformerException {
- // Construct driver
- Driver driver = new Driver();
-
- // Setup Renderer (output format)
- driver.setRenderer(Driver.RENDER_PDF);
+ // Construct driver with desired output format
+ Driver driver = new Driver(Driver.RENDER_PDF);
// Setup output
OutputStream out = new java.io.FileOutputStream(pdf);
diff --git a/examples/embedding/java/embedding/ExampleXML2PDF.java b/examples/embedding/java/embedding/ExampleXML2PDF.java
index 18747e3e4..a1dea46fe 100644
--- a/examples/embedding/java/embedding/ExampleXML2PDF.java
+++ b/examples/embedding/java/embedding/ExampleXML2PDF.java
@@ -66,11 +66,8 @@ public class ExampleXML2PDF {
System.out.println();
System.out.println("Transforming...");
- // Construct driver
- Driver driver = new Driver();
-
- // Setup Renderer (output format)
- driver.setRenderer(Driver.RENDER_PDF);
+ // Construct driver with desired output format
+ Driver driver = new Driver(Driver.RENDER_PDF);
// Setup output
OutputStream out = new java.io.FileOutputStream(pdffile);