Get total number of pages

How to get the total number of pages in a PDF?

Hi Mayur,

Thanks for your inquiry. Aspose.Pdf.Kit for Java has a class named PdfFileInfo which contains a property named getNumberOfPages that can used to get the total number of pages in a PDF file.

PdfFileInfo fileInfo = new PdfFileInfo(“input.pdf”);

System.out.println(“Totalpages:”+fileInfo.getNumberofPages());

Please feel free to contact us for any further assistance.

Best Regards,