File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
pdfbox/src/test/java/org/apache/pdfbox/multipdf Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -1403,6 +1403,32 @@ void testSplitWithNamedDestinations() throws IOException
14031403 }
14041404 }
14051405
1406+ /**
1407+ * PDFBOX-6009: This test verifies that the destination PDF has a /K tree. Before the change,
1408+ * nodes with the "wrong" /Pg entries were deleted entirely and because this file has a /Pg
1409+ * entry with page 1 at the top, the entire /K tree would be missing.
1410+ *
1411+ * @throws IOException
1412+ */
1413+ @ Test
1414+ void testSplitWithPgEntryAtTheTop () throws IOException
1415+ {
1416+ try (PDDocument doc = Loader .loadPDF (new File (TARGETPDFDIR , "PDFBOX-6009.pdf" )))
1417+ {
1418+ Splitter splitter = new Splitter ();
1419+ splitter .setSplitAtPage (1 );
1420+ List <PDDocument > splitResult = splitter .split (doc );
1421+ assertEquals (3 , splitResult .size ());
1422+ for (PDDocument dstDoc : splitResult )
1423+ {
1424+ assertEquals (1 , dstDoc .getNumberOfPages ());
1425+ checkWithNumberTree (dstDoc );
1426+ checkForPageOrphans (dstDoc );
1427+ }
1428+ splitResult .stream ().forEach (IOUtils ::closeQuietly );
1429+ }
1430+ }
1431+
14061432 /**
14071433 * PDFBOX-5939: merge a file with an outline that has itself as a parent without producing a
14081434 * stack overflow.
You can’t perform that action at this time.
0 commit comments