Class PDFNet.Highlights
PDFNet.Highlights
Constructor Attributes | Constructor Name and Description |
---|---|
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.
|
Method Attributes | Method Name and Description |
---|---|
add(hlts)
Add highlights.
|
|
assign()
Copy Constructor
|
|
begin(doc)
Rewind the internal pointer to the first highlight.
|
|
clear()
Clear the current Highlight information in the class.
|
|
copyCtor()
Assignment operator.
|
|
<static> |
PDFNet.Highlights.create()
Constructor and destructor.
|
destroy()
Frees the native memory of the object.
|
|
Get the page number of the current highlight.
|
|
Retrieves an array of Quads (each quad contains 4 points) representing the regions that were
highlighted.
|
|
hasNext()
Query if there is any subsequent highlight after the current highlight.
|
|
load(file_name)
Load the Highlight information from a file.
|
|
next()
Move the current highlight to the next highlight.
|
|
save(file_name)
Save the current Highlight information in the class to a file.
|
Class Detail
PDFNet.Highlights(id)
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.
For a sample code, please take a look at the TextSearchTest sample project.
- Parameters:
- id
Method Detail
add(hlts)
Add highlights.
- Parameters:
- {Highlights} hlts
- the Highlights instance containing the highlights to be added.
{Highlights}
assign()
Copy Constructor
- Returns:
- {Highlights} A promise that resolves to an object of type: "Highlights" (generated documentation)
begin(doc)
Rewind the internal pointer to the first highlight.
- Parameters:
- {PDFDoc} doc
- the PDF document to which the highlights correspond.
clear()
Clear the current Highlight information in the class.
{Highlights}
copyCtor()
Assignment operator.
- Returns:
- {Highlights} A promise that resolves to an object of type: "Highlights" (generated documentation)
<static>
{Highlights}
PDFNet.Highlights.create()
Constructor and destructor.
- Returns:
- {Highlights} A promise that resolves to an object of type: "Highlights" (generated documentation)
destroy()
Frees the native memory of the object.
{number}
getCurrentPageNumber()
Get the page number of the current highlight.
- Returns:
- {number} A promise that resolves to an object of type: "number" (generated documentation)
{number}
getCurrentQuads()
Retrieves an array of Quads (each quad contains 4 points) representing the regions that were
highlighted.
- Returns:
- {number} A promise that resolves to an object of type: "number" (generated documentation)
{[ERROR]}
hasNext()
Query if there is any subsequent highlight after the current highlight.
- Returns:
- {[ERROR]} A promise that resolves to an unknown type (generated documentation)
load(file_name)
Load the Highlight information from a file. Note that the
pre-existing Highlight information is discarded.
- Parameters:
- {string} file_name
- the name of the file to load from.
next()
Move the current highlight to the next highlight.
save(file_name)
Save the current Highlight information in the class to a file.
- Parameters:
- {string} file_name
- the name of the file to save to.