Author: tilman
Date: Tue Jun 10 12:28:26 2025
New Revision: 1926332
URL: http://svn.apache.org/viewvc?rev=1926332&view=rev
Log:
PDFBOX-6018: add test for orphan popup annotations
Added:
pdfbox/branches/2.0/pdfbox/src/test/resources/input/merge/PDFBOX-6018-099267-p9-OrphanPopups.pdf
(with props)
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
Modified:
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java?rev=1926332&r1=1926331&r2=1926332&view=diff
==============================================================================
---
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
(original)
+++
pdfbox/branches/2.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
Tue Jun 10 12:28:26 2025
@@ -1381,6 +1381,34 @@ public class PDFMergerUtilityTest extend
}
/**
+ * PDFBOX-6018: Test split a PDF with popup annotations that are not in
the annotations list.
+ * Verify that after splitting, they still link back to their markup
annotation and these to the
+ * page.
+ *
+ * @throws IOException
+ */
+ public void testSplitWithOrphanPopupAnnotation() throws IOException
+ {
+ PDDocument doc = PDDocument.load(new File(SRCDIR,
"PDFBOX-6018-099267-p9-OrphanPopups.pdf"));
+ Splitter splitter = new Splitter();
+ List<PDDocument> splitResult = splitter.split(doc);
+ assertEquals(1, splitResult.size());
+ PDDocument dstDoc = splitResult.get(0);
+ assertEquals(1, dstDoc.getNumberOfPages());
+ PDPage page = dstDoc.getPage(0);
+ List<PDAnnotation> annotations = page.getAnnotations();
+ assertEquals(2, annotations.size());
+ PDAnnotationText ann0 = (PDAnnotationText) annotations.get(0);
+ PDAnnotationText ann1 = (PDAnnotationText) annotations.get(1);
+ assertEquals(page, ann0.getPage());
+ assertEquals(page, ann1.getPage());
+ assertEquals(ann0, ann0.getPopup().getParent());
+ assertEquals(ann1, ann1.getPopup().getParent());
+ dstDoc.close();
+ doc.close();
+ }
+
+ /**
* PDFBOX-5939: merge a file with an outline that has itself as a parent
without producing a
* stack overflow.
*
Added:
pdfbox/branches/2.0/pdfbox/src/test/resources/input/merge/PDFBOX-6018-099267-p9-OrphanPopups.pdf
URL:
http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/test/resources/input/merge/PDFBOX-6018-099267-p9-OrphanPopups.pdf?rev=1926332&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
pdfbox/branches/2.0/pdfbox/src/test/resources/input/merge/PDFBOX-6018-099267-p9-OrphanPopups.pdf
------------------------------------------------------------------------------
svn:mime-type = application/pdf