Hi,
the class you are using was introduced in iText Version 2.1.4 and the
method where the problem occurs (computeAverageWidth()) was added in iText
Version 2.1.5. Thus i am quite certain that you are iText version 2.1.5 :-)
You may ask why?
The problem is that in that version also a bug has been introduced - the
last line of the method is:
private int computeAverageWidth(){
...
return total/count;
}
One version later in 2.1.6 that bug was fixed with the following code:
private int computeAverageWidth(){
...
return count != 0 ? total/count : 0;
}
Thus if you upgrade your version you won't experience that problem anymore
...
Regards,
ToM
2013/5/15 Chandrashekhar Pandhare <chandrashekhar.pandh...@citizensfla.com>
> Thanks. Mkl and others for your help and suggestions.
>
> -----Original Message-----
> From: mkl [mailto:m...@wir-sind-cool.org]
> Sent: Wednesday, May 15, 2013 4:19 AM
> To: itext-questions@lists.sourceforge.net
> Subject: [iText-questions] [SPAM] Re: getTextFromPage(n) gives
> java.lang.ArithmeticException: / by zero
>
> Chandrashekhar Pandhare,
>
> Chandrashekhar Pandhare wrote
> > I have attached the pdf causing the / 0 exception through
> > getTextFromPage(n).
> >
> > Test_BCCA.pdf (192K)
> > <http://itext-general.2136553.n4.nabble.com/attachment/4658266/0/Te
> > st_BCCA.pdf>
>
> I've just tried it, the current iText extracts the text from your example
> document without any problems. Thus, you have run into one of the issues of
> the old iText version which meanwhile have been fixed or improved.
>
> I've tried extraction both using the LocationTextExtractionStrategy and
> the SimpleTextExtractionStrategy. For the example document the latter one
> might be preferable as the content stream (and, therefore, the output of
> the simple strategy) keeps related parts together while the former one is
> strictly top-to-bottom, left-to-right, and, therefore, intermingles
> unrelated parts which accidentally are positioned at the same height on the
> page.
>
> Even better, of course, would be creating a custom strategy which like the
> simple one is guided by the order of text in the content stream but has
> even more information at hand to properly parse the data into a meaningful
> dataset.
>
> Regards, Michael
>
>
>
> --
> View this message in context:
> http://itext-general.2136553.n4.nabble.com/getTextFromPage-n-gives-java-lang-ArithmeticException-by-zero-tp4658260p4658268.html
> Sent from the iText - General mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/ Please check
> the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
>
> ------------------------------------------------------------------------------
> AlienVault Unified Security Management (USM) platform delivers complete
> security visibility with the essential security capabilities. Easily and
> efficiently configure, manage, and operate all of your security controls
> from a single console and one unified framework. Download a free trial.
> http://p.sf.net/sfu/alienvault_d2d
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php