You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Andreas Lehmkühler (JIRA)" <ji...@apache.org> on 2014/10/06 12:58:34 UTC

[jira] [Commented] (PDFBOX-2246) PDFTextStripper should handle colors

    [ https://issues.apache.org/jira/browse/PDFBOX-2246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14160182#comment-14160182 ] 

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

I could work, but only if people know how to handle the available values. The stroking/nonstroking color is a PDColor, which could be something like a simple RGB color as well as a pattern. Furthermore one have to take the text mode into account to know which color value is relevant.

> PDFTextStripper should handle colors
> ------------------------------------
>
>                 Key: PDFBOX-2246
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2246
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Text extraction
>    Affects Versions: 1.8.6, 1.8.7, 2.0.0
>            Reporter: Tilman Hausherr
>            Priority: Minor
>
> A recent thread in the dev mailing lst (with Aaron H.) dealt with the inability to extract color with PDFTextStripper. The solution was to create a  PDFTextStripper with these entries to the properties file
> {code}
> CS=org.apache.pdfbox.util.operator.SetStrokingColorSpace
> cs=org.apache.pdfbox.util.operator.SetNonStrokingColorSpace
> rg=org.apache.pdfbox.util.operator.SetNonStrokingRGBColor
> G=org.apache.pdfbox.util.operator.SetStrokingGrayColor
> g=org.apache.pdfbox.util.operator.SetNonStrokingGrayColor
> K=org.apache.pdfbox.util.operator.SetStrokingCMYKColor
> k=org.apache.pdfbox.util.operator.SetNonStrokingCMYKColor
> RG=org.apache.pdfbox.util.operator.SetStrokingRGBColor
> rg=org.apache.pdfbox.util.operator.SetNonStrokingRGBColor
> SC=org.apache.pdfbox.util.operator.SetStrokingColor
> sc=org.apache.pdfbox.util.operator.SetNonStrokingColor
> SCN=org.apache.pdfbox.util.operator.SetStrokingColor
> scn=org.apache.pdfbox.util.operator.SetNonStrokingColor
> {code}
> I therefore propose (and I'd like to get at least one "+1" before starting because I've never worked on that segment before):
> - replacing the empty entries in the PDFTextStripper property file with the ones above
> - improve the printtextlocations example 
> The problem has come up before: PDFBOX-1736, http://stackoverflow.com/q/10844271/535646 , http://stackoverflow.com/a/9157714/535646 and the solutions presented are rather cumbersome (using a PageDrawer object).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)