Code with Finding: |
class PdfNameTree {
private static void iterateItems(PdfDictionary dic, HashMap<String, PdfObject> items) {
PdfArray nn = (PdfArray)PdfReader.getPdfObjectRelease(dic.get(PdfName.NAMES));
if (nn != null) {
for (int k = 0; k < nn.size(); ++k) {
PdfString s = (PdfString)PdfReader.getPdfObjectRelease(nn.getPdfObject(k++));
items.put(PdfEncodings.convertToString(s.getBytes(), null), nn.getPdfObject(k));
}
}
else if ((nn = (PdfArray)PdfReader.getPdfObjectRelease(dic.get(PdfName.KIDS))) != null) {
for (int k = 0; k < nn.size(); ++k) {
PdfDictionary kid = (PdfDictionary)PdfReader.getPdfObjectRelease(nn.getPdfObject(k));
iterateItems(kid, items);
}
}
}
}
|