Hi all,
I found a bug in class com.itextpdf.text.pdf.parser.TextRenderInfo.class of
version 5.5.4.
When I called PdfTextExtractor.getTextFromPage(reader, pageNumber) some of the
pages returned an IndexOutOfBounds Exception.
I had to add a line in method getCharCode from class TextRenderInfo to check
that string is not empty.
private int getCharCode(String string) {
try {
if (string.isEmpty()) {
string = " "; // Bug solved
}
byte[] b = string.getBytes("UTF-16BE");
int value = 0;
for (int i = 0; i < b.length - 1; i++) {
value += b[i] & 0xff;
value <<= 8;
}
value += b[b.length - 1] & 0xff;
return value;
} catch (UnsupportedEncodingException e) {
}
return 0;
}
Hope this helps.
Regards,
Sonia
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
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