Loading...
Searching...
No Matches
pdftron::PDF::TextRange Class Reference

#include <TextRange.h>

Public Member Functions

 TextRange ()
 ~TextRange ()
 TextRange (const TextRange &tr)
TextRangeoperator= (const TextRange &tr)
int GetPageNumber () const
std::vector< QuadPointGetQuads () 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 TextRangeCreateInternal (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

◆ TextRange() [1/3]

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

Constructor and destructor.

◆ ~TextRange()

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

◆ TextRange() [2/3]

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

Copy constructor.

◆ TextRange() [3/3]

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

Definition at line 104 of file TextRange.h.

Member Function Documentation

◆ CreateInternal()

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

◆ Destroy()

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

Frees the native memory of the object.

◆ GetHandleInternal()

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

◆ GetPageNumber()

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

Get the page number of the text range.

◆ GetQuads() [1/2]

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.

◆ GetQuads() [2/2]

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

◆ GetText()

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

Get the Unicode string content of the text range.

Returns
the text within the range

◆ GetTextAfter()

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

Get the Unicode string content immediately after the text range.

Parameters
countthe number of characters to retrieve before the text range
Returns
the text after the range

◆ GetTextBefore()

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

Get the Unicode string content immediately before the text range.

Parameters
countthe number of characters to retrieve before the text range
Returns
the text before the range

◆ operator=()

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

Assignment operator.

Member Data Documentation

◆ mp_textrange

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: