You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Anton (JIRA)" <ji...@apache.org> on 2011/01/11 16:12:46 UTC

[jira] Created: (PDFBOX-939) Lost whitespaces when extracting Arabic text

Lost whitespaces when extracting Arabic text
--------------------------------------------

                 Key: PDFBOX-939
                 URL: https://issues.apache.org/jira/browse/PDFBOX-939
             Project: PDFBox
          Issue Type: Bug
          Components: Text extraction
    Affects Versions: 1.4.0
            Reporter: Anton 
         Attachments: test.pdf

I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.

Copy/pasted text from attached PDF:
بعد ما اكتشف حقيقة المثلث الغامض جوه دوالب جسمه إتأكد بإنه شايل حاجات كتير ملهاش الزمه ف استغنى عن كل أعضاؤه الرجلين اإليدين والعنين... رمى جسمه من الشباك وضحك من جواه على روحه اللي بتتبخر جوه درج العدم.

Extracted text:
)٥(
 بعد ما اكتشف حقيقةالمثلثالغامض
 جوهدولابجسمه
 إتأكد بإنه شايلحاجاتكتير
ملهاشلازمه
 ف استغنى عنكلأعضاؤه
الرجلين
الإيدين
...والعنين
 رمى جسمهمنالشباك
 وضحكمنجواه
 على روحهالليبتتبخر
 .جوهدرجالعدم


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-939) Lost whitespaces when extracting Arabic text

Posted by "Anton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anton  updated PDFBOX-939:
--------------------------

    Attachment: extracted.txt

> Lost whitespaces when extracting Arabic text
> --------------------------------------------
>
>                 Key: PDFBOX-939
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-939
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 1.4.0
>            Reporter: Anton 
>         Attachments: extracted.txt, test.pdf
>
>
> I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.
> Copy/pasted text from attached PDF:
> بعد ما اكتشف حقيقة المثلث الغامض جوه دوالب جسمه إتأكد بإنه شايل حاجات كتير ملهاش الزمه ف استغنى عن كل أعضاؤه الرجلين اإليدين والعنين... رمى جسمه من الشباك وضحك من جواه على روحه اللي بتتبخر جوه درج العدم.
> Extracted text:
> )٥(
>  بعد ما اكتشف حقيقةالمثلثالغامض
>  جوهدولابجسمه
>  إتأكد بإنه شايلحاجاتكتير
> ملهاشلازمه
>  ف استغنى عنكلأعضاؤه
> الرجلين
> الإيدين
> ...والعنين
>  رمى جسمهمنالشباك
>  وضحكمنجواه
>  على روحهالليبتتبخر
>  .جوهدرجالعدم

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-939) Lost whitespaces when extracting Arabic text

Posted by "Anton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986339#action_12986339 ] 

Anton  commented on PDFBOX-939:
-------------------------------

Thanks very much, Pavel! Your solution works well.
Seems like this bug took place for all RTL pdfs and I can't believe nobody else faced it.
I'm talking about a low activity on this issue.

Anyway, now its done, and I can use 1.5.0-SNAPSHOT.
Thanks!

> Lost whitespaces when extracting Arabic text
> --------------------------------------------
>
>                 Key: PDFBOX-939
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-939
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 1.4.0
>            Reporter: Anton 
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.5.0
>
>         Attachments: extracted.txt, test.pdf
>
>
> I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.
> Copy/pasted line from attached PDF:
> بعد ما اكتشف حقيقة المثلث الغامض
> Extracted text:
> بعد ما اكتشف حقيقةالمثلثالغامض
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PDFBOX-939) Lost whitespaces when extracting Arabic text

Posted by "Andreas Lehmkühler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Lehmkühler resolved PDFBOX-939.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.5.0
         Assignee: Andreas Lehmkühler

I added the pathc as proposed in revision 1063158. Works like a charm.

Thanks for the contribution!

> Lost whitespaces when extracting Arabic text
> --------------------------------------------
>
>                 Key: PDFBOX-939
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-939
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 1.4.0
>            Reporter: Anton 
>            Assignee: Andreas Lehmkühler
>             Fix For: 1.5.0
>
>         Attachments: extracted.txt, test.pdf
>
>
> I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.
> Copy/pasted line from attached PDF:
> بعد ما اكتشف حقيقة المثلث الغامض
> Extracted text:
> بعد ما اكتشف حقيقةالمثلثالغامض
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PDFBOX-939) Lost whitespaces when extracting Arabic text

Posted by "Pavel Pisarev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PDFBOX-939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12986058#action_12986058 ] 

Pavel Pisarev commented on PDFBOX-939:
--------------------------------------

Hi Anton, 

I've checked your example and found that each arabic line lost only two final spaces. The reason is located in the method PDFTextStripper#writeLine(List<String> line, boolean isRtlDominant). 

The original source code is:
int numberOfStrings = line.size();
        if (isRtlDominant) {
            for(int i=numberOfStrings-1; i>=0; i--){
                if (i > 1)
                    writeWordSeparator();
                writeString(line.get(i));
            }
        }
        else {
            for(int i=0; i<numberOfStrings; i++){
                writeString(line.get(i));
                if (!isRtlDominant && i < numberOfStrings-1)
                    writeWordSeparator();
            }
        }

I f you change condition "if (i > 1)" to "if (i < numberOfStrings-1)" text extraction will be correct. I suppose this is a bug.

> Lost whitespaces when extracting Arabic text
> --------------------------------------------
>
>                 Key: PDFBOX-939
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-939
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 1.4.0
>            Reporter: Anton 
>         Attachments: extracted.txt, test.pdf
>
>
> I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.
> Copy/pasted line from attached PDF:
> بعد ما اكتشف حقيقة المثلث الغامض
> Extracted text:
> بعد ما اكتشف حقيقةالمثلثالغامض
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-939) Lost whitespaces when extracting Arabic text

Posted by "Anton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anton  updated PDFBOX-939:
--------------------------

    Description: 
I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.

Copy/pasted line from attached PDF:
بعد ما اكتشف حقيقة المثلث الغامض

Extracted text:
بعد ما اكتشف حقيقةالمثلثالغامض
 

  was:
I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.

Copy/pasted text from attached PDF:
بعد ما اكتشف حقيقة المثلث الغامض جوه دوالب جسمه إتأكد بإنه شايل حاجات كتير ملهاش الزمه ف استغنى عن كل أعضاؤه الرجلين اإليدين والعنين... رمى جسمه من الشباك وضحك من جواه على روحه اللي بتتبخر جوه درج العدم.

Extracted text:
)٥(
 بعد ما اكتشف حقيقةالمثلثالغامض
 جوهدولابجسمه
 إتأكد بإنه شايلحاجاتكتير
ملهاشلازمه
 ف استغنى عنكلأعضاؤه
الرجلين
الإيدين
...والعنين
 رمى جسمهمنالشباك
 وضحكمنجواه
 على روحهالليبتتبخر
 .جوهدرجالعدم



> Lost whitespaces when extracting Arabic text
> --------------------------------------------
>
>                 Key: PDFBOX-939
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-939
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 1.4.0
>            Reporter: Anton 
>         Attachments: extracted.txt, test.pdf
>
>
> I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.
> Copy/pasted line from attached PDF:
> بعد ما اكتشف حقيقة المثلث الغامض
> Extracted text:
> بعد ما اكتشف حقيقةالمثلثالغامض
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PDFBOX-939) Lost whitespaces when extracting Arabic text

Posted by "Anton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PDFBOX-939?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Anton  updated PDFBOX-939:
--------------------------

    Attachment: test.pdf

> Lost whitespaces when extracting Arabic text
> --------------------------------------------
>
>                 Key: PDFBOX-939
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-939
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 1.4.0
>            Reporter: Anton 
>         Attachments: test.pdf
>
>
> I tried to extract text from an arabic PDF. Result looks good for the first look, but if you look closer, you may notice that some of whitespaces is missing comparing to copy/pasted text from the same PDF.
> Copy/pasted text from attached PDF:
> بعد ما اكتشف حقيقة المثلث الغامض جوه دوالب جسمه إتأكد بإنه شايل حاجات كتير ملهاش الزمه ف استغنى عن كل أعضاؤه الرجلين اإليدين والعنين... رمى جسمه من الشباك وضحك من جواه على روحه اللي بتتبخر جوه درج العدم.
> Extracted text:
> )٥(
>  بعد ما اكتشف حقيقةالمثلثالغامض
>  جوهدولابجسمه
>  إتأكد بإنه شايلحاجاتكتير
> ملهاشلازمه
>  ف استغنى عنكلأعضاؤه
> الرجلين
> الإيدين
> ...والعنين
>  رمى جسمهمنالشباك
>  وضحكمنجواه
>  على روحهالليبتتبخر
>  .جوهدرجالعدم

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.