importjava.io.File;importjava.io.IOException;importorg.apache.pdfbox.pdmodel.PDDocument;publicclassRemovingPagesFromPdf{publicstaticvoidmain(String args[])throwsIOException{//Loading an existing document File file =newFile("C:/pdfBox/RemovePages_IP.pdf");PDDocument doc =PDDocument.load(file);//Listing the number of existing pages System.out.print(doc.getNumberOfPages());for(int i =0; i<5; i++){//removing the pages
doc.removePage(i);}System.out.println("page removed");//Saving the document
doc.save("C:/pdfBox/RemovePages_OP.pdf");//Closing the document
doc.close();}}