How can I determine the number of pages in a given PDF file, using a free/open source Java API?
See Question&Answers more detail:osHow can I determine the number of pages in a given PDF file, using a free/open source Java API?
See Question&Answers more detail:osYou 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();