PdfSplitter { public List<PdfDocument> splitByOutlines(List<String> outlineTitles) { if (outlineTitles == null || outlineTitles.size() == 0) { return Collections.<PdfDocument>emptyList(); } List<PdfDocument> documentList = new ArrayList<>(outlineTitles.size()); for (String title : outlineTitles) { PdfDocument document = splitByOutline(title); if (document != null) { documentList.add(document); } } return documentList; } PdfSplitter(PdfDocument pdfDocument); void setEventCountingMetaInfo(IMetaInfo metaInfo); void setPreserveTagged(boolean preserveTagged); void setPreserveOutlines(boolean preserveOutlines); List<PdfDocument> splitBySize(long size); void splitByPageNumbers(List<Integer> pageNumbers, IDocumentReadyListener documentReady); List<PdfDocument> splitByPageNumbers(List<Integer> pageNumbers); void splitByPageCount(int pageCount, IDocumentReadyListener documentReady); List<PdfDocument> splitByPageCount(int pageCount); List<PdfDocument> extractPageRanges(List<PageRange> pageRanges); PdfDocument extractPageRange(PageRange pageRange); PdfDocument getPdfDocument(); List<PdfDocument> splitByOutlines(List<String> outlineTitles);  }
@Test @LogMessages(messages = { @LogMessage(messageTemplate = LogMessageConstant.SOURCE_DOCUMENT_HAS_ACROFORM_DICTIONARY ,count = 2) }) public void splitDocumentByOutlineTest() throws IOException { String inputFileName = sourceFolder + "iphone_user_guide.pdf"; PdfDocument inputPdfDoc = new PdfDocument(new PdfReader(inputFileName)); PdfSplitter splitter = new PdfSplitter(inputPdfDoc); List<String> listTitles = new ArrayList<>(); listTitles.add("Syncing iPod Content from Your iTunes Library"); listTitles.add("Restoring or Transferring Your iPhone Settings"); List<PdfDocument> list = splitter.splitByOutlines(listTitles); Assert.assertEquals(1,list.get(0).getNumberOfPages()); Assert.assertEquals(2,list.get(1).getNumberOfPages()); list.get(0).close(); list.get(1).close(); }