in src/java/org/apache/fop/render/pdf/pdfbox/MergeAnnotations.java [86:114]
private void insert(PDFDictionary parent, PDFDictionary clonedAnnot) throws IOException {
if (parent.containsKey("Kids")) {
PDFArray kids = (PDFArray) parent.get("Kids");
kids.add(clonedAnnot);
} else {
PDFDictionary grandParent = (PDFDictionary) parent.get(COSName.PARENT.getName());
PDFDictionary child = parent;
parent = new PDFDictionary();
if (grandParent != null) {
PDFArray kids = (PDFArray) grandParent.get("Kids");
kids.add(parent);
}
pdfBoxAdapter.pdfDoc.registerTrailerObject(parent);
List<String> excludeCopy = Arrays.asList("Subtype", "Type", "Rect", "MK", "F");
for (String key : child.keySet()) {
if (!excludeCopy.contains(key)) {
parent.put(key, child.get(key));
}
}
child.remove("T");
child.put(COSName.PARENT.getName(), parent);
parent.put("Kids", new PDFArray(clonedAnnot, child));
}
if (getT(clonedAnnot).equals(getT(parent))) {
clonedAnnot.remove("T");
}
clonedAnnot.put(COSName.PARENT.getName(), parent);
}