diff --git a/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java b/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java index cbbb6139fa8..b2ff778cec6 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/multipdf/Splitter.java @@ -57,6 +57,7 @@ import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLink; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationPopup; +import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationWidget; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceStream; import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination; import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDNamedDestination; @@ -820,6 +821,12 @@ private void processAnnotations(PDPage imported) throws IOException } } } + if (annotationClone instanceof PDAnnotationWidget && + annotationClone.getCOSObject().containsKey(COSName.PARENT)) + { + // remove non-terminal field /Parent reference, because this may lead to orphan pages + annotationClone.getCOSObject().removeItem(COSName.PARENT); + } if (annotation.getPage() != null) { annotationClone.setPage(imported);