You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2017/05/02 17:18:04 UTC
[jira] [Comment Edited] (PDFBOX-3774) Incorrectly extracted text
(broken words)
[ https://issues.apache.org/jira/browse/PDFBOX-3774?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15993304#comment-15993304 ]
Tilman Hausherr edited comment on PDFBOX-3774 at 5/2/17 5:18 PM:
-----------------------------------------------------------------
Because the space is invisible. It isn't a white rectangle, it is just an empty glyph with a length. The "fi" has half the length (advancement) than what you see. This is a bad font IMO.
There is a way to extract this file - ignore the spaces, let PDFBox decide. See also PDFBOX-3248. All there is to do is this change in PDFTextStripper:
{code}
while (textIter.hasNext())
{
TextPosition position = textIter.next();
PositionWrapper current = new PositionWrapper(position);
String characterValue = position.getUnicode();
// change starts here
if (" ".equals(characterValue))
continue;
{code}
was (Author: tilman):
Because the space is invisible. It isn't a white rectangle, it is just an empty glyph with a length. The "fi" has half the length (advancement) than what you see. This is a bad font IMO.
There is a way to extract this file - ignore the spaces, let PDFBox decide. There is another issue about this but I can't find it (ok, I didn't even try). All there is to do is this change in PDFTextStripper:
{code}
while (textIter.hasNext())
{
TextPosition position = textIter.next();
PositionWrapper current = new PositionWrapper(position);
String characterValue = position.getUnicode();
// change starts here
if (" ".equals(characterValue))
continue;
{code}
> Incorrectly extracted text (broken words)
> -----------------------------------------
>
> Key: PDFBOX-3774
> URL: https://issues.apache.org/jira/browse/PDFBOX-3774
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.5
> Environment: Darwin Ninos-MacBook-Pro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
> Reporter: Nino Skopac
> Attachments: PDFBOX-3774_reduced.pdf
>
>
> First reported on Tika JIRA (https://issues.apache.org/jira/browse/TIKA-2342), but tracked down to PDFBox:
> ~ Usage
> java -jar pdfbox-app-2.0.5.jar ExtractText Huge_book.pdf Huge-book-pdfbox.txt
> ~ Sample
> Original PDF text: "Each certified or noncertified member"
> Tika extracted text: "Each certifi ed or noncertifi ed member"
> Thank you,
> Nino
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org