Question

1
Replies
87
Views
X
SethuramanR Member since 2015 7 posts
Serendebyte
Posted: 11 months ago
Last activity: 9 months 2 weeks ago

PDFBox getNumberOfPages always returns 0

Hi All,

I'm trying to get the total number of pages on the PDF using the PDFBox API(PDDocument). But, on using this method(getNumberOfPages), it always returns 0. Can anyone help me on this issue?. Thanks in advance.

Please find the below code snippet that I'm using.

try{
org.apache.pdfbox.pdmodel.PDDocument doc = new org.apache.pdfbox.pdmodel.PDDocument();
java.io.InputStream instream=new java.io.ByteArrayInputStream( new com.pega.pegarules.pub.util.Base64Util().decodeToByteArray(FileContent));
doc.load(instream);
oLog.error("No. of pages in document"+ doc.getNumberOfPages());

}catch(Exception e){

}

Data Integration Java and Activities
Share this page LinkedIn