summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-07-30 13:32:02 +0000
committerJeremias Maerki <jeremias@apache.org>2005-07-30 13:32:02 +0000
commitdb1b760fee89862bde170ff1f40bd69e5437fb4d (patch)
tree192a5a686475d32e84d2869f1bfd92e9b6d7707e /examples
parent21e083ea6532254e3af7d85ab047af3511460559 (diff)
downloadxmlgraphics-fop-db1b760fee89862bde170ff1f40bd69e5437fb4d.tar.gz
xmlgraphics-fop-db1b760fee89862bde170ff1f40bd69e5437fb4d.zip
Bugzilla #35937:
FormattingResults mechanism ported from maintenance branch to trunk. Submitted by: Manuel Mall <mm.at.arcus.com.au> Patch tweaked slightly to avoid the reference of Fop.java into the area package. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@226511 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'examples')
-rw-r--r--examples/embedding/java/embedding/ExampleFO2PDF.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/examples/embedding/java/embedding/ExampleFO2PDF.java b/examples/embedding/java/embedding/ExampleFO2PDF.java
index 388cdcaf4..f67652fce 100644
--- a/examples/embedding/java/embedding/ExampleFO2PDF.java
+++ b/examples/embedding/java/embedding/ExampleFO2PDF.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,6 +37,8 @@ import javax.xml.transform.sax.SAXResult;
// FOP
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.apps.FormattingResults;
+import org.apache.fop.apps.PageSequenceResults;
/**
* This class demonstrates the conversion of an FO file to PDF using FOP.
@@ -76,6 +78,18 @@ public class ExampleFO2PDF {
// Start XSLT transformation and FOP processing
transformer.transform(src, res);
+
+ // Result processing
+ FormattingResults foResults = fop.getResults();
+ java.util.List pageSequences = foResults.getPageSequences();
+ for (java.util.Iterator it = pageSequences.iterator(); it.hasNext();) {
+ PageSequenceResults pageSequenceResults = (PageSequenceResults)it.next();
+ System.out.println("PageSequence "
+ + (String.valueOf(pageSequenceResults.getID()).length() > 0
+ ? pageSequenceResults.getID() : "<no id>")
+ + " generated " + pageSequenceResults.getPageCount() + " pages.");
+ }
+ System.out.println("Generated " + foResults.getPageCount() + " pages in total.");
} catch (Exception e) {
e.printStackTrace(System.err);
@@ -102,6 +116,7 @@ public class ExampleFO2PDF {
//Setup input and output files
File fofile = new File(baseDir, "xml/fo/helloworld.fo");
+ //File fofile = new File(baseDir, "../fo/pagination/franklin_2pageseqs.fo");
File pdffile = new File(outDir, "ResultFO2PDF.pdf");
System.out.println("Input: XSL-FO (" + fofile + ")");