Discussion:
[iText-questions] Bug detected in TextRenderInfo.class
Bilbao Arechabala, Sonia
2015-01-30 13:14:55 UTC
Permalink
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
mkl
2015-02-06 08:11:37 UTC
Permalink
Sonia,
Post by Bilbao Arechabala, Sonia
When I called PdfTextExtractor.getTextFromPage(reader, pageNumber) some of
the pages returned an IndexOutOfBounds Exception.
Can you share a sample file to reproduce the issue?

Regards, Michael



--
View this message in context: http://itext-general.2136553.n4.nabble.com/Bug-detected-in-TextRenderInfo-class-tp4660710p4660723.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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-***@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
iText mailing list
2015-02-06 13:11:28 UTC
Permalink
Post by mkl
Sonia,
Post by Bilbao Arechabala, Sonia
When I called PdfTextExtractor.getTextFromPage(reader, pageNumber) some of
the pages returned an IndexOutOfBounds Exception.
Can you share a sample file to reproduce the issue?
Hi Michael,
there's no need for that. The bug was already fixed in the SVN
repository before it was posted here.

------------------------------------------------------------------------------
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-***@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
Kevin Day
2015-02-09 15:09:02 UTC
Permalink
Whoops - looking at SVN, I see that there is already a sample in the unit
tests - please disregard my prior request - I'll look at it from there.



--
View this message in context: http://itext-general.2136553.n4.nabble.com/Bug-detected-in-TextRenderInfo-class-tp4660710p4660741.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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-***@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
Loading...