in src/java/org/apache/fop/render/pdf/pdfbox/MergeAnnotations.java [56:84]
public void cloneAnnotParent(COSBase annot, PDFDictionary clonedAnnot, Collection<COSName> exclude)
throws IOException {
if (clonedAnnot.containsKey("T")) {
List<String> nameList = new ArrayList<>();
addToTree(clonedAnnot, nameList);
PDFDictionary node = (PDFDictionary) fields.get(nameList.remove(0));
while (!nameList.isEmpty()) {
String name = nameList.remove(0);
PDFDictionary nextNode = findKid(name, node);
if (nextNode == null) {
if (nameList.isEmpty()) {
nextNode = node;
} else {
nextNode = new PDFDictionary();
pdfBoxAdapter.pdfDoc.registerTrailerObject(nextNode);
nextNode.put("Kids", new PDFArray());
nextNode.put("T", name);
nextNode.put("Parent", node);
PDFArray kids = (PDFArray) node.get("Kids");
kids.add(nextNode);
}
}
node = nextNode;
}
if (node != clonedAnnot) {
insert(node, clonedAnnot);
}
}
}