Open AbbasKhan786369 opened 2 years ago
public static int getPdfPages(String pdfPath){
PdfReader pdfReader = null;
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(pdfPath);
pdfReader = new PdfReader(fileInputStream);
} catch (IOException e) {
logger.debug(TAG + e.toString());
e.printStackTrace();
}
int pages = 0;
if(null != pdfReader){
pages = pdfReader.getNumberOfPages();
}else{
logger.error(TAG + "PdfReader NULL !!!");
}
if(null != fileInputStream){
try {
fileInputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
logger.debug(TAG + "PDF 页数: " + pages);
return pages;
}
PdfReader is not used in this library ? Do we need to import PdfReader library ? How do you do that ?
Is there any way that we can get all number of pages using this library?