aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/pdf/PDFPages.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-03-27 11:05:18 +0000
committerJeremias Maerki <jeremias@apache.org>2003-03-27 11:05:18 +0000
commit7ebb86cda2d0f1418d9dab338cc369c168fdf9b4 (patch)
treeec43bb388c50627f8152bc01b3b7e28a2bb9564b /src/java/org/apache/fop/pdf/PDFPages.java
parent19967251e2e5ed4a760b3e56eae6a2b475acb54e (diff)
downloadxmlgraphics-fop-7ebb86cda2d0f1418d9dab338cc369c168fdf9b4.tar.gz
xmlgraphics-fop-7ebb86cda2d0f1418d9dab338cc369c168fdf9b4.zip
No object number in the constructor.
Add a separate method for registering kids. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196168 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf/PDFPages.java')
-rw-r--r--src/java/org/apache/fop/pdf/PDFPages.java38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFPages.java b/src/java/org/apache/fop/pdf/PDFPages.java
index d5cf9f56c..a7f8b260f 100644
--- a/src/java/org/apache/fop/pdf/PDFPages.java
+++ b/src/java/org/apache/fop/pdf/PDFPages.java
@@ -79,14 +79,15 @@ public class PDFPages extends PDFObject {
* create a /Pages object. NOTE: The PDFPages
* object must be created before the PDF document is
* generated, but it is not written to the stream immediately.
- * It must aslo be allocated an object ID (so that the kids
+ * It must also be allocated an object ID (so that the kids
* can refer to the parent) so that the XRef table needs to
* be updated before this object is written.
*
- * @param number the object's number
+ * @param objnum the object's number
*/
- public PDFPages(int number) {
- super(number);
+ public PDFPages(int objnum) {
+ super();
+ setObjectNumber(objnum);
}
/**
@@ -95,10 +96,17 @@ public class PDFPages extends PDFObject {
* @param page the PDFPage to add.
*/
public void addPage(PDFPage page) {
- this.kids.add(page.referencePDF());
page.setParent(this);
this.incrementCount();
}
+
+ /**
+ * Use this method to notify the PDFPages object that a child page
+ * @param page the child page
+ */
+ public void notifyKidRegistered(PDFPage page) {
+ this.kids.add(page.referencePDF());
+ }
/**
* get the count of /Page objects
@@ -118,19 +126,19 @@ public class PDFPages extends PDFObject {
}
/**
- * represent the object in PDF
- *
- * @return the PDF string
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
*/
- public byte[] toPDF() {
- StringBuffer p = new StringBuffer(this.number + " " + this.generation
- + " obj\n<< /Type /Pages\n/Count "
- + this.getCount() + "\n/Kids [");
+ public String toPDFString() {
+ StringBuffer sb = new StringBuffer(64);
+ sb.append(getObjectID()).
+ append("<< /Type /Pages\n/Count ").
+ append(this.getCount()).
+ append("\n/Kids [");
for (int i = 0; i < kids.size(); i++) {
- p = p.append(kids.get(i) + " ");
+ sb.append(kids.get(i)).append(" ");
}
- p = p.append("] >>\nendobj\n");
- return p.toString().getBytes();
+ sb.append("] >>\nendobj\n");
+ return sb.toString();
}
}