- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
pdftron::PDF::TextRange Class Reference

`#include <TextRange.h>`

## Public Member Functions
| TextRange ()
| ~TextRange ()
| TextRange (const TextRange &tr)
TextRange & | operator= (const TextRange &tr)
int | GetPageNumber () const
std::vector< QuadPoint > | GetQuads () const
int | GetQuads (const double *&quads) const
UString | GetText () const
UString | GetTextBefore (int count) const
UString | GetTextAfter (int count) const
void | Destroy ()
ptrdiff_t | GetHandleInternal ()
| TextRange (TRN_TextRange impl)

## Static Public Member Functions
static TextRange * | CreateInternal (ptrdiff_t impl)

## Public Attributes
TRN_TextRange | mp_textrange

## Detailed Description

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.

Definition at line 28 of file TextRange.h.

## Constructor & Destructor Documentation

pdftron::PDF::TextRange::TextRange | ( |  | ) |

Constructor and destructor.

pdftron::PDF::TextRange::~TextRange | ( |  | ) |

pdftron::PDF::TextRange::TextRange | ( | const TextRange & | tr | ) |

Copy constructor.

pdftron::PDF::TextRange::TextRange | ( | TRN_TextRange | impl | ) |
| inline

Definition at line 104 of file TextRange.h.

## Member Function Documentation

static TextRange* pdftron::PDF::TextRange::CreateInternal | ( | ptrdiff_t | impl | ) |
| static

void pdftron::PDF::TextRange::Destroy | ( |  | ) |

Frees the native memory of the object.

ptrdiff_t pdftron::PDF::TextRange::GetHandleInternal | ( |  | ) |

int pdftron::PDF::TextRange::GetPageNumber | ( |  | ) | const

Get the page number of the text range.

std::vector<QuadPoint> pdftron::PDF::TextRange::GetQuads | ( |  | ) | const

Get the corresponding quadrangles of the text range.

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

Note
  the 'quads' array is owned by the current TextRange and does not need to be explicitly released. 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.

int pdftron::PDF::TextRange::GetQuads | ( | const double *& | quads | ) | const

UString pdftron::PDF::TextRange::GetText | ( |  | ) | const

Get the Unicode string content of the text range.

Returns
  the text within the range

UString pdftron::PDF::TextRange::GetTextAfter | ( | int | count | ) | const

Get the Unicode string content immediately after the text range.

Parameters

  count | the number of characters to retrieve before the text range

Returns
  the text after the range

UString pdftron::PDF::TextRange::GetTextBefore | ( | int | count | ) | const

Get the Unicode string content immediately before the text range.

Parameters

  count | the number of characters to retrieve before the text range

Returns
  the text before the range

TextRange& pdftron::PDF::TextRange::operator= | ( | const TextRange & | tr | ) |

Assignment operator.

## Member Data Documentation

TRN_TextRange pdftron::PDF::TextRange::mp_textrange

Definition at line 102 of file TextRange.h.

The documentation for this class was generated from the following file:

- PDF/TextRange.h