public class RegexBasedLocationExtractionStrategy extends Object implements ILocationExtractionStrategy
Constructor and Description |
---|
RegexBasedLocationExtractionStrategy(Pattern pattern) |
RegexBasedLocationExtractionStrategy(String regex) |
Modifier and Type | Method and Description |
---|---|
void |
eventOccurred(IEventData data, EventType type)
Called when some event occurs during parsing a content stream.
|
Collection<IPdfTextLocation> |
getResultantLocations()
Returns the Rectangle s that have been processed so far.
|
Set<EventType> |
getSupportedEvents()
Provides the set of event types this listener supports.
|
protected List<CharacterRenderInfo> |
toCRI(TextRenderInfo tri)
Convert TextRenderInfo to CharacterRenderInfo This method is public and not final so that custom implementations can choose to override it.
|
protected List<Rectangle> |
toRectangles(List<CharacterRenderInfo> cris)
Converts CharacterRenderInfo objects to Rectangle s This method is protected and not final so that custom implementations can choose to override it.
|
public RegexBasedLocationExtractionStrategy(String regex)
public RegexBasedLocationExtractionStrategy(Pattern pattern)
public Collection<IPdfTextLocation> getResultantLocations()
ILocationExtractionStrategy
Rectangle
s that have been processed so far.
getResultantLocations
in interface ILocationExtractionStrategy
Collection
<IPdfTextLocation
> instance with the current resultant IPdfTextLocations
public void eventOccurred(IEventData data, EventType type)
IEventListener
eventOccurred
in interface IEventListener
data
- Combines the data required for processing corresponding event type.
type
- Event type.
public Set<EventType> getSupportedEvents()
IEventListener
getSupportedEvents
in interface IEventListener
protected List<CharacterRenderInfo> toCRI(TextRenderInfo tri)
TextRenderInfo
to CharacterRenderInfo
This method is public and not final so that custom implementations can choose to override it. Other implementations of CharacterRenderInfo
may choose to store different properties than merely the Rectangle
describing the bounding box. E.g. a custom implementation might choose to store Color
information as well, to better match the content surrounding the redaction Rectangle
.
tri
-
protected List<Rectangle> toRectangles(List<CharacterRenderInfo> cris)
CharacterRenderInfo
objects to Rectangle
s This method is protected and not final so that custom implementations can choose to override it. E.g. other implementations may choose to add padding/margin to the Rectangles. This method also offers a convenient access point to the mapping of CharacterRenderInfo
to Rectangle
. This mapping enables (custom implementations) to match color of text in redacted Rectangles, or match color of background, by the mere virtue of offering access to the CharacterRenderInfo
objects that generated the Rectangle
.
cris
-
Copyright © 1998–2018 iText Group NV. All rights reserved.