Class PdfiumSdk
-
- All Implemented Interfaces:
public final class PdfiumSdk
-
-
Field Summary
Fields Modifier and Type Field Description private final Integer
currentDpi
private final Map<Integer, Long>
mNativePagesPtr
private final Map<Integer, Long>
mNativeTextPagesPtr
private final Map<Integer, Long>
mNativeSearchHandlePtr
private Long
mNativeDocPtr
private ParcelFileDescriptor
mFileDescriptor
private final Integer
pageCount
private final Meta
documentMeta
private final List<Bookmark>
tableOfContents
-
Constructor Summary
Constructors Constructor Description PdfiumSdk()
-
Method Summary
Modifier and Type Method Description final Integer
getCurrentDpi()
final Map<Integer, Long>
getMNativePagesPtr()
final Map<Integer, Long>
getMNativeTextPagesPtr()
final Map<Integer, Long>
getMNativeSearchHandlePtr()
final Long
getMNativeDocPtr()
final Unit
setMNativeDocPtr(Long mNativeDocPtr)
final ParcelFileDescriptor
getMFileDescriptor()
final Unit
setMFileDescriptor(ParcelFileDescriptor mFileDescriptor)
final Integer
getPageCount()
final Meta
getDocumentMeta()
final List<Bookmark>
getTableOfContents()
final Long
nativeOpenDocument(Integer fd, String password)
final Long
nativeOpenMemDocument(ByteArray data, String password)
final Unit
nativeCloseDocument(Long docPtr)
final Integer
nativeGetPageCount(Long docPtr)
final Long
nativeLoadPage(Long docPtr, Integer pageIndex)
final LongArray
nativeLoadPages(Long docPtr, Integer fromIndex, Integer toIndex)
final Unit
nativeClosePage(Long pagePtr)
final Unit
nativeClosePages(LongArray pagesPtr)
final Integer
nativeGetPageWidthPixel(Long pagePtr, Integer dpi)
final Integer
nativeGetPageHeightPixel(Long pagePtr, Integer dpi)
final Integer
nativeGetPageWidthPoint(Long pagePtr)
final Integer
nativeGetPageHeightPoint(Long pagePtr)
final Integer
nativeGetPageRotation(Long pagePtr)
final Unit
nativeRenderPage(Long pagePtr, Surface surface, Integer dpi, Integer startX, Integer startY, Integer drawSizeHor, Integer drawSizeVer, Boolean renderAnnot)
final Unit
nativeRenderPageBitmap(Long pagePtr, Bitmap bitmap, Integer dpi, Integer startX, Integer startY, Integer drawSizeHor, Integer drawSizeVer, Boolean renderAnnot, Long docPtr)
final String
nativeGetDocumentMetaText(Long docPtr, String tag)
final Long
nativeGetFirstChildBookmark(Long docPtr, Long bookmarkPtr)
final Long
nativeGetSiblingBookmark(Long docPtr, Long bookmarkPtr)
final String
nativeGetBookmarkTitle(Long bookmarkPtr)
final Long
nativeGetBookmarkDestIndex(Long docPtr, Long bookmarkPtr)
final Size
nativeGetPageSizeByIndex(Long docPtr, Integer pageIndex, Integer dpi)
final LongArray
nativeGetPageLinks(Long pagePtr)
final Integer
nativeGetDestPageIndex(Long docPtr, Long linkPtr)
final String
nativeGetLinkURI(Long docPtr, Long linkPtr)
final RectF
nativeGetLinkRect(Long linkPtr)
final Point
nativePageCoordinateToDevice(Long pagePtr, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Double pageX, Double pageY)
final PointF
nativeDeviceCoordinateToPage(Long pagePtr, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Integer deviceX, Integer deviceY)
final Long
nativeLoadTextPage(Long docPtr, Integer pageIndex)
final LongArray
nativeLoadTextPages(Long docPtr, Integer fromIndex, Integer toIndex)
final Unit
nativeCloseTextPage(Long pagePtr)
final Unit
nativeCloseTextPages(LongArray pagesPtr)
final Integer
nativeTextCountChars(Long textPagePtr)
final Integer
nativeTextGetText(Long textPagePtr, Integer start_index, Integer count, ShortArray result)
final Integer
nativeTextGetUnicode(Long textPagePtr, Integer index)
final DoubleArray
nativeTextGetCharBox(Long textPagePtr, Integer index)
final Integer
nativeTextGetCharIndexAtPos(Long textPagePtr, Double x, Double y, Double xTolerance, Double yTolerance)
final Integer
nativeTextCountRects(Long textPagePtr, Integer start_index, Integer count)
final DoubleArray
nativeTextGetRect(Long textPagePtr, Integer rect_index)
final Integer
nativeTextGetBoundedTextLength(Long textPagePtr, Double left, Double top, Double right, Double bottom)
final Integer
nativeTextGetBoundedText(Long textPagePtr, Double left, Double top, Double right, Double bottom, ShortArray arr)
final Long
nativeSearchStart(Long textPagePtr, String query, Boolean matchCase, Boolean matchWholeWord)
final Unit
nativeSearchStop(Long searchHandlePtr)
final Boolean
nativeSearchNext(Long searchHandlePtr)
final Boolean
nativeSearchPrev(Long searchHandlePtr)
final Integer
nativeGetCharIndexOfSearchResult(Long searchHandlePtr)
final Integer
nativeCountSearchResult(Long searchHandlePtr)
final Long
nativeAddTextAnnotation(Long docPtr, Integer pageIndex, String text, IntArray color, IntArray bound)
final Unit
onAnnotationAdded(Integer pageIndex, Long pageNewPtr)
final Unit
onAnnotationUpdated(Integer pageIndex, Long pageNewPtr)
final Unit
onAnnotationRemoved(Integer pageIndex, Long pageNewPtr)
final Unit
newDocument(ParcelFileDescriptor fd)
Create new document from file final Unit
newDocument(ParcelFileDescriptor fileDescriptor, String password)
Create new document from file with password final Long
openPage(Integer pageIndex)
Open page and store native pointer final LongArray
openPage(Integer fromIndex, Integer toIndex)
Open range of pages and store native pointers final Integer
getPageWidth(Integer index)
Get page width in pixels. final Integer
getPageHeight(Integer index)
Get page height in pixels. final Integer
getPageWidthPoint(Integer index)
Get page width in PostScript points (1/72th of an inch).<br></br> This method requires page to be opened. final Integer
getPageHeightPoint(Integer index)
Get page height in PostScript points (1/72th of an inch).<br></br> This method requires page to be opened. final Size
getPageSize(Integer index)
Get size of page in pixels.<br></br> This method does not require given page to be opened. final Integer
getPageRotation(Integer index)
Get the rotation of page<br></br> final Unit
renderPage(Surface surface, Integer pageIndex, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY, Boolean renderAnnot)
Render page fragment on Surface.<br></br> Page must be opened before rendering. final Unit
renderPage(Surface surface, Integer pageIndex, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY)
Render page fragment on Surface.<br></br> Page must be opened before rendering. final Unit
renderPageBitmap(Bitmap bitmap, Integer pageIndex, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY, Boolean renderAnnot)
Render page fragment on Bitmap. This method allows to render annotations.<br></br> Page must be opened before rendering. final Unit
renderPageBitmap(Bitmap bitmap, Integer pageIndex, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY)
Render page fragment on Bitmap. This method allows to render annotations.<br></br> Page must be opened before rendering. final Unit
closeDocument()
Release native resources and opened file final Unit
recursiveGetBookmark(ArrayList<Bookmark> tree, Long bookmarkPtr)
final List<Link>
getPageLinks(Integer pageIndex)
Get all links from given page final Point
mapPageCoordsToDevice(Integer pageIndex, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Double pageX, Double pageY)
Map page coordinates to device screen coordinates final PointF
mapDeviceCoordinateToPage(Integer pageIndex, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Integer deviceX, Integer deviceY)
Convert the screen coordinates of a point to page coordinates. final RectF
mapPageCoordinateToDevice(Integer pageIndex, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, RectF coords)
final Long
prepareTextInfo(Integer pageIndex)
Prepare information about all characters in a page. final LongArray
prepareTextInfo(Integer fromIndex, Integer toIndex)
Prepare information about all characters in a range of pages. final Unit
releaseTextInfo(Integer pageIndex)
Release all resources allocated for a text page information structure. final Unit
releaseTextInfo(Integer fromIndex, Integer toIndex)
Release all resources allocated for a text page information structure. final Long
ensureTextPage(Integer pageIndex)
final Integer
countCharactersOnPage(Integer pageIndex)
final String
extractCharacters(Integer pageIndex, Integer startIndex, Integer length)
Extract unicode text string from the page. final Character
extractCharacter(Integer pageIndex, Integer index)
Get Unicode of a character in a page. final RectF
measureCharacterBox(Integer pageIndex, Integer index)
Get bounding box of a particular character. final Integer
getCharacterIndex(Integer pageIndex, Double x, Double y, Double xTolerance, Double yTolerance)
Get the index of a character at or nearby a certain position on the page final Integer
countTextRect(Integer pageIndex, Integer charIndex, Integer count)
Count number of rectangular areas occupied by a segment of texts. final RectF
getTextRect(Integer pageIndex, Integer rectIndex)
Get a rectangular area from the result generated by FPDFText_CountRects. final String
extractText(Integer pageIndex, RectF rect)
Extract unicode text within a rectangular boundary on the page. final Boolean
validPtr(Long ptr)
final TextSearchContext
newPageSearch(Integer pageIndex, String query, Boolean matchCase, Boolean matchWholeWord)
A handle class for the search context. final Boolean
hasPage(Integer index)
final Boolean
hasTextPage(Integer index)
final Boolean
hasSearchHandle(Integer index)
-
-
Method Detail
-
getCurrentDpi
final Integer getCurrentDpi()
-
getMNativePagesPtr
final Map<Integer, Long> getMNativePagesPtr()
-
getMNativeTextPagesPtr
final Map<Integer, Long> getMNativeTextPagesPtr()
-
getMNativeSearchHandlePtr
final Map<Integer, Long> getMNativeSearchHandlePtr()
-
getMNativeDocPtr
final Long getMNativeDocPtr()
-
setMNativeDocPtr
final Unit setMNativeDocPtr(Long mNativeDocPtr)
-
getMFileDescriptor
final ParcelFileDescriptor getMFileDescriptor()
-
setMFileDescriptor
final Unit setMFileDescriptor(ParcelFileDescriptor mFileDescriptor)
-
getPageCount
final Integer getPageCount()
-
getDocumentMeta
final Meta getDocumentMeta()
-
getTableOfContents
final List<Bookmark> getTableOfContents()
-
nativeOpenDocument
final Long nativeOpenDocument(Integer fd, String password)
-
nativeOpenMemDocument
final Long nativeOpenMemDocument(ByteArray data, String password)
-
nativeCloseDocument
final Unit nativeCloseDocument(Long docPtr)
-
nativeGetPageCount
final Integer nativeGetPageCount(Long docPtr)
-
nativeLoadPage
final Long nativeLoadPage(Long docPtr, Integer pageIndex)
-
nativeLoadPages
final LongArray nativeLoadPages(Long docPtr, Integer fromIndex, Integer toIndex)
-
nativeClosePage
final Unit nativeClosePage(Long pagePtr)
-
nativeClosePages
final Unit nativeClosePages(LongArray pagesPtr)
-
nativeGetPageWidthPixel
final Integer nativeGetPageWidthPixel(Long pagePtr, Integer dpi)
-
nativeGetPageHeightPixel
final Integer nativeGetPageHeightPixel(Long pagePtr, Integer dpi)
-
nativeGetPageWidthPoint
final Integer nativeGetPageWidthPoint(Long pagePtr)
-
nativeGetPageHeightPoint
final Integer nativeGetPageHeightPoint(Long pagePtr)
-
nativeGetPageRotation
final Integer nativeGetPageRotation(Long pagePtr)
-
nativeRenderPage
final Unit nativeRenderPage(Long pagePtr, Surface surface, Integer dpi, Integer startX, Integer startY, Integer drawSizeHor, Integer drawSizeVer, Boolean renderAnnot)
-
nativeRenderPageBitmap
final Unit nativeRenderPageBitmap(Long pagePtr, Bitmap bitmap, Integer dpi, Integer startX, Integer startY, Integer drawSizeHor, Integer drawSizeVer, Boolean renderAnnot, Long docPtr)
-
nativeGetDocumentMetaText
final String nativeGetDocumentMetaText(Long docPtr, String tag)
-
nativeGetFirstChildBookmark
final Long nativeGetFirstChildBookmark(Long docPtr, Long bookmarkPtr)
-
nativeGetSiblingBookmark
final Long nativeGetSiblingBookmark(Long docPtr, Long bookmarkPtr)
-
nativeGetBookmarkTitle
final String nativeGetBookmarkTitle(Long bookmarkPtr)
-
nativeGetBookmarkDestIndex
final Long nativeGetBookmarkDestIndex(Long docPtr, Long bookmarkPtr)
-
nativeGetPageSizeByIndex
final Size nativeGetPageSizeByIndex(Long docPtr, Integer pageIndex, Integer dpi)
-
nativeGetPageLinks
final LongArray nativeGetPageLinks(Long pagePtr)
-
nativeGetDestPageIndex
final Integer nativeGetDestPageIndex(Long docPtr, Long linkPtr)
-
nativeGetLinkURI
final String nativeGetLinkURI(Long docPtr, Long linkPtr)
-
nativeGetLinkRect
final RectF nativeGetLinkRect(Long linkPtr)
-
nativePageCoordinateToDevice
final Point nativePageCoordinateToDevice(Long pagePtr, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Double pageX, Double pageY)
-
nativeDeviceCoordinateToPage
final PointF nativeDeviceCoordinateToPage(Long pagePtr, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Integer deviceX, Integer deviceY)
-
nativeLoadTextPage
final Long nativeLoadTextPage(Long docPtr, Integer pageIndex)
-
nativeLoadTextPages
final LongArray nativeLoadTextPages(Long docPtr, Integer fromIndex, Integer toIndex)
-
nativeCloseTextPage
final Unit nativeCloseTextPage(Long pagePtr)
-
nativeCloseTextPages
final Unit nativeCloseTextPages(LongArray pagesPtr)
-
nativeTextCountChars
final Integer nativeTextCountChars(Long textPagePtr)
-
nativeTextGetText
final Integer nativeTextGetText(Long textPagePtr, Integer start_index, Integer count, ShortArray result)
-
nativeTextGetUnicode
final Integer nativeTextGetUnicode(Long textPagePtr, Integer index)
-
nativeTextGetCharBox
final DoubleArray nativeTextGetCharBox(Long textPagePtr, Integer index)
-
nativeTextGetCharIndexAtPos
final Integer nativeTextGetCharIndexAtPos(Long textPagePtr, Double x, Double y, Double xTolerance, Double yTolerance)
-
nativeTextCountRects
final Integer nativeTextCountRects(Long textPagePtr, Integer start_index, Integer count)
-
nativeTextGetRect
final DoubleArray nativeTextGetRect(Long textPagePtr, Integer rect_index)
-
nativeTextGetBoundedTextLength
final Integer nativeTextGetBoundedTextLength(Long textPagePtr, Double left, Double top, Double right, Double bottom)
-
nativeTextGetBoundedText
final Integer nativeTextGetBoundedText(Long textPagePtr, Double left, Double top, Double right, Double bottom, ShortArray arr)
-
nativeSearchStart
final Long nativeSearchStart(Long textPagePtr, String query, Boolean matchCase, Boolean matchWholeWord)
-
nativeSearchStop
final Unit nativeSearchStop(Long searchHandlePtr)
-
nativeSearchNext
final Boolean nativeSearchNext(Long searchHandlePtr)
-
nativeSearchPrev
final Boolean nativeSearchPrev(Long searchHandlePtr)
-
nativeGetCharIndexOfSearchResult
final Integer nativeGetCharIndexOfSearchResult(Long searchHandlePtr)
-
nativeCountSearchResult
final Integer nativeCountSearchResult(Long searchHandlePtr)
-
nativeAddTextAnnotation
final Long nativeAddTextAnnotation(Long docPtr, Integer pageIndex, String text, IntArray color, IntArray bound)
-
onAnnotationAdded
final Unit onAnnotationAdded(Integer pageIndex, Long pageNewPtr)
-
onAnnotationUpdated
final Unit onAnnotationUpdated(Integer pageIndex, Long pageNewPtr)
-
onAnnotationRemoved
final Unit onAnnotationRemoved(Integer pageIndex, Long pageNewPtr)
-
newDocument
final Unit newDocument(ParcelFileDescriptor fd)
Create new document from file
-
newDocument
@Synchronized() final Unit newDocument(ParcelFileDescriptor fileDescriptor, String password)
Create new document from file with password
-
openPage
final LongArray openPage(Integer fromIndex, Integer toIndex)
Open range of pages and store native pointers
-
getPageWidth
final Integer getPageWidth(Integer index)
Get page width in pixels. <br></br> This method requires page to be opened.
-
getPageHeight
final Integer getPageHeight(Integer index)
Get page height in pixels. <br></br> This method requires page to be opened.
-
getPageWidthPoint
final Integer getPageWidthPoint(Integer index)
Get page width in PostScript points (1/72th of an inch).<br></br> This method requires page to be opened.
-
getPageHeightPoint
final Integer getPageHeightPoint(Integer index)
Get page height in PostScript points (1/72th of an inch).<br></br> This method requires page to be opened.
-
getPageSize
final Size getPageSize(Integer index)
Get size of page in pixels.<br></br> This method does not require given page to be opened.
-
getPageRotation
final Integer getPageRotation(Integer index)
Get the rotation of page<br></br>
-
renderPage
@JvmOverloads() final Unit renderPage(Surface surface, Integer pageIndex, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY, Boolean renderAnnot)
Render page fragment on Surface.<br></br> Page must be opened before rendering.
-
renderPage
@JvmOverloads() final Unit renderPage(Surface surface, Integer pageIndex, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY)
Render page fragment on Surface.<br></br> Page must be opened before rendering.
-
renderPageBitmap
@JvmOverloads() final Unit renderPageBitmap(Bitmap bitmap, Integer pageIndex, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY, Boolean renderAnnot)
Render page fragment on Bitmap. This method allows to render annotations.<br></br> Page must be opened before rendering.
For more info see PdfiumSdk.renderPageBitmap
Supported bitmap configurations:
ARGB_8888 - best quality, high memory usage, higher possibility of OutOfMemoryError
RGB_565 - little worse quality, twice less memory usage
-
renderPageBitmap
@JvmOverloads() final Unit renderPageBitmap(Bitmap bitmap, Integer pageIndex, Integer startX, Integer startY, Integer drawSizeX, Integer drawSizeY)
Render page fragment on Bitmap. This method allows to render annotations.<br></br> Page must be opened before rendering.
For more info see PdfiumSdk.renderPageBitmap
Supported bitmap configurations:
ARGB_8888 - best quality, high memory usage, higher possibility of OutOfMemoryError
RGB_565 - little worse quality, twice less memory usage
-
closeDocument
final Unit closeDocument()
Release native resources and opened file
-
recursiveGetBookmark
final Unit recursiveGetBookmark(ArrayList<Bookmark> tree, Long bookmarkPtr)
-
getPageLinks
final List<Link> getPageLinks(Integer pageIndex)
Get all links from given page
-
mapPageCoordsToDevice
final Point mapPageCoordsToDevice(Integer pageIndex, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Double pageX, Double pageY)
Map page coordinates to device screen coordinates
- Parameters:
pageIndex
- index of pagestartX
- left pixel position of the display area in device coordinatesstartY
- top pixel position of the display area in device coordinatessizeX
- horizontal size (in pixels) for displaying the pagesizeY
- vertical size (in pixels) for displaying the pagerotate
- page orientation: 0 (normal), 1 (rotated 90 degrees clockwise), 2 (rotated 180 degrees), 3 (rotated 90 degrees counter-clockwise)pageX
- X value in page coordinatespageY
- Y value in page coordinate
-
mapDeviceCoordinateToPage
final PointF mapDeviceCoordinateToPage(Integer pageIndex, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, Integer deviceX, Integer deviceY)
Convert the screen coordinates of a point to page coordinates.
The page coordinate system has its origin at the left-bottom corner of the page, with the X-axis on the bottom going to the right, and the Y-axis on the left side going up.
NOTE: this coordinate system can be altered when you zoom, scroll, or rotate a page, however, a point on the page should always have the same coordinate values in the page coordinate system.
The device coordinate system is device dependent. For screen device, its origin is at the left-top corner of the window. However this origin can be altered by the Windows coordinate transformation utilities.
You must make sure the start_x, start_y, size_x, size_y and rotate parameters have exactly same values as you used in the FPDF_RenderPage() function call.
- Parameters:
pageIndex
- index of pagestartX
- Left pixel position of the display area in device coordinates.startY
- Top pixel position of the display area in device coordinates.sizeX
- Horizontal size (in pixels) for displaying the page.sizeY
- Vertical size (in pixels) for displaying the page.rotate
- Page orientation: 0 (normal) 1 (rotated 90 degrees clockwise) 2 (rotated 180 degrees) 3 (rotated 90 degrees counter-clockwise)deviceX
- X value in device coordinates to be converted.deviceY
- Y value in device coordinates to be converted.
-
mapPageCoordinateToDevice
final RectF mapPageCoordinateToDevice(Integer pageIndex, Integer startX, Integer startY, Integer sizeX, Integer sizeY, Integer rotate, RectF coords)
-
prepareTextInfo
final Long prepareTextInfo(Integer pageIndex)
Prepare information about all characters in a page. Application must call FPDFText_ClosePage to release the text page information.
- Parameters:
pageIndex
- index of page.
-
prepareTextInfo
final LongArray prepareTextInfo(Integer fromIndex, Integer toIndex)
Prepare information about all characters in a range of pages. Application must call FPDFText_ClosePage to release the text page information.
- Parameters:
fromIndex
- start index of page.toIndex
- end index of page.
-
releaseTextInfo
final Unit releaseTextInfo(Integer pageIndex)
Release all resources allocated for a text page information structure.
- Parameters:
pageIndex
- index of page.
-
releaseTextInfo
final Unit releaseTextInfo(Integer fromIndex, Integer toIndex)
Release all resources allocated for a text page information structure.
- Parameters:
fromIndex
- start index of page.toIndex
- end index of page.
-
ensureTextPage
final Long ensureTextPage(Integer pageIndex)
-
countCharactersOnPage
final Integer countCharactersOnPage(Integer pageIndex)
-
extractCharacters
final String extractCharacters(Integer pageIndex, Integer startIndex, Integer length)
Extract unicode text string from the page.
- Parameters:
pageIndex
- index of page.startIndex
- Index for the start characters.length
- Number of characters to be extracted.
-
extractCharacter
final Character extractCharacter(Integer pageIndex, Integer index)
Get Unicode of a character in a page.
- Parameters:
pageIndex
- index of page.index
- Zero-based index of the character.
-
measureCharacterBox
final RectF measureCharacterBox(Integer pageIndex, Integer index)
Get bounding box of a particular character.
- Parameters:
pageIndex
- index of page.index
- Zero-based index of the character.
-
getCharacterIndex
final Integer getCharacterIndex(Integer pageIndex, Double x, Double y, Double xTolerance, Double yTolerance)
Get the index of a character at or nearby a certain position on the page
- Parameters:
pageIndex
- index of page.x
- X position in PDF "user space".y
- Y position in PDF "user space".xTolerance
- An x-axis tolerance value for character hit detection, in point unit.yTolerance
- A y-axis tolerance value for character hit detection, in point unit.
-
countTextRect
final Integer countTextRect(Integer pageIndex, Integer charIndex, Integer count)
Count number of rectangular areas occupied by a segment of texts.
This function, along with FPDFText_GetRect can be used by applications to detect the position on the page for a text segment, so proper areas can be highlighted or something. FPDFTEXT will automatically merge small character boxes into bigger one if those characters are on the same line and use same font settings.
- Parameters:
pageIndex
- index of page.charIndex
- Index for the start characters.count
- Number of characters.
-
getTextRect
final RectF getTextRect(Integer pageIndex, Integer rectIndex)
Get a rectangular area from the result generated by FPDFText_CountRects.
- Parameters:
pageIndex
- index of page.rectIndex
- Zero-based index for the rectangle.
-
extractText
final String extractText(Integer pageIndex, RectF rect)
Extract unicode text within a rectangular boundary on the page. If the buffer is too small, as much text as will fit is copied into it.
- Parameters:
pageIndex
- index of page.rect
- the text rectangle to extract.
-
newPageSearch
final TextSearchContext newPageSearch(Integer pageIndex, String query, Boolean matchCase, Boolean matchWholeWord)
A handle class for the search context. stopSearch must be called to release this handle.
- Parameters:
pageIndex
- index of page.query
- A unicode match pattern.matchCase
- match casematchWholeWord
- match the whole word
-
hasTextPage
final Boolean hasTextPage(Integer index)
-
hasSearchHandle
final Boolean hasSearchHandle(Integer index)
-
-
-
-