jeremias 2003/03/27 03:05:19
Modified: src/java/org/apache/fop/pdf PDFPages.java
Log:
No object number in the constructor.
Add a separate method for registering kids.
Revision Changes Path
1.2 +23 -15 xml-fop/src/java/org/apache/fop/pdf/PDFPages.java
Index: PDFPages.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFPages.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PDFPages.java 11 Mar 2003 13:05:09 -0000 1.1
+++ PDFPages.java 27 Mar 2003 11:05:18 -0000 1.2
@@ -79,14 +79,15 @@
* 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 @@
* @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 @@
}
/**
- * 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();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]