Show / Hide Table of Contents

# Class Highlights

Get a Highlights object based on an array of character ranges

##### Inheritance

object
Highlights

##### Implements

IDisposable

##### Inherited Members

object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

###### Namespace: pdftron.PDF

###### Assembly: PDFNet.dll

##### Syntax

    public class Highlights : IDisposable

##### Remarks

For a sample code, please take a look at the TextSearchTest sample project.

### Constructors

#### Highlights()

Creates a default `Highlights` object

##### Declaration

    public Highlights()

#### Highlights(Highlights)

##### Declaration

    public Highlights(Highlights hlts)

##### Parameters

Type | Name | Description
--- | --- | ---
Highlights | hlts |

### Methods

#### Add(Highlights)

##### Declaration

    public void Add(Highlights hlts)

##### Parameters

Type | Name | Description
--- | --- | ---
Highlights | hlts |

#### Begin(PDFDoc)

Rewind the internal pointer to the first highlight.

##### Declaration

    public void Begin(PDFDoc doc)

##### Parameters

Type | Name | Description
--- | --- | ---
PDFDoc | doc | the PDF document to which the highlights correspond.

##### Remarks

the PDF document can be a dummy document unless getCurrentQuads() is to be called.

#### Clear()

Clear the current Highlight information in the class.

##### Declaration

    public void Clear()

#### Dispose()

Releases all resources used by the Highlights

##### Declaration

    public override sealed void Dispose()

#### Dispose(bool)

##### Declaration

    [HandleProcessCorruptedStateExceptions]
    protected virtual void Dispose(bool A_0)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | A_0 |

#### ~Highlights()

##### Declaration

    protected ~Highlights()

#### GetCurrentPageNumber()

Get the page number of the current highlight.

##### Declaration

    public int GetCurrentPageNumber()

##### Returns

Type | Description
--- | ---
int | the current page number

#### GetCurrentQuads()

Get the corresponding quadrangles of the current highlight.

##### Declaration

    public double[] GetCurrentQuads()

##### Returns

Type | Description
--- | ---
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.

#### GetCurrentTextRange()

Get a `TextRange` object that represents the current highlight.

##### Declaration

    public TextRange GetCurrentTextRange()

##### Returns

Type | Description
--- | ---
TextRange | the current text range

#### HasNext()

Query if there is any subsequent highlight after the current highlight.

##### Declaration

    public bool HasNext()

##### Returns

Type | Description
--- | ---
bool | true, if successful

#### Load(string)

Load the Highlight information from a file. Note that the pre-existing Highlight information is discarded.

##### Declaration

    public void Load(string file_name)

##### Parameters

Type | Name | Description
--- | --- | ---
string | file_name | the name of the file to load from.

#### Next()

Move the current highlight to the next highlight.

##### Declaration

    public void Next()

#### Save(string)

Save the current Highlight information in the class to a file.

##### Declaration

    public void Save(string file_name)

##### Parameters

Type | Name | Description
--- | --- | ---
string | file_name | the name of the file to save to.

#### SaveToString()

Save the current Highlight information in the class to an XML string.

##### Declaration

    public string SaveToString()

##### Returns

Type | Description
--- | ---
string | the highlight XML file contents as a string

### Implements

IDisposable