Table of Contents

Class RegexBasedLocationExtractionStrategy

Namespace
iText.Kernel.Pdf.Canvas.Parser.Listener
Assembly
itext.kernel.dll

This class is designed to search for the occurrences of a regular expression and return the resultant rectangles.

public class RegexBasedLocationExtractionStrategy : ILocationExtractionStrategy, IEventListener
Inheritance
RegexBasedLocationExtractionStrategy
Implements
Inherited Members

Constructors

RegexBasedLocationExtractionStrategy(string)

public RegexBasedLocationExtractionStrategy(string regex)

Parameters

regex string

RegexBasedLocationExtractionStrategy(Regex)

public RegexBasedLocationExtractionStrategy(Regex pattern)

Parameters

pattern Regex

Methods

EventOccurred(IEventData, EventType)

public virtual void EventOccurred(IEventData data, EventType type)

Parameters

data IEventData
type EventType

GetResultantLocations()

public virtual ICollection<IPdfTextLocation> GetResultantLocations()

Returns

ICollection<IPdfTextLocation>

GetSupportedEvents()

public virtual ICollection<EventType> GetSupportedEvents()

Returns

ICollection<EventType>

ToCRI(TextRenderInfo)

Convert TextRenderInfo to CharacterRenderInfo This method is public and not final so that custom implementations can choose to override it.

protected virtual IList<CharacterRenderInfo> ToCRI(TextRenderInfo tri)

Parameters

tri TextRenderInfo

TextRenderInfo object

Returns

IList<CharacterRenderInfo>

a list of CharacterRenderInfo s which represents the passed TextRenderInfo ?

Remarks

Convert 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.

ToRectangles(IList<CharacterRenderInfo>)

Converts CharacterRenderInfo objects to Rectangle s This method is protected and not final so that custom implementations can choose to override it.

protected virtual IList<Rectangle> ToRectangles(IList<CharacterRenderInfo> cris)

Parameters

cris IList<CharacterRenderInfo>

list of CharacterRenderInfo objects

Returns

IList<Rectangle>

an array containing the elements of this list

Remarks

Converts 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.