Hello all,
has anybody a working solution or a guide for me how to achieve this:
Given a COSDictionary object how would I get a recursive text dump of
all its subobject?
I tried something like:
PDDocument doc = PDDocument.load(file);
PDDocumentCatalog catalog = doc.getDocumentCatalog();
List<PDPage> allPages = catalog.getAllPages();
for (PDPage page : allPages) {
COSDictionary pageDict = page.getCOSDictionary();
for (Entry<COSName, COSBase> entry : pageDict.entrySet()) {
if (value instanceof COSArray)
// process array
else if (value instanceof COSString)
// process String
else if (value instanceof COSObject)
// stuck
}
}
I'm stuck how to recurse into the COSObject.
pageDict.toString() gives me some overview:
COSDictionary{
(COSName{Annots}:COSArray{[COSObject{19, 0}, COSObject{20, 0}]})
but also doesn't go deeper into the "Annots" object.
Thanks for your help
Axel