DL Logo

PDTextSelect Typedefs

PDResTree

Header: PDBasicExpT.h:155

Description

A selection of text on a single page that may contain more than one disjoint group of words. A text selection is specified by one or more ranges of text, with each range containing the word numbers of the selected words. Each range specifies a start and end word, where "start" is the first of a series of selected words and "end" is the first word not in the series.

Syntax

typedef struct _t_PDResTree *PDResTree;

PDTextSelect

Header: PDBasicExpT.h:131

Description

A pointer to a PDTextSelect struct.

Syntax

typedef struct _t_PDTextSelect *PDTextSelect;

Returned From

Used By

PDTextSelect Callback Signatures

PDTextSelectEnumQuadProc

Header: PDExpT.h:3161

Description

A callback for PDTextSelectEnumQuads(). It is called once for each quad in a text selection.

Syntax

ASBool PDTextSelectEnumQuadProc(void *procObj, ASInt32 page, ASFixedQuad *quad);

Parameters

procObj
IN/OUT User-supplied data that was passed in the call to PDTextSelectEnumQuads().
page
IN/OUT The page on which the text selection is located.
quad
IN/OUT The quad being enumerated.

Returns

true to continue enumeration, false to halt enumeration.

Used By

PDTextSelectEnumRTFTextProc

Header: PDExpT.h:3186

Syntax

ASBool PDTextSelectEnumRTFTextProc(void *procObj, PDFont font, ASFixed size, PDColorValue color, char *text, ASUns32 rtfCntFlag, ASInt32 textLen);

PDTextSelectEnumTextProc

Header: PDExpT.h:3181

Description

A callback for PDTextSelectEnumText() and PDTextSelectEnumTextUCS(). It is called once for each text run (which is text in the same font, size, color, and on the same line) in a text selection.

Syntax

ASBool PDTextSelectEnumTextProc(void *procObj, PDFont font, ASFixed size, PDColorValue color, char *text, ASInt32 textLen);

Parameters

procObj
IN/OUT User-supplied data that was passed in the call to PDTextSelectEnumText() or PDTextSelectEnumTextUCS().
font
IN/OUT The text's font.
size
IN/OUT The text's size in points.
color
IN/OUT The text's color.
text
IN/OUT The text in the current run. This string is not necessarily NULL-terminated.
textLen
IN/OUT The number of bytes in text.

Returns

true to continue enumeration, false to halt enumeration.

Used By

PDTextSelect Structures

_t_HiliteEntry

Header: PDExpT.h:3113

Description

A data structure representing a single entry (the starting location and length) in a highlight list.

Syntax

struct _t_HiliteEntry {
PDCharOffset offset;
PDCharOffset length;
} HiliteEntry;

Used By

_t_PDTextSelectRange

Header: PDExpT.h:3138

Description

A data structure used to specify a range of text in a text selection.

Use 0 for ofsStart and ofsEnd for whole-word selections. Nonzero values for ofsStart and ofsEnd are supported by PDText but are currently ignored by the Acrobat viewer's user interface code (which highlights only whole-word selections). If ofsEnd is 0, end is the first word not selected.

Syntax

struct _t_PDTextSelectRange {
ASInt32 start;
A word containing the start of the selection.
ASInt32 end;
A word containing the end of the selection.
ASInt32 ofsStart;
An offset into the word at the start of the selection.
ASInt32 ofsEnd;
An offset into the word at the end of the selection.
} PDTextSelectRangeRec, *PDTextSelectRange;

Used By

PDTextSelect Functions

PDTextSelectCreatePageHilite

Header: PDProcs.h:4627

Description

Creates a text selection from a page and a list of highlights specified as character offsets from the start of the page. Character offsets are a well-defined quantity in the PDF file, and are therefore stable against revisions of the word-finding algorithm, which makes them a good way to isolate yourself from changes in the algorithm.

This method does not highlight the text selection. That occurs when you pass the PDTextSelect returned by this method to AVDocSetSelection().

Note: As is the case with the Acrobat viewer, the text selection is always of whole words, not part of words.

Syntax

PDTextSelect PDTextSelectCreatePageHilite(PDPage page, HiliteEntry *hList, ASInt32 listLen);

Parameters

page
The page on which the highlights appear.
hList
A pointer to an array of highlight entries. If the length field of a HiliteEntry is 0, the entire word is highlighted. hList should not contain multiple instances of the same highlight; the display appearance is undefined when it does.
listLen
The number of highlight entries in hList.

Returns

The newly created text selection.

PDTextSelectCreatePageHiliteEx

Header: PDProcs.h:8229

