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

Tilman Hausherr commented on PDFBOX-3063:
-----------------------------------------

The new file with 1.8: (I modified the constructor):
{code}
        super(ResourceLoader.loadProperties(
                "org/apache/pdfbox/resources/PageDrawer.properties", true ) );

String[409.2,429.55658 fs=6.0 xscale=6.0 height=198.69 space=1.6680002 
width=3.3359985]3
getGraphicsState().getStrokingColor(): java.awt.Color[r=255,g=255,b=255]
getGraphicsState().getNonStrokingColor(): java.awt.Color[r=255,g=255,b=255]
String[412.5,429.55658 fs=8.9 xscale=8.9 height=294.7235 space=2.4742002 
width=4.948395]4
getGraphicsState().getStrokingColor(): java.awt.Color[r=0,g=0,b=0]
getGraphicsState().getNonStrokingColor(): java.awt.Color[r=0,g=0,b=0]
String[417.4484,429.55658 fs=8.9 xscale=8.9 height=294.7235 space=2.4742002 
width=4.948395]9
getGraphicsState().getStrokingColor(): java.awt.Color[r=0,g=0,b=0]
getGraphicsState().getNonStrokingColor(): java.awt.Color[r=0,g=0,b=0]
String[422.3968,429.55658 fs=8.9 xscale=8.9 height=294.7235 space=2.4742002 
width=4.948395]5
getGraphicsState().getStrokingColor(): java.awt.Color[r=0,g=0,b=0]
getGraphicsState().getNonStrokingColor(): java.awt.Color[r=0,g=0,b=0]
String[427.34518,429.55658 fs=8.9 xscale=8.9 height=294.7235 space=2.4742002 
width=2.4742126].
getGraphicsState().getStrokingColor(): java.awt.Color[r=0,g=0,b=0]
getGraphicsState().getNonStrokingColor(): java.awt.Color[r=0,g=0,b=0]
String[429.8194,429.55658 fs=8.9 xscale=8.9 height=294.7235 space=2.4742002 
width=4.948395]3
getGraphicsState().getStrokingColor(): java.awt.Color[r=0,g=0,b=0]
getGraphicsState().getNonStrokingColor(): java.awt.Color[r=0,g=0,b=0]
String[434.7678,429.55658 fs=8.9 xscale=8.9 height=294.7235 space=2.4742002 
width=4.948395]2
getGraphicsState().getStrokingColor(): java.awt.Color[r=0,g=0,b=0]
getGraphicsState().getNonStrokingColor(): java.awt.Color[r=0,g=0,b=0]
String[511.19998,429.55658 fs=8.9 xscale=8.9 height=294.7235 space=2.4742002 
width=2.4742126] 
getGraphicsState().getStrokingColor(): java.awt.Color[r=0,g=0,b=0]
getGraphicsState().getNonStrokingColor(): java.awt.Color[r=0,g=0,b=0]
{code}

with 2.0, overriding processTextPosition:

{code}
Unicode:     3
Stoking:     PDColor{components=[1.0, 1.0, 1.0], patternName=null}
NonStroking: PDColor{components=[1.0, 1.0, 1.0], patternName=null}
Unicode:     4
Stoking:     PDColor{components=[0.0, 0.0, 0.0], patternName=null}
NonStroking: PDColor{components=[0.0, 0.0, 0.0], patternName=null}
Unicode:     9
Stoking:     PDColor{components=[0.0, 0.0, 0.0], patternName=null}
NonStroking: PDColor{components=[0.0, 0.0, 0.0], patternName=null}
Unicode:     5
Stoking:     PDColor{components=[0.0, 0.0, 0.0], patternName=null}
NonStroking: PDColor{components=[0.0, 0.0, 0.0], patternName=null}
Unicode:     .
Stoking:     PDColor{components=[0.0, 0.0, 0.0], patternName=null}
NonStroking: PDColor{components=[0.0, 0.0, 0.0], patternName=null}
Unicode:     3
Stoking:     PDColor{components=[0.0, 0.0, 0.0], patternName=null}
NonStroking: PDColor{components=[0.0, 0.0, 0.0], patternName=null}
Unicode:     2
Stoking:     PDColor{components=[0.0, 0.0, 0.0], patternName=null}
NonStroking: PDColor{components=[0.0, 0.0, 0.0], patternName=null}
Unicode:      
Stoking:     PDColor{components=[0.0, 0.0, 0.0], patternName=null}
NonStroking: PDColor{components=[0.0, 0.0, 0.0], patternName=null}
{code}

So it all works as expected. (What do you get, or what did you expect?)

Btw you wrote "comes through as white on white (stroking and nonstroking)". 
stroking and nonstroking does not mean foreground and background. One is for 
lines, the other for fills. Fonts are usually done with the nonstroking color, 
in text rendering mode 0. Read more about this in the 32000 spec, 9.3.6 Text 
Rendering Mode.

> Appears that getStrokingColor/getNonStrokingColor are broken
> ------------------------------------------------------------
>
>                 Key: PDFBOX-3063
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3063
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>            Reporter: Joel Hirsh
>         Attachments: whiteonwhitetext.pdf, whitetext.pdf
>
>
> I am using PDFTextStripper and overriding processTextPosition so that I can 
> test for white on white text.
> In version 1.8 I called getGraphicsState().getStrokingColor() and 
> getGraphicsState().getNonStrokingColor() to get the colors and then could 
> test for white on white text.
> In version 2.0 I am making the same calls on the same file, but the PDColor 
> returned for both methods never changes from PDColor{components=[0.0], 
> patternName=null}
> In the attached file, there is some white text '661.37' just above and to the 
> left of the 2.00.  Can find it in Acrobat by searching or careful selecting



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to