Layer | PD_Layer |
Object | PDTextSelect |
PDTextSelect objects represent a selection of text on a single page, and may contain more than one disjointed group of words. A text selection contains one or more ranges of text, with each range containing the word numbers (in PDF order, as returned by PDWordFinderEnumWords() or PDWordFinderAcquireWordList()) of the selected words. Each range has a start word (the first word in the series) and an end word (the first word not in the series).
PDTextSelect methods are useful for:
You can manipulate text selections using the PDTextSelectRangeRec data structure. This structure contains two start/end pairs:
To create a selection, plug-ins can:
While character offsets are well-defined quantities in a PDF file, word numbers are calculated by the PDWordFinder algorithm and, therefore, may change as the word finder algorithm is improved in future versions. Because of this, long-term storage of selection information (for example, in custom annotations) is safer if done with page-relative character offsets and PDTextSelectCreatePageHilite().
Once a plug-in creates a text selection, it can make it the current selection using AVDocSetSelection().
Define | ||
---|---|---|
PDTextSelectCreatePageHilite | ||
PDTextSelectCreateRanges | ||
PDTextSelectCreateWordHilite | ||
PDTextSelectEnumQuads | ||
PDTextSelectEnumText | ||
PDTextSelectGetBoundingRect |
Typedef | ||
---|---|---|
PDTextSelect
A pointer to a PDTextSelect struct.
|
||
PDTextSelectRange | ||
PDTextSelectRangeRec |
Structure | ||
---|---|---|
_t_PDTextSelectRange
A data structure used to specify a range of text in a text selection.
|
Callback | ||
---|---|---|
PDTextSelectEnumQuadProc
A callback for PDTextSelectEnumQuads(). It is called once for each quad in a text selection.
|
||
PDTextSelectEnumRTFTextProc | ||
PDTextSelectEnumTextProc
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.
|
Method | ||
---|---|---|
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.
|
||
PDTextSelect PDTextSelectCreatePageHiliteEx(PDPage page, HiliteEntry* hList, ASInt32 listLen, ASInt16 WFVersion)
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.
|
||
Creates a text selection from one or more ranges.
|
||
PDTextSelect PDTextSelectCreateRangesEx(PDPage page, PDTextSelectRange range, ASInt32 rangeCount, ASInt16 WFVersion)
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.
|
||
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().
|
||
PDTextSelect PDTextSelectCreateWordHiliteEx(PDPage page, HiliteEntry* hList, ASInt32 listLen, ASInt16 WFVersion)
Adds the WFVersion parameter to PDTextSelectCreateWordHilite().
|
||
void PDTextSelectDestroy(PDTextSelect text)
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.
|
||
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.
|
||
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.
|
||
Same as PDTextSelectEnumText(), except the output is forced to UCS.
|
||
Gets a text selection's bounding rectangle. This is the smallest rectangle that completely encloses all characters in the selection.
|
||
ASInt32 PDTextSelectGetPage(PDTextSelect text)
Gets the page number of a text selection's page.
|
||
Extracts the range specified by index from a text selection. Use PDTextSelectGetRangeCount() to determine the number of ranges in a text selection.
|
||
ASInt32 PDTextSelectGetRangeCount(PDTextSelect textP)
Gets the number of ranges in a text selection. Use PDTextSelectGetRange() to extract a single range from a text selection.
|
PDTextSelectCreatePageHilite |
Product availability: PDFL |
Platform availability: Macintosh, Windows, UNIX |
#define PDTextSelectCreatePageHilite PDTextSelectCreatePageHiliteHost
File: PDCalls.h |
Line: 161 |
PDTextSelectCreateRanges |
Product availability: PDFL |
Platform availability: Macintosh, Windows, UNIX |
#define PDTextSelectCreateRanges PDTextSelectCreateRangesHost
File: PDCalls.h |
Line: 163 |
PDTextSelectCreateWordHilite |
Product availability: PDFL |
Platform availability: Macintosh, Windows, UNIX |
#define PDTextSelectCreateWordHilite PDTextSelectCreateWordHiliteHost
File: PDCalls.h |
Line: 162 |
PDTextSelectEnumQuads |
Product availability: PDFL |
Platform availability: Macintosh, Windows, UNIX |
#define PDTextSelectEnumQuads PDTextSelectEnumQuadsHost
File: PDCalls.h |
Line: 158 |
PDTextSelectEnumText |
Product availability: PDFL |
Platform availability: Macintosh, Windows, UNIX |
#define PDTextSelectEnumText PDTextSelectEnumTextHost
File: PDCalls.h |
Line: 159 |
PDTextSelectGetBoundingRect |
Product availability: PDFL |
Platform availability: Macintosh, Windows, UNIX |
#define PDTextSelectGetBoundingRect PDTextSelectGetBoundingRectHost
File: PDCalls.h |
Line: 160 |
PDTextSelect |
Product availability: All |
Platform availability: All |
typedef struct _t_PDTextSelect* PDTextSelect;
A pointer to a PDTextSelect struct
.
File: PDBasicExpT.h |
Line: 120 |
PDTextSelectRange |
Product availability: All |
Platform availability: All |
typedef _t_PDTextSelectRange PDTextSelectRange;
File: PDExpT.h |
Line: 3080 |
PDTextSelectRangeRec |
Product availability: All |
Platform availability: All |
typedef _t_PDTextSelectRange PDTextSelectRangeRec;
File: PDExpT.h |
Line: 3080 |
_t_PDTextSelectRange |
Product availability: All |
Platform availability: All |
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.
See Also
File: PDExpT.h |
Line: 3071 |
start | A word containing the start of the selection. |
|
end | A word containing the end of the selection. |
|
ofsStart | ||
ofsEnd |
PDTextSelectEnumQuadProc |
Product availability: All |
Platform availability: All |
ASBool (*PDTextSelectEnumQuadProc)(void *procObj, ASInt32 page, ASFixedQuad *quad)
A callback for PDTextSelectEnumQuads(). It is called once for each quad in a text selection.
See Also
File: PDExpT.h |
Line: 3095 |
PDTextSelectEnumRTFTextProc |
Product availability: All |
Platform availability: All |
ASBool (*PDTextSelectEnumRTFTextProc)(void *procObj, PDFont font, ASFixed size, PDColorValue color, char *text, ASUns32 rtfCntFlag, ASInt32 textLen)
File: PDExpT.h |
Line: 3120 |
PDTextSelectEnumTextProc |
Product availability: All |
Platform availability: All |
ASBool (*PDTextSelectEnumTextProc)(void *procObj, PDFont font, ASFixed size, PDColorValue color, char *text, ASInt32 textLen)
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.
See Also
File: PDExpT.h |
Line: 3116 |
PDTextSelectCreatePageHilite | () |
Product availability: All |
Platform availability: All |
PDTextSelect PDTextSelectCreatePageHilite(PDPage page, HiliteEntry* hList, ASInt32 listLen)
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().
Parameters
page — | The page on which the highlights appear. |
|
hList — | A pointer to an array of highlight entries. If the |
|
listLen — | The number of highlight entries in |
The newly created text selection. |
See Also
Since
File: PDProcs.h |
Line: 4539 |
PDTextSelectCreatePageHiliteEx | () |
Product availability: All |
Platform availability: All |
PDTextSelect PDTextSelectCreatePageHiliteEx(PDPage page, HiliteEntry* hList, ASInt32 listLen, ASInt16 WFVersion)
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.
Parameters
page — | The page on which the highlights appear. |
|||||||||||
hList — | A pointer to an array of highlight entries. If the |
|||||||||||
listLen — | The number of highlight entries in |
|||||||||||
WFVersion — | The WordFinder version:
|
The newly created text selection. |
See Also
Since
File: PDProcs.h |
Line: 8076 |
PDTextSelectCreateRanges | () |
Product availability: All |
Platform availability: All |
PDTextSelect PDTextSelectCreateRanges(PDPage page, PDTextSelectRange range, ASInt32 rangeCount)
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().
Parameters
page — | ||
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. |
See Also
Since
File: PDProcs.h |
Line: 4626 |
PDTextSelectCreateRangesEx | () |
Product availability: All |
Platform availability: All |
PDTextSelect PDTextSelectCreateRangesEx(PDPage page, PDTextSelectRange range, ASInt32 rangeCount, ASInt16 WFVersion)
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.
Parameters
page — | ||||||||||||
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:
|
See Also
Since
File: PDProcs.h |
Line: 8143 |
PDTextSelectCreateWordHilite | () |
Product availability: All |
Platform availability: All |
PDTextSelect PDTextSelectCreateWordHilite(PDPage page, HiliteEntry* hList, ASInt32 listLen)
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().
Parameters
page — | The page on which the highlights appear. |
|
hList — | A pointer to an array of highlight entries. |
|
listLen — | The number of highlight entries in |
The newly created text selection. |
See Also
Since
File: PDProcs.h |
Line: 4570 |
PDTextSelectCreateWordHiliteEx | () |
Product availability: All |
Platform availability: All |
PDTextSelect PDTextSelectCreateWordHiliteEx(PDPage page, HiliteEntry* hList, ASInt32 listLen, ASInt16 WFVersion)
Adds the WFVersion
parameter to PDTextSelectCreateWordHilite().
Parameters
page — | The page on which the highlights appear. |
|||||||||||
hList — | A pointer to an array of highlight entries. |
|||||||||||
listLen — | The number of highlight entries in |
|||||||||||
WFVersion — | The WordFinder version:
|
The newly created text selection. |
See Also
Since
File: PDProcs.h |
Line: 8108 |
PDTextSelectDestroy | () |
Product availability: All |
Platform availability: All |
void PDTextSelectDestroy(PDTextSelect text)
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.
Parameters
text — | IN/OUT The text selection to destroy. |
See Also
Since
File: PDProcs.h |
Line: 4429 |
PDTextSelectEnumQuads | () |
Product availability: All |
Platform availability: All |
void PDTextSelectEnumQuads(PDTextSelect text, PDTextSelectEnumQuadProc proc, void* procObj)
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.
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 |
|
procObj — | IN/OUT A user-supplied data to pass to |
See Also
Exceptions
Since
File: PDProcs.h |
Line: 4449 |
PDTextSelectEnumText | () |
Product availability: All |
Platform availability: All |
void PDTextSelectEnumText(PDTextSelect text, PDTextSelectEnumTextProc proc, void* procObj)
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.
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 |
|
procObj — | IN/OUT User-supplied data to pass to |
See Also
Exceptions
Since
File: PDProcs.h |
Line: 4475 |
PDTextSelectEnumTextUCS | () |
Product availability: All |
Platform availability: All |
void PDTextSelectEnumTextUCS(PDTextSelect textP, PDTextSelectEnumTextProc proc, void* procData)
Same as PDTextSelectEnumText(), except the output is forced to UCS.
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 |
|
procData — | IN/OUT User-supplied data to pass to |
See Also
Exceptions
Since
File: PDProcs.h |
Line: 7871 |
PDTextSelectGetBoundingRect | () |
Product availability: All |
Platform availability: All |
void PDTextSelectGetBoundingRect(PDTextSelect text, ASFixedRect* boundRectP)
Gets a text selection's bounding rectangle. This is the smallest rectangle that completely encloses all characters in the selection.
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. |
See Also
Since
File: PDProcs.h |
Line: 4505 |
PDTextSelectGetPage | () |
Product availability: All |
Platform availability: All |
ASInt32 PDTextSelectGetPage(PDTextSelect text)
Gets the page number of a text selection's page.
Parameters
text — |
See Also
Since
File: PDProcs.h |
Line: 4488 |
PDTextSelectGetRange | () |
Product availability: All |
Platform availability: All |
void PDTextSelectGetRange(PDTextSelect textP, ASInt32 index, PDTextSelectRange range)
Extracts the range specified by index from a text selection. Use PDTextSelectGetRangeCount() to determine the number of ranges in a text selection.
Parameters
textP — | ||
index — | IN/OUT The index of the range to extract from |
|
range — | IN/OUT (Filled by the method) A pointer to a structure that contains the specified range. |
See Also
Since
File: PDProcs.h |
Line: 4588 |
PDTextSelectGetRangeCount | () |
Product availability: All |
Platform availability: All |
ASInt32 PDTextSelectGetRangeCount(PDTextSelect textP)
Gets the number of ranges in a text selection. Use PDTextSelectGetRange() to extract a single range from a text selection.
Parameters
textP — |
See Also
Since
File: PDProcs.h |
Line: 4602 |