blob: cac6d1e00a8be18c96b19d22ea4d77798631435b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
package org.apache.xml.fop.pdf;
// Java
import java.io.PrintWriter;
import java.util.Vector;
/**
* class representing a /Pages object.
*
* A /Pages object is an ordered collection of pages (/Page objects)
* (Actually, /Pages can contain further /Pages as well but this
* implementation doesn't allow this)
*/
public class PDFPages extends PDFObject {
/** the /Page objects */
protected Vector kids = new Vector();
/** the number of /Page objects */
protected int count = 0;
// private PDFPages parent;
/**
* create a /Pages object.
*
* @param number the object's number
*/
public PDFPages(int number) {
/* generic creation of object */
super(number);
}
/**
* add a /Page object.
*
* @param page the PDFPage to add.
*/
public void addPage(PDFPage page) {
this.kids.addElement(page);
page.setParent(this);
}
/**
* get the count of /Page objects
*
* @return the number of pages
*/
public int getCount() {
return this.count;
}
/**
* represent the object in PDF
*
* @return the PDF string
*/
public String toPDF() {
StringBuffer p = new StringBuffer(this.number + " "
+ this.generation
+ " obj\n<< /Type /Pages\n/Count "
+ this.getCount() + "\n/Kids [");
for (int i = 0; i < kids.size(); i++) {
p = p.append(((PDFObject)kids.elementAt(i)).referencePDF() + " ");
}
p = p.append("] >>\nendobj\n");
return p.toString();
}
}
|