Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Get paragraphs in pdf file

$
0
0
Hello,

I am using aspose.pdf 4.5.1to get all the paragraphs of a pdf file,
Here is the code:

com.aspose.pdf.Document pdfDoc = new com.aspose.pdf.Document(new FileInputStream(file));

PageCollection pdfPages = pdfDoc.getPages();

for (int i = 1 ; i <= pdfPages.size(); i ++){

    try{

       Page pdfPage = pdfPages.get_Item(i);

       com.aspose.pdf.Paragraphs parags = pdfPage.getParagraphs();

       int len = parags.getCount();

       for (int j = 0; j < len; j++){

            //do something on paragraph

        }

     }catch(Exception e){e.printStackTrace();}

}

This line pdfPage.getParagraphs(); is throwing an error and exit directly my function without passing by the catch.

Is there something missing in my code?


Thank you



Viewing all articles
Browse latest Browse all 3131

Trending Articles