java.lang.Object | |
↳ | com.pdftron.pdf.Highlights |
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:
Possible use case scenarios for Highlights include:
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 TextSearch sample project.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Highlights()
Instantiate default highlights.
| |||||||||||
Highlights(long other_impl) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
add(Highlights hlts)
Add extra Highlight information into the class.
| ||||||||||
void |
begin(PDFDoc doc)
Rewind the internal pointer to the first highlight.
| ||||||||||
void |
clear()
Clear the current Highlight information in the class.
| ||||||||||
void |
close()
Frees the native memory of the object.
| ||||||||||
void |
destroy()
Frees the native memory of the object.
| ||||||||||
int |
getCurrentPageNumber()
Get the page number of the current highlight.
| ||||||||||
double[] |
getCurrentQuads()
Get the corresponding quadrangles of the current highlight.
| ||||||||||
TextRange |
getCurrentTextRange()
Get a
TextRange object that represents the current highlight. | ||||||||||
boolean |
hasNext()
Query if there is any subsequent highlight after the current highlight.
| ||||||||||
void |
load(String file_name)
Load the Highlight information from a file.
| ||||||||||
void |
next()
Move the current highlight to the next highlight.
| ||||||||||
void |
save(String file_name)
Save the current Highlight information in the class to a file.
| ||||||||||
String |
saveToString()
Save the current Highlight information in the class to an XML string.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
java.lang.AutoCloseable
|
Instantiate default highlights.
Add extra Highlight information into the class.
hlts | the Highlights of which the Highlight information is to be added. |
---|
Rewind the internal pointer to the first highlight.
Note: the PDF document can be a dummy document unless getCurrentQuads()
is to be called.
doc | the PDF document to which the highlights correspond. |
---|
Clear the current Highlight information in the class.
Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.
Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.
Get the page number of the current highlight.
Get the corresponding quadrangles of the current highlight.
Note: 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.
Get a TextRange
object that represents the current highlight.
Query if there is any subsequent highlight after the current highlight.
true
, if there is subsequent highlight
Load the Highlight information from a file. Note that the pre-existing Highlight information is discarded.
file_name | the name of the file to load from. |
---|
Move the current highlight to the next highlight.
Save the current Highlight information in the class to a file.
file_name | the name of the file to save to. |
---|
Save the current Highlight information in the class to an XML string.