How can I determine the number of pages in a given PDF file, using a free/open source Java API?
You can use Apache PDFBox to load a PDF document and then call the getNumberOfPages method to return the page count.
getNumberOfPages
PDDocument doc = PDDocument.load(new File("file.pdf")); int count = doc.getNumberOfPages();
1.4m articles
1.4m replys
5 comments
56.9k users