Author: tilman
Date: Tue Jun 10 12:28:20 2025
New Revision: 1926331
URL: http://svn.apache.org/viewvc?rev=1926331&view=rev
Log:
PDFBOX-6018: add test for orphan popup annotations
Added:
pdfbox/branches/3.0/pdfbox/src/test/resources/input/merge/PDFBOX-6018-099267-p9-OrphanPopups.pdf
(with props)
Modified:
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
Modified:
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
URL:
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java?rev=1926331&r1=1926330&r2=1926331&view=diff
==============================================================================
---
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
(original)
+++
pdfbox/branches/3.0/pdfbox/src/test/java/org/apache/pdfbox/multipdf/PDFMergerUtilityTest.java
Tue Jun 10 12:28:20 2025
@@ -1439,6 +1439,37 @@ class PDFMergerUtilityTest
}
/**
+ * 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
+ */
+ @Test
+ void testSplitWithOrphanPopupAnnotation() throws IOException
+ {
+ try (PDDocument doc = Loader.loadPDF(new File(SRCDIR,
"PDFBOX-6018-099267-p9-OrphanPopups.pdf")))
+ {
+ Splitter splitter = new Splitter();
+ List<PDDocument> splitResult = splitter.split(doc);
+ assertEquals(1, splitResult.size());
+ try (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());
+ }
+ }
+ }
+
+ /**
* PDFBOX-5939: merge a file with an outline that has itself as a parent
without producing a
* stack overflow.
*
Added:
pdfbox/branches/3.0/pdfbox/src/test/resources/input/merge/PDFBOX-6018-099267-p9-OrphanPopups.pdf
URL:
http://svn.apache.org/viewvc/pdfbox/branches/3.0/pdfbox/src/test/resources/input/merge/PDFBOX-6018-099267-p9-OrphanPopups.pdf?rev=1926331&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
pdfbox/branches/3.0/pdfbox/src/test/resources/input/merge/PDFBOX-6018-099267-p9-OrphanPopups.pdf
------------------------------------------------------------------------------
svn:mime-type = application/pdf