You can use Apache PDFBox to load a PDF document and then call the getNumberOfPages method to return the page count.
PDDocument doc = PDDocument.load(new File("file.pdf"));
int count = doc.getNumberOfPages();
You can use Apache PDFBox to load a PDF document and then call the getNumberOfPages method to return the page count.
PDDocument doc = PDDocument.load(new File("file.pdf"));
int count = doc.getNumberOfPages();