Import page-Java
by Mohan[ Edit ] 2012-09-21 13:45:51
Import page-Java
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfCopy;
import com.lowagie.text.pdf.PdfReader;
public class MainClass {
public static void main(String[] args) throws Exception {
PdfReader reader = new PdfReader("HelloWorldMultiplePages.pdf");
reader.selectPages("o");
int pages = reader.getNumberOfPages();
Document document = new Document();
PdfCopy copy = new PdfCopy(document, new FileOutputStream("HelloWorldSelectPagesOdd.pdf"));
document.open();
for (int i = 0; i < pages;) {
++i;
copy.addPage(copy.getImportedPage(reader, i));
}
document.close();
}
}