Class RegexBasedLocationExtractionStrategy
java.lang.Object
com.itextpdf.kernel.pdf.canvas.parser.listener.RegexBasedLocationExtractionStrategy
- All Implemented Interfaces:
-
IEventListener
,ILocationExtractionStrategy
public class RegexBasedLocationExtractionStrategy extends Object implements ILocationExtractionStrategy
This class is designed to search for the occurrences of a regular expression and return the resultant rectangles.
-
Constructor Summary
ConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionvoid
eventOccurred
(IEventData data, EventType type) Called when some event occurs during parsing a content stream.Returns theRectangle
s that have been processed so far.Provides the set of event types this listener supports.protected List<CharacterRenderInfo>
toCRI
(TextRenderInfo tri) ConvertTextRenderInfo
toCharacterRenderInfo
This method is public and not final so that custom implementations can choose to override it.toRectangles
(List<CharacterRenderInfo> cris) ConvertsCharacterRenderInfo
objects toRectangle
s This method is protected and not final so that custom implementations can choose to override it.
-
Constructor Details
-
RegexBasedLocationExtractionStrategy
-
RegexBasedLocationExtractionStrategy
-
-
Method Details
-
getResultantLocations
Description copied from interface:ILocationExtractionStrategy
Returns theRectangle
s that have been processed so far.- Specified by:
-
getResultantLocations
in interfaceILocationExtractionStrategy
- Returns:
-
Collection
<IPdfTextLocation
> instance with the current resultant IPdfTextLocations
-
eventOccurred
Description copied from interface:IEventListener
Called when some event occurs during parsing a content stream.- Specified by:
-
eventOccurred
in interfaceIEventListener
- Parameters:
-
data
- Combines the data required for processing corresponding event type. -
type
- Event type.
-
getSupportedEvents
Description copied from interface:IEventListener
Provides the set of event types this listener supports. Returns null if all possible event types are supported.- Specified by:
-
getSupportedEvents
in interfaceIEventListener
- Returns:
- Set of event types supported by this listener or null if all possible event types are supported.
-
toCRI
ConvertTextRenderInfo
toCharacterRenderInfo
This method is public and not final so that custom implementations can choose to override it. Other implementations ofCharacterRenderInfo
may choose to store different properties than merely theRectangle
describing the bounding box. E.g. a custom implementation might choose to storeColor
information as well, to better match the content surrounding the redactionRectangle
.- Parameters:
-
tri
-TextRenderInfo
object - Returns:
-
a list of
CharacterRenderInfo
s which represents the passedTextRenderInfo
?
-
toRectangles
ConvertsCharacterRenderInfo
objects toRectangle
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 ofCharacterRenderInfo
toRectangle
. 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 theCharacterRenderInfo
objects that generated theRectangle
.- Parameters:
-
cris
- list ofCharacterRenderInfo
objects - Returns:
- an array containing the elements of this list
-