public class PDFTextSelection
extends java.lang.Object
PDFTextSelection
represents the text selected in PDF
operation.
The PDFTextSelection
defines methods to select characters in a
page and related operations.
It can be constructed by the following ways.
Example:
PDFTextSelection selection = PDFTextPage.selectByRange(int, int) PDFTextSelection selection = PDFTextPage.selectByRectangle(final RectF) PDFTextSelection selection = PDFTextLink.getSelection(int) PDFTextSelection selection = PDFTextSearch.getSelection()
PDFPage
,
PDFTextSearch
,
PDFTextLink
,
PDFTextPage
Modifier and Type | Method and Description |
---|---|
int |
countPieces()
Count the number of all rectangular segments in a PDF text selected area.
|
android.graphics.RectF |
getBBox()
Get bounding box(a rectangular area) of a PDF selected text area.
|
java.lang.String |
getChars()
Extract the whole text from a PDF selected text area.
|
Layer[] |
getLayerArray(LayerNode layerNode)
Get a layer array associated with a PDF text selected area.
|
int |
getPieceCharRange(int pieceIndex,
java.lang.Integer start)
Get the index of start character and the count of characters of a
specific segment.
|
android.graphics.RectF |
getPieceRect(int index)
Get rectangular area of a specific segment, based on the result returned
by function
. |
int |
getPieceRotation(int pieceIndex)
Get rotation of the specific segment, based on the result returned by
function
. |
PDFTextSelection |
getVisibleSelection(LayerContext context)
Get a new PDF text selected area of visible content from the current PDF
text selected area.
|
void |
release()
Release all resources allocated for a
PDFTextSelection
handle. |
public int countPieces() throws PDFException
PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public android.graphics.RectF getPieceRect(int index) throws PDFException
countPieces()
.index
- A zero-based index of the segment to be got. Range: from 0 to
(segmentCount - 1).segmentCount
is returned by
function countPieces()
.RectF
object that receives the 4 boundaries(left,
top, right, bottom) of rectangle area.null
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public void release() throws PDFException
PDFTextSelection
handle.PDFException
public android.graphics.RectF getBBox() throws PDFException
Bounding box is the smallest rectangle to enclose the entire selected chars.
RectF
object that receives the 4 boundaries in PDF
page space units(left, bottom, right, top) of the bounding box.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public java.lang.String getChars() throws PDFException
String
object that receives the text.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public int getPieceCharRange(int pieceIndex, java.lang.Integer start) throws PDFException
pieceIndex
- A zero-based index of the segment, of which the character
range to be got. Range: from 0 to (segmentcount - 1).
segmentcount
is returned by function
countPieces()
.start
- An Integer
object that indicates the index of
start character of the segment. -1 means error.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public int getPieceRotation(int pieceIndex) throws PDFException
countPieces()
.pieceIndex
- A zero-based index of the segment, of which the character
range to be got.segmentCount
is returned by function countPieces()
.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException
public Layer[] getLayerArray(LayerNode layerNode) throws PDFException, java.lang.Exception
layerNode
- A LayerNode
object which is encapsulation of PDF layers.Layer
objects array that recevies the group layers.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.java.lang.Exception
PDFException
public PDFTextSelection getVisibleSelection(LayerContext context) throws PDFException
context
- A LayerContext
object which is a PDF layer context.PDFTextSelection
object that receives the new
selected area. Application should call function
release()
to release this.PDFException
- For more exception information please see definitions
PDFException.ERRCODE_XXX
.PDFException