Show / Hide Table of Contents

Class TextRange

The TextRange class represents a contiguous range of text on a PDF page. It may be the result of a text search, or simply a couple of highlighted or underlined words.

Each text range contains a few pieces of information:

page: the number of the page this piece of text is on; position: the start position (text offset); length: the length.

You are able to retrieve further information about the text range, such as its coordinates, the text itself, as well as characters before and after.

Inheritance
System.Object
TextRange
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: pdftron.PDF
Assembly: PDFNetAndroid.dll
Syntax
public class TextRange : IDisposable

Constructors

TextRange()

Creates a default TextRange object

Declaration
public TextRange()

TextRange(TextRange)

Creates a TextRange from a given object

Declaration
public TextRange(TextRange tr)
Parameters
Type Name Description
TextRange tr

a given TextRange object

Methods

Destroy()

Declaration
public void Destroy()

Dispose()

Declaration
public void Dispose()

Dispose(Boolean)

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing

Finalize()

Releases all resources used by the TextRange

Declaration
protected void Finalize()

GetPageNumber()

Get the page number of the text range.

Declaration
public int GetPageNumber()
Returns
Type Description
System.Int32

the page number

GetQuads()

Get the corresponding quadrangles of the text range.

Declaration
public double[] GetQuads()
Returns
Type Description
System.Double[]

the output quadrangles. Each quadrangle has eight doubles (x1, y1), (x2, y2), (x3, y3), (x4, y4) denoting the four vertices in counter-clockwise order.

Remarks

since a highlight may correspond to multiple quadrangles, e.g., when it crosses a line, the number of resulting quadrangles may be larger than 1.

GetText()

Get the Unicode string content of the text range.

Declaration
public string GetText()
Returns
Type Description
System.String

the text within the range

GetTextAfter(Int32)

Get the Unicode string content immediately after the text range.

Declaration
public string GetTextAfter(int count)
Parameters
Type Name Description
System.Int32 count

the number of characters to retrieve after the text range

Returns
Type Description
System.String

the text after the range

GetTextBefore(Int32)

Get the Unicode string content immediately before the text range.

Declaration
public string GetTextBefore(int count)
Parameters
Type Name Description
System.Int32 count

the number of characters to retrieve before the text range

Returns
Type Description
System.String

the text before the range

Implements

System.IDisposable
In This Article
Back to top Generated by DocFX