import java.io.FileOutputStream;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
public class MainClass {
public static void main(String[] args) throws Exception {
PdfReader reader = new PdfReader("HelloWorldMultiplePages.pdf");
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream("HelloSelectedOdd.pdf"));
reader.selectPages("o");
stamper.close();
reader = new PdfReader("HelloWorldMultiplePages.pdf");
stamper = new PdfStamper(reader, new FileOutputStream("HelloSelectedEven.pdf"));
reader.selectPages("e");
stamper.close();
reader = new PdfReader("HelloWorldMultiplePages.pdf");
stamper = new PdfStamper(reader, new FileOutputStream("HelloSelected12379.pdf"));
reader.selectPages("1-3, 7-9, !8");
stamper.close();
}
}
|