pom文件
<dependency><groupId>com.lowagie</groupId><artifactId>itext</artifactId><version>2.1.7</version></dependency>
主文件
import java.io.FileOutputStream;import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfCopy;
import com.lowagie.text.pdf.PdfImportedPage;
import com.lowagie.text.pdf.PdfReader;public class SplitPDFFile {/*** @param args*/public static void main(String[] args) {try {String outFileStr="C:\\Users\\new2\\";String inFile = "C:\\Users\\sb.pdf";System.out.println ("Reading" + inFile);PdfReader reader = new PdfReader(inFile);int n = reader.getNumberOfPages();int i = 0; while ( i < n ) {String outFile = outFileStr+i +"pp.pdf";System.out.println ("Writing" + outFile);Document document = new Document(reader.getPageSizeWithRotation(1));PdfCopy writer = new PdfCopy(document, new FileOutputStream(outFile));document.open();PdfImportedPage page = writer.getImportedPage(reader, ++i);writer.addPage(page);document.close();writer.close();}}catch (Exception e) {e.printStackTrace();}}
}