* 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);
}
/**
* @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
}
/**
- * 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();
}
}