开发者

Java - PDFBox - Text Extraction

I have been using pdfbox for extracting text information from PDFs. I have succesfully parsed all properties of text such as font开发者_StackOverflow社区name , fontface , size ,position etc.

PROBLEM: I am using pdfbox1.2.1(latest version). The getCharacter() in TextPosition class returns the full string except the last character. The last character is parsed as a separate string.

Ex: "How are you" is parsed as "How are yo" and "u" (2 separate strings).

I dont want it to happen that way..

Has anybody come accross this? .. Am i doing something wrong??.. Waiting for reply..

Thanks and Regards, Magggi


This issue is solved.

The following code in processEncodedText( byte[] string ) in PDFStreamEngine.java

if( spacingText == 0 && (i + codeLength) < (string.length - 1) )
{
    continue;
}

should be changed to

if( spacingText == 0 && (i + codeLength) < (string.length) )
{
    continue;
}

Regards, Maggi


Yes. This issue is solved by pdfbox.
Try latest version of pdfbox. The latest version can be downloaded from http://pdfbox.apache.org/download.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