Get a Highlights object based on an array of character ranges
Highlights is used to store the necessary information and perform certain
tasks in accordance with Adobe's Highlight standard, whose details can be
found at:
http://partners.adobe.com/public/developer/en/pdf/HighlightFileFormat.pdf
In a nutshell, the Highlights class maintains a set of highlights.
Each highlight contains three pieces of information:
page: the number of the page this Highlight is on;
position: the start position (text offset) of this Highlight;
length: the length of this Highlight.
Possible use case scenarios for Highlights include:
-
Load a Highlight file (in XML format) and highlight the corresponding
texts in the viewer (e.g., if the viewer is implemented using PDFViewCtrl,
it can be achieved simply by calling PDFViewCtrl::SelectByHighlights()
method);
-
Save the Highlight information (e.g., constructed by the TextSearch
class) to an XML file for external uses.
Note:
-
The Highlights class does not maintain the corresponding PDF document for
its highlights. It is the user's responsibility to match them up.
-
The Highlights class ensures that each highlight it maintains is
unique (no two highlights have the same page, position and length values).
-
The current implementation of Highlights only supports the 'Characters'
encoding for 'units' as described in the format; the 'words' encoding is
not supported at this point.
Inheritance Hierarchy
Namespace:
pdftron.PDF
Assembly:
pdftron (in pdftron.dll) Version: 255.255.255.255
Syntax public sealed class Highlights : IClosable
Public NotInheritable Class Highlights
Implements IClosable
public ref class Highlights sealed : IClosable
pdftron.PDF.Highlights = function();
Type.createClass(
'pdftron.PDF.Highlights',
null,
Windows.Foundation.IClosable);
Return Value
Type:
a Highlights object containing the selected characters
The Highlights type exposes the following members.
Constructors Methods
| Name | Description |
---|
| Add | Add extra Highlight information into the class.
|
| Begin | Rewind the internal pointer to the first highlight.
|
| Clear | Clear the current Highlight information in the class. |
| Close | |
| Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
| GetCurrentPageNumber | Get the page number of the current highlight.
|
| GetCurrentQuads | Get the corresponding quadrangles of the current highlight.
|
| GetCurrentTextRange | Get a TextRange object that represents the current highlight. |
| GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
| GetType | Gets the Type of the current instance. (Inherited from Object.) |
| HasNext | Query if there is any subsequent highlight after the current highlight.
|
| Load | Load the Highlight information from a file. Note that the
pre-existing Highlight information is discarded.
|
| LoadAsync |
Loads the Highlight information from a filter. Note that the pre-existing Highlight information will be
discarded.
|
| Next | Move the current highlight to the next highlight. |
| Save | Save the current Highlight information in the class to a file.
|
| SaveAsync |
Save the current Highlight information in the class to a filter.
|
| SaveToString | Save the current Highlight information in the class to an XML string.
|
| ToString | Returns a string that represents the current object. (Inherited from Object.) |
TopRemarks For a sample code, please take a look at the TextSearchTest sample project.
See Also