File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
pdfbox/src/test/java/org/apache/pdfbox/multipdf Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1330,4 +1330,26 @@ void testSplitWithNamedDestinations() throws IOException
13301330 assertTrue (((PDActionGoTo ) link .getAction ()).getDestination () instanceof PDNamedDestination );
13311331 }
13321332 }
1333+
1334+ /**
1335+ * PDFBOX-5939: merge a file with an outline that has itself as a parent without producing a
1336+ * stack overflow.
1337+ *
1338+ * @throws IOException
1339+ */
1340+ @ Test
1341+ void testOutlinesSelfParent () throws IOException
1342+ {
1343+ PDFMergerUtility pdfMergerUtility = new PDFMergerUtility ();
1344+ pdfMergerUtility .addSource (new File (TARGETPDFDIR , "PDFBOX-5939-google-docs-1.pdf" ));
1345+ pdfMergerUtility .addSource (new File (TARGETPDFDIR , "PDFBOX-5939-google-docs-1.pdf" ));
1346+ pdfMergerUtility .setDestinationFileName (TARGETTESTDIR + "PDFBOX-5939-google-docs-result.pdf" );
1347+ pdfMergerUtility .mergeDocuments (IOUtils .createMemoryOnlyStreamCache ());
1348+
1349+ try (PDDocument mergedDoc = Loader
1350+ .loadPDF (new File (TARGETTESTDIR , "PDFBOX-5939-google-docs-result.pdf" )))
1351+ {
1352+ assertEquals (2 , mergedDoc .getNumberOfPages ());
1353+ }
1354+ }
13331355}
You can’t perform that action at this time.
0 commit comments