Description

Adds the WFVersion parameter to PDTextSelectCreatePageHilite(). It is the same as PDTextSelectCreatePageHilite(), but it creates a WordFinder using the specified version number. It is intended to be used by plug-ins that want to do text highlighting with previous versions of the word finder algorithm.

Syntax

PDTextSelect PDTextSelectCreatePageHiliteEx(PDPage page, HiliteEntry *hList, ASInt32 listLen, ASInt16 WFVersion);

Parameters

page
The page on which the highlights appear.
hList
A pointer to an array of highlight entries. If the length field of a HiliteEntry is 0, the entire word is highlighted. hList should not contain multiple instances of the same highlight; the display appearance is undefined when it does.
listLen
The number of highlight entries in hList.
WFVersion
The WordFinder version:
Annotation
Use
To obtain the latest available version.
Version used for Acrobat 3.x, 4.x.
Available in Acrobat 5.0 without Accessibility enabled. Includes some improved word-piecing algorithms.
For Acrobat 5.0 with Accessibility enabled. Includes advanced word-ordering algorithms in addition to improved word-piecing algorithms.

Returns

The newly created text selection.

PDTextSelectCreateRanges

Header: PDProcs.h:4716

Description

Creates a text selection from one or more ranges.

This method does not highlight the text selection. That occurs when you pass the PDTextSelect returned by this method to AVDocSetSelection().

Syntax

PDTextSelect PDTextSelectCreateRanges(PDPage page, PDTextSelectRange range, ASInt32 rangeCount);

Parameters

page
IN/OUT The page on which the text appears.
range
IN/OUT A pointer to an array of ranges that are used to create a text selection. Each array element is a PDTextSelectRange structure.
rangeCount
IN/OUT The number of ranges in range.

Returns

A text selection created from the specified ranges.

PDTextSelectCreateRangesEx

Header: PDProcs.h:8298

Description

Adds the WFVersion parameter to PDTextSelectCreateRanges(). It is the same as PDTextSelectCreateRanges() but it creates a WordFinder using the specified version number. It is intended to be used by plug-ins that want to do text highlighting with previous versions of the word finder algorithm.

Syntax

PDTextSelect PDTextSelectCreateRangesEx(PDPage page, PDTextSelectRange range, ASInt32 rangeCount, ASInt16 WFVersion);

Parameters

page
IN/OUT The page on which the text appears.
range
IN/OUT A pointer to an array of ranges that are used to create a text selection. Each array element is a PDTextSelectRange structure.
rangeCount
IN/OUT The number of ranges in range.
WFVersion
IN/OUT The WordFinder version:
Annotation
Use
To obtain latest the available version.
Version used for Acrobat 3.x, 4.x.
Available in Acrobat 5.0 without Accessibility enabled. Includes some improved word-piecing algorithms.
For Acrobat 5.0 with Accessibility enabled. Includes advanced word-ordering algorithms in addition to improved word-piecing algorithms.

Returns

A text selection created from the specified ranges.

PDTextSelectCreateWordHilite

Header: PDProcs.h:4659

Description

Creates a text selection from a list of highlights specified as word offsets from the start of the page. Word offsets are not well-defined in PDF files, but are calculated by the word-finding algorithm. As a result, word offsets will, in general, differ in different versions of the word-finding algorithm. If you choose to store word offsets, you must also store the version of the word-finding algorithm from which they are obtained using PDWordFinderGetLatestAlgVersion().

This method does not highlight the text selection. That occurs when you pass the PDTextSelect returned by this method to AVDocSetSelection().

Syntax

PDTextSelect PDTextSelectCreateWordHilite(PDPage page, HiliteEntry *hList, ASInt32 listLen);

Parameters

page
The page on which the highlights appear.
hList
A pointer to an array of highlight entries. hList should not contain multiple instances of the same highlight; the display appearance is undefined when it does.
listLen
The number of highlight entries in hList.

Returns

The newly created text selection.

PDTextSelectCreateWordHiliteEx

Header: PDProcs.h:8262

Description

Adds the WFVersion parameter to PDTextSelectCreateWordHilite().

Syntax

PDTextSelect PDTextSelectCreateWordHiliteEx(PDPage page, HiliteEntry *hList, ASInt32 listLen, ASInt16 WFVersion);

Parameters

page
The page on which the highlights appear.
hList
A pointer to an array of highlight entries. hList should not contain multiple instances of the same highlight; the display appearance is undefined when it does.
listLen
The number of highlight entries in hList.
WFVersion
The WordFinder version:
Annotation
Use
To obtain the latest available version.
Version used for Acrobat 3.x, 4.x.
Available in Acrobat 5.0 without Accessibility enabled. Includes some improved word-piecing algorithms.
For Acrobat 5.0 with Accessibility enabled. Includes advanced word-ordering algorithms in addition to improved word-piecing algorithms.

Returns

The newly created text selection.

PDTextSelectDestroy

Header: PDProcs.h:4517

Description

Deletes a text selection object (the text on the page remains unchanged). Do not use this method to destroy a text selection that was passed to AVDocSetSelection(); such text selections are automatically destroyed when a new selection is made or the selection is cleared.

Syntax

void PDTextSelectDestroy(PDTextSelect text);

Parameters

text
IN/OUT The text selection to destroy.

PDTextSelectEnumQuads

Header: PDProcs.h:4537

Description

Enumerates the bounding quads in a text selection. proc is called for each quad. If a word is on a curve it may have a quad for each character, but it may also have two characters per quad. An upright word will have only one quad for all the characters. An upright hyphenated word will have two quads.

Related Methods

Syntax

void PDTextSelectEnumQuads(PDTextSelect text, PDTextSelectEnumQuadProc proc, void *procObj);

Parameters

text
IN/OUT The text selection whose bounding quads are enumerated.
proc
IN/OUT A user-supplied callback to call for each quad. Enumeration halts if proc returns false.
procObj
IN/OUT A user-supplied data to pass to proc each time it is called.

Exceptions

PDTextSelectEnumText

Header: PDProcs.h:4563

Description

Enumerates the strings of the specified text select object, calling a procedure for each string. A string, in this context, is the set of like-styled characters within a word. It is never larger than a single word. A word containing three styles is enumerated as three strings. There is no guaranteed correspondence between these strings and the actual show strings in the PDF file. Acrobat enumerates text in the order it appears in the PDF file, which is often not the same as the order in which a person would read the text.

Related Methods

Syntax

void PDTextSelectEnumText(PDTextSelect text, PDTextSelectEnumTextProc proc, void *procObj);

Parameters

text
IN/OUT The text selection whose strings are enumerated.
proc
IN/OUT A user-supplied callback to call for each string in the text object. Enumeration ends if proc returns false.
procObj
IN/OUT User-supplied data to pass to proc each time it is called.

Exceptions

PDTextSelectEnumTextUCS

Header: PDProcs.h:8031

Description

Same as PDTextSelectEnumText(), except the output is forced to UCS.

Syntax

void PDTextSelectEnumTextUCS(PDTextSelect textP, PDTextSelectEnumTextProc proc, void *procData);

Parameters

textP
IN/OUT The text selection whose strings are enumerated.
proc
IN/OUT A user-supplied callback to call for each string in the text object. Enumeration ends if proc returns false.
procData
IN/OUT User-supplied data to pass to proc each time it is called.

Exceptions

PDTextSelectGetBoundingRect

Header: PDProcs.h:4593

Description

Gets a text selection's bounding rectangle. This is the smallest rectangle that completely encloses all characters in the selection.

Syntax

void PDTextSelectGetBoundingRect(PDTextSelect text, ASFixedRect *boundRectP);

Parameters

text
IN/OUT The text selection whose bounding rectangle is determined.
boundRectP
IN/OUT (Filled by the method) A pointer to the text selection's bounding rectangle, specified in user space coordinates.

PDTextSelectGetPage

Header: PDProcs.h:4576

Description

Gets the page number of a text selection's page.

Syntax

ASInt32 PDTextSelectGetPage(PDTextSelect text);

Parameters

text
IN/OUT The text selection whose page number is obtained.

Returns

The page number of the text selection's page.

PDTextSelectGetRange

Header: PDProcs.h:4678

Description

Extracts the range specified by index from a text selection. Use PDTextSelectGetRangeCount() to determine the number of ranges in a text selection.

Syntax

void PDTextSelectGetRange(PDTextSelect textP, ASInt32 index, PDTextSelectRange range);

Parameters

textP
IN/OUT The text selection from which a range is extracted.
index
IN/OUT The index of the range to extract from textP.
range
IN/OUT (Filled by the method) A pointer to a structure that contains the specified range.

PDTextSelectGetRangeCount

Header: PDProcs.h:4692

Description

Gets the number of ranges in a text selection. Use PDTextSelectGetRange() to extract a single range from a text selection.

Syntax

ASInt32 PDTextSelectGetRangeCount(PDTextSelect textP);

Parameters

textP
IN/OUT The text selection whose range count is obtained.

Returns

The number of ranges in the text selection.