You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Shengwen (JIRA)" <ji...@apache.org> on 2009/04/02 05:26:13 UTC

[jira] Created: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents
----------------------------------------------------------------------------------------------

                 Key: PDFBOX-450
                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
             Project: PDFBox
          Issue Type: Bug
          Components: Text extraction
    Affects Versions: 0.8.0-incubator
         Environment: Windows XP, JDK 5.0
            Reporter: Shengwen
             Fix For: 0.8.0-incubator


PDFTextStripper can not extract correct font information from the attached document.  When I traced into the code, I found that the TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all cases. However, the TextPosition.getFont().getAverageFontWidth() has different values obviously.

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


Re: [jira] Commented: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

Posted by Shengwen Yang <ya...@gmail.com>.
Thanks Andreas for your comments.

In fact, I use TextPosition. getFontSize() * TextPosition.getXScale() as the
font size. It works for most of cases. However, it doesn't work for zzz.pdf
because getFontSize() always returns 1 and getXScale() always return 0.24.

I will try with the version 761547. Thanks again.


2009/4/3 Andreas Lehmkühler (JIRA) <ji...@apache.org>

>
>    [
> https://issues.apache.org/jira/browse/PDFBOX-450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12695281#action_12695281]
>
> Andreas Lehmkühler commented on PDFBOX-450:
> -------------------------------------------
>
> Obviously there is a misunderstanding concerning how some text informations
> are handled within a pdf document. The fontsize is always a combination of
> the pdf-fontsize (Tf-operator) and the scaling within the textmatrix
> (Tm-operator). In a lot of documents the fontsize will be achieved through
> scaling and not by setting the pdf-fontsize to the needed value. In that
> cases the pdf-fontsize will always be 1.
> Back to the TextPosition. getFontSize() returns the pdf-fontsize and
> getXScale() the scaling factor in x-direction from the textmatrix in display
> units. I hope now it is obvious why these values doesn't match with your
> expectations.
>
> With version 761547 there is an additional method named getFontSizeInPt in
> the class TextPosition, which returns the font size in pt-units.
>
>
>
> > PDFTextStripper CAN NOT extract correct font information for some early
> produced PDF documents
> >
> ----------------------------------------------------------------------------------------------
> >
> >                 Key: PDFBOX-450
> >                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
> >             Project: PDFBox
> >          Issue Type: Bug
> >          Components: Text extraction
> >    Affects Versions: 0.8.0-incubator
> >         Environment: Windows XP, JDK 5.0
> >            Reporter: Shengwen
> >             Fix For: 0.8.0-incubator
> >
> >         Attachments: 1066.pdf, zzz.pdf
> >
> >
> > PDFTextStripper can not extract correct font information from the
> attached document.  When I traced into the code, I found that the
> TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all
> cases. However, the TextPosition.getFont().getAverageFontWidth() has
> different values obviously.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

[jira] Updated: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

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

Shengwen updated PDFBOX-450:
----------------------------

    Attachment: zzz.pdf

It's obvious that the title, author, affiliation, and abstract in the first page have different font size, but the PDFTextStripper can not extract correct font information.

> PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents
> ----------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-450
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 0.8.0-incubator
>         Environment: Windows XP, JDK 5.0
>            Reporter: Shengwen
>             Fix For: 0.8.0-incubator
>
>         Attachments: zzz.pdf
>
>
> PDFTextStripper can not extract correct font information from the attached document.  When I traced into the code, I found that the TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all cases. However, the TextPosition.getFont().getAverageFontWidth() has different values obviously.

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


[jira] Issue Comment Edited: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

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

Shengwen edited comment on PDFBOX-450 at 4/1/09 8:34 PM:
---------------------------------------------------------

It's obvious that the title, author, affiliation, and abstract in the first page of zzz.pdf have different font size, but the PDFTextStripper can not extract correct font information.

      was (Author: yangshengwen@gmail.com):
    It's obvious that the title, author, affiliation, and abstract in the first page have different font size, but the PDFTextStripper can not extract correct font information.
  
> PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents
> ----------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-450
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 0.8.0-incubator
>         Environment: Windows XP, JDK 5.0
>            Reporter: Shengwen
>             Fix For: 0.8.0-incubator
>
>         Attachments: 1066.pdf, zzz.pdf
>
>
> PDFTextStripper can not extract correct font information from the attached document.  When I traced into the code, I found that the TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all cases. However, the TextPosition.getFont().getAverageFontWidth() has different values obviously.

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


[jira] Resolved: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

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

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

       Resolution: Fixed
    Fix Version/s: 0.8.0-incubator

Setting this issue to resolved.

> PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents
> ----------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-450
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 0.8.0-incubator
>         Environment: Windows XP, JDK 5.0
>            Reporter: Shengwen
>             Fix For: 0.8.0-incubator
>
>         Attachments: 1066.pdf, zzz.pdf
>
>
> PDFTextStripper can not extract correct font information from the attached document.  When I traced into the code, I found that the TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all cases. However, the TextPosition.getFont().getAverageFontWidth() has different values obviously.

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


[jira] Updated: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

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

Andreas Lehmkühler updated PDFBOX-450:
--------------------------------------

    Fix Version/s:     (was: 0.8.0-incubator)

> PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents
> ----------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-450
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 0.8.0-incubator
>         Environment: Windows XP, JDK 5.0
>            Reporter: Shengwen
>         Attachments: 1066.pdf, zzz.pdf
>
>
> PDFTextStripper can not extract correct font information from the attached document.  When I traced into the code, I found that the TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all cases. However, the TextPosition.getFont().getAverageFontWidth() has different values obviously.

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


[jira] Commented: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

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

Andreas Lehmkühler commented on PDFBOX-450:
-------------------------------------------

Obviously there is a misunderstanding concerning how some text informations are handled within a pdf document. The fontsize is always a combination of the pdf-fontsize (Tf-operator) and the scaling within the textmatrix (Tm-operator). In a lot of documents the fontsize will be achieved through scaling and not by setting the pdf-fontsize to the needed value. In that cases the pdf-fontsize will always be 1. 
Back to the TextPosition. getFontSize() returns the pdf-fontsize and getXScale() the scaling factor in x-direction from the textmatrix in display units. I hope now it is obvious why these values doesn't match with your expectations.

With version 761547 there is an additional method named getFontSizeInPt in the class TextPosition, which returns the font size in pt-units.



> PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents
> ----------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-450
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 0.8.0-incubator
>         Environment: Windows XP, JDK 5.0
>            Reporter: Shengwen
>             Fix For: 0.8.0-incubator
>
>         Attachments: 1066.pdf, zzz.pdf
>
>
> PDFTextStripper can not extract correct font information from the attached document.  When I traced into the code, I found that the TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all cases. However, the TextPosition.getFont().getAverageFontWidth() has different values obviously.

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


[jira] Updated: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

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

Shengwen updated PDFBOX-450:
----------------------------

    Attachment: 1066.pdf

By the way, PDFTextStripper can not handle the non-ascii character in the author line of the attached document. It produced a space in the position of the non-ascii character. (i.e. "Anu Pramila, Anja Keskinarkaus, and Tapio Sepp anen")

Thanks very much.

> PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents
> ----------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-450
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 0.8.0-incubator
>         Environment: Windows XP, JDK 5.0
>            Reporter: Shengwen
>             Fix For: 0.8.0-incubator
>
>         Attachments: 1066.pdf, zzz.pdf
>
>
> PDFTextStripper can not extract correct font information from the attached document.  When I traced into the code, I found that the TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all cases. However, the TextPosition.getFont().getAverageFontWidth() has different values obviously.

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


[jira] Issue Comment Edited: (PDFBOX-450) PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents

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

Shengwen edited comment on PDFBOX-450 at 4/1/09 8:35 PM:
---------------------------------------------------------

By the way, PDFTextStripper can not handle the non-ascii character in the author line of the attached document (1066.pdf). It produced a space in the position of the non-ascii character. (i.e. "Anu Pramila, Anja Keskinarkaus, and Tapio Sepp anen")

Thanks very much.

      was (Author: yangshengwen@gmail.com):
    By the way, PDFTextStripper can not handle the non-ascii character in the author line of the attached document. It produced a space in the position of the non-ascii character. (i.e. "Anu Pramila, Anja Keskinarkaus, and Tapio Sepp anen")

Thanks very much.
  
> PDFTextStripper CAN NOT extract correct font information for some early produced PDF documents
> ----------------------------------------------------------------------------------------------
>
>                 Key: PDFBOX-450
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-450
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 0.8.0-incubator
>         Environment: Windows XP, JDK 5.0
>            Reporter: Shengwen
>             Fix For: 0.8.0-incubator
>
>         Attachments: 1066.pdf, zzz.pdf
>
>
> PDFTextStripper can not extract correct font information from the attached document.  When I traced into the code, I found that the TextPosition.getFontSize()=1 and TextPosition.getXScale() = 0.24 in all cases. However, the TextPosition.getFont().getAverageFontWidth() has different values obviously.

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