/ Published in: Java
Opens an existing document and splits it into multiple documents, one for each page.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/** * @param args the command line arguments * @throws java.io.IOException */ PDDocument document = PDDocument.load(file); Splitter splitter = new Splitter(); List<PDDocument> Pages = splitter.split(document); Iterator<PDDocument> iterator = Pages.listIterator(); for(int i = 1;iterator.hasNext();i++) { PDDocument pd = iterator.next(); pd.save("" + i + ".pdf"); } document.close(); }