int i = 0;
while (it.hasNext()) {
i++;
Object obj = it.next();
PdfObject value = PdfReader
.getPdfObject(((PdfDictionary) pdfobj)
.get((PdfName) obj));
// System.out.println("Value:" + value);
ObjectTreeNode sttn = new ObjectTreeNode(obj + " " + value);
leaf.add(sttn);
if (obj.equals(PdfName.PARENT)) {
continue;
}
if (value != null) {
iterateObjects(value, pdfreader, sttn);
}
}
} else if (pdfobj.isArray()) {
leaf = new ArrayTreeNode("PdfArray " + pdfobj, (PdfArray) pdfobj);
node.add(leaf);
ArrayList kids = ((PdfArray) pdfobj).getArrayList();
for (int k = 0; k < kids.size(); ++k) {
PdfObject curkid = (PdfObject) kids.get(k);
if (curkid.isIndirect()) {
PdfObject kid = PdfReader
.getPdfObject((PRIndirectReference) kids.get(k));
if (kid != null) {
iterateObjects(kid, pdfreader, leaf);
}
} else if (curkid.isNumber()) {
} else {
PdfObject kid = (PdfObject) kids.get(k);
iterateObjects(kid, pdfreader, leaf);
}
}
} else if (pdfobj.isIndirect()) {
leaf = new ObjectTreeNode("PRIndirectReference " + pdfobj);
node.add(leaf);
PdfObject target = PdfReader
.getPdfObject(pdfobj);
if (target != null) {
iterateObjects(target, pdfreader, leaf);
}
} else if (pdfobj.isBoolean()) {
// not shown
} else if (pdfobj.isName()) {
// not shown
} else if (pdfobj.isNull()) {
// not shown
} else if (pdfobj.isNumber()) {
// not shown
} else if (pdfobj.isString()) {
// not shown
} else if (pdfobj.isStream()) {
leaf = new StreamTreeNode(pdfobj, "Stream");
node.add(leaf);
leaf = new DictionaryTreeNode("PdfDictionary " + pdfobj,
(PdfDictionary) pdfobj);
node.add(leaf);
Set s = ((PdfDictionary) pdfobj).getKeys();
Iterator it = s.iterator();
int i = 0;
while (it.hasNext()) {
i++;
Object obj = it.next();
PdfObject value = PdfReader
.getPdfObject(((PdfDictionary) pdfobj)
.get((PdfName) obj));
// System.out.println("Value:" + value);
ObjectTreeNode sttn = new ObjectTreeNode(obj + " "
+ value);