Hi Aaron,

You could store a map of TextPosition => Color which you populate in 
processTextPosition.
Lines are not known until the end of TextStripper’s processing (they have to be 
inferred) so you could override a method from one of the phases at the end and 
I think you should have access to either lines or TextPositions which are 
merged into continuous runs (I can’t remember which). Alternatively you can 
always grab all TextPositions with the same y position.

-- John

On 16 Jul 2014, at 13:27, Aaron Hartman <[email protected]> wrote:

> Hi everyone;
> I am currently scanning PDF’s for errors that have red text in them. I 
> accomplished this by extending the PDFTextStripper class and overriding the 
> processTextPosition method to examine the PDGraphicsState for the appropriate 
> color values.
> 
> Once this position is found is it possible to extract only the line where 
> that red text resides? For the user it would be beneficial to see the line in 
> which the error occurs. Since the processTextPosition has the actual position 
> I was hoping there may be a way to extract the line with the error from 
> within this method, or by storing the position and accessing it elsewhere. 
> 
> If there is a way to accomplish this, please let me know!
> 
> Thank you for your time.
> 
> -Aaron

Reply via email to