Question

1
Replies
115
Views
SethuramanR Member since 2015 7 posts
Serendebyte
Posted: 1 year ago
Last activity: 1 year ago
Closed

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
Moderation Team has archived post
Share this page LinkedIn