aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/pdf/PDFRoot.java
diff options
context:
space:
mode:
authorSteve Coffman <gears@apache.org>2001-08-01 22:12:54 +0000
committerSteve Coffman <gears@apache.org>2001-08-01 22:12:54 +0000
commiteeb2adff569057e2b6deb089ba9dffb21fb3a00b (patch)
treec8968573d60b496aa17befb1afbec840ddc1b355 /src/org/apache/fop/pdf/PDFRoot.java
parenta5bc30d4a3977d60f0e70c2792bc4e3a37913a3d (diff)
downloadxmlgraphics-fop-eeb2adff569057e2b6deb089ba9dffb21fb3a00b.tar.gz
xmlgraphics-fop-eeb2adff569057e2b6deb089ba9dffb21fb3a00b.zip
Adds Mark Lillywhite's performance and memory patch in all it's glory.
Unfortunately breaks marker support. (AreaTree getNextPage and getPreviousPage return the current page) XSL-FO with markers is not a good idea until it is fixed. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194385 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/pdf/PDFRoot.java')
-rw-r--r--src/org/apache/fop/pdf/PDFRoot.java32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/org/apache/fop/pdf/PDFRoot.java b/src/org/apache/fop/pdf/PDFRoot.java
index 1850fbf94..2bae2b91b 100644
--- a/src/org/apache/fop/pdf/PDFRoot.java
+++ b/src/org/apache/fop/pdf/PDFRoot.java
@@ -27,12 +27,26 @@ public class PDFRoot extends PDFObject {
private PDFOutline _outline;
/**
- * create a Root (/Catalog) object
+ * create a Root (/Catalog) object. NOTE: The PDFRoot
+ * object must be created before the PDF document is
+ * generated, but it is not assigned an object ID until
+ * it is about to be written (immediately before the xref
+ * table as part of the trsailer). (mark-fop@inomial.com)
*
* @param number the object's number
*/
- public PDFRoot(int number) {
+ public PDFRoot(int number, PDFPages pages) {
super(number);
+ setRootPages(pages);
+ }
+
+ /**
+ * Before the root is written to the document stream,
+ * make sure it's object number is set. Package-private access
+ * only; outsiders should not be fiddling with this stuff.
+ */
+ void setNumber(int number) {
+ this.number = number;
}
/**
@@ -57,13 +71,23 @@ public class PDFRoot extends PDFObject {
_outline = outline;
}
+ public PDFOutline getRootOutline()
+ {
+ return _outline;
+ }
+
/**
- * represent the object as PDF
+ * represent the object as PDF.
+ *
+ * @throws IllegalStateException if the setNumber() method has
+ * not been called.
*
* @return the PDF string
*/
- public byte[] toPDF() {
+ public byte[] toPDF()
+ throws IllegalStateException
+ {
StringBuffer p = new StringBuffer(this.number + " " + this.generation
+ " obj\n<< /Type /Catalog\n/Pages "
+ this.rootPages.referencePDF()