[]
        
(Showing Draft Content)

GrapeCity.Documents.Pdf.TextMap.ITextMap

Interface ITextMap

Namespace
GrapeCity.Documents.Pdf.TextMap
Assembly
GcDocs.Pdf.dll

Represents the text map of a page or of a portion of a page. Provides methods for text searching, hit testing etc.

The pixel values used by the text map's methods and properties are determined by the X and Y resolution passed to the GetTextMap(float, float, bool) method to create the text map.

public interface ITextMap : IReadOnlyList<ITextLine>, IReadOnlyCollection<ITextLine>, IEnumerable<ITextLine>, IEnumerable
Inherited Members
System.Collections.Generic.IReadOnlyList<GrapeCity.Documents.Pdf.TextMap.ITextLine>.this[int]
System.Collections.Generic.IReadOnlyCollection<GrapeCity.Documents.Pdf.TextMap.ITextLine>.Count
System.Collections.Generic.IEnumerable<GrapeCity.Documents.Pdf.TextMap.ITextLine>.GetEnumerator()
Extension Methods

Properties

Invalid

Indicates whether this ITextMap is valid and can be used.

The ITextMap becomes invalid after editing operations like DeleteText(TextMapFragment, DeleteTextMode), ReplaceText(TextMapFragment, string, Font, float?) etc.

bool Invalid { get; }

Property Value

bool

Page

Gets the Page object producing this ITextMap.

Page Page { get; }

Property Value

Page

Paragraphs

Gets the list of text paragraphs.

IReadOnlyList<ITextParagraph> Paragraphs { get; }

Property Value

System.Collections.Generic.IReadOnlyList<T><ITextParagraph>

Methods

DeleteText(TextMapFragment, DeleteTextMode)

Deletes a specified text fragment.

void DeleteText(TextMapFragment fragment, DeleteTextMode mode)

Parameters

fragment TextMapFragment

The fragment to delete.

mode DeleteTextMode

The text delete mode.

FindText(FindTextParams, FindTextCallback)

Performs a text search within this text map. The callback is called for each found instance.

void FindText(FindTextParams tp, FindTextCallback callback)

Parameters

tp FindTextParams

A FindTextParams specifying the search parameters.

callback FindTextCallback

The callback method.

GetCoords(TextLineFragment)

Gets the coordinates of a TextLineFragment on the page.

Quadrilateral GetCoords(TextLineFragment tlf)

Parameters

tlf TextLineFragment

The TextLineFragment.

Returns

Quadrilateral

A Quadrilateral containing the text coordinates.

GetFragment(MapPos, MapPos, out TextMapFragment, out string)

Gets a TextMapFragment that represents the text within a specified range (from startPos to endPos).

void GetFragment(MapPos startPos, MapPos endPos, out TextMapFragment fragment, out string text)

Parameters

startPos MapPos

The MapPos specifying the start of the range.

endPos MapPos

The MapPos specifying the end of the range.

fragment TextMapFragment

OUT: a TextMapFragment representing the text in the range.

text string

OUT: the fragment's text.

GetFragment(out TextMapFragment, out string)

Gets a TextMapFragment that represents the text of the whole page.

void GetFragment(out TextMapFragment fragment, out string text)

Parameters

fragment TextMapFragment

OUT: a TextMapFragment representing the text on the page.

text string

OUT: the fragment's text.

GetFragmentFromPos(MapPos, out TextMapFragment, out string)

Gets a TextMapFragment that represents the text from pos to the end of the page.

void GetFragmentFromPos(MapPos pos, out TextMapFragment fragment, out string text)

Parameters

pos MapPos

The MapPos specifying the start of the range.

fragment TextMapFragment

OUT: a TextMapFragment representing the text in the range.

text string

OUT: the fragment's text.

GetFragmentToPos(MapPos, out TextMapFragment, out string)

Gets a TextMapFragment that represents the text from the start of the page to pos.

void GetFragmentToPos(MapPos pos, out TextMapFragment fragment, out string text)

Parameters

pos MapPos

The MapPos specifying the end of the range.

fragment TextMapFragment

OUT: a TextMapFragment representing the text in the range.

text string

OUT: the fragment's text.

GetPoints(TextLineFragment)

Gets the array of points defining a polygon with coordinates of a TextLineFragment on the page.

PointF[] GetPoints(TextLineFragment tlf)

Parameters

tlf TextLineFragment

The TextLineFragment.

Returns

System.Drawing.PointF[]

An array of points defining the polygon of the fragment on a page.

GetText()

Gets the whole text represented by this map.

string GetText()

Returns

string

The map text.

GetText(TextLineFragment)

Gets the text of a TextLineFragment.

string GetText(TextLineFragment br)

Parameters

br TextLineFragment

The TextLineFragment.

Returns

string

The text of the TextLineFragment.

GetWord(MapPos, out int, out int, out Quadrilateral)

Gets the info about a word at a specified position in a line.

void GetWord(MapPos pos, out int start, out int length, out Quadrilateral bounds)

Parameters

pos MapPos

A MapPos specifying a position in the ITextMap.

start int

OUT: the start index of the word in the line.

length int

OUT: the length of the word in characters.

bounds Quadrilateral

OUT: the geometric bounds of the word.

HitTest(float, float)

Performs hit testing on the map.

This method accepts a pixel location relative to the top left corner of the page, and provides info about the text in that location.

The pixel resolution is the resolution specified when building this text map (see GetTextMap(float, float, bool) and other GetTextMap() overloads).

HitTestInfo HitTest(float x, float y)

Parameters

x float

The X pixel location relative to the top left corner of the page.

y float

The Y pixel location relative to the top left corner of the page.

Returns

HitTestInfo

HitTestInfo containing the hit test result.

ReplaceText(TextMapFragment, string, Font, float?)

Replaces a specified text fragment with another text.

void ReplaceText(TextMapFragment fragment, string text, Font font = null, float? fontSize = null)

Parameters

fragment TextMapFragment

The fragment to replace.

text string

The replacement text.

font Font

The font for the replacement text. If null, the current font will be used.

fontSize float?

The font size for the replacement text. If null, the current font size will be used.