PdfiumSdk

class PdfiumSdk

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val currentDpi: Int = 72
Link copied to clipboard

Get metadata for given document

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Get total number of pages in document

Link copied to clipboard

Get table of contents (bookmarks) for given document

Functions

Link copied to clipboard

Release native resources and opened file

Link copied to clipboard
fun countCharactersOnPage(pageIndex: Int): Int
Link copied to clipboard
fun countTextRect(pageIndex: Int, charIndex: Int, count: Int): Int

Count number of rectangular areas occupied by a segment of texts.

Link copied to clipboard
fun ensureTextPage(pageIndex: Int): Long?
Link copied to clipboard
fun extractCharacter(pageIndex: Int, index: Int): Char

Get Unicode of a character in a page.

Link copied to clipboard
fun extractCharacters(pageIndex: Int, startIndex: Int, length: Int): String?

Extract unicode text string from the page.

Link copied to clipboard
fun extractText(pageIndex: Int, rect: RectF): String?

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.

Link copied to clipboard
fun getCharacterIndex(pageIndex: Int, x: Double, y: Double, xTolerance: Double, yTolerance: Double): Int

Get the index of a character at or nearby a certain position on the page

Link copied to clipboard
fun getPageHeight(index: Int): Int

Get page height in pixels.

This method requires page to be opened.

Link copied to clipboard

Get page height in PostScript points (1/72th of an inch).

This method requires page to be opened.

Link copied to clipboard
fun getPageLinks(pageIndex: Int): List<Link>

Get all links from given page

Link copied to clipboard
fun getPageRotation(index: Int): Int

Get the rotation of page

Link copied to clipboard
fun getPageSize(index: Int): Size

Get size of page in pixels.

This method does not require given page to be opened.

Link copied to clipboard
fun getPageWidth(index: Int): Int

Get page width in pixels.

This method requires page to be opened.

Link copied to clipboard

Get page width in PostScript points (1/72th of an inch).

This method requires page to be opened.

Link copied to clipboard
fun getTextRect(pageIndex: Int, rectIndex: Int): RectF?

Get a rectangular area from the result generated by FPDFText_CountRects.

Link copied to clipboard
fun hasPage(index: Int): Boolean
Link copied to clipboard
Link copied to clipboard
fun hasTextPage(index: Int): Boolean
Link copied to clipboard
fun mapDeviceCoordinateToPage(pageIndex: Int, startX: Int, startY: Int, sizeX: Int, sizeY: Int, rotate: Int, deviceX: Int, deviceY: Int): PointF

Convert the screen coordinates of a point to page coordinates.

Link copied to clipboard
fun mapPageCoordinateToDevice(pageIndex: Int, startX: Int, startY: Int, sizeX: Int, sizeY: Int, rotate: Int, coords: RectF): RectF
Link copied to clipboard
fun mapPageCoordsToDevice(pageIndex: Int, startX: Int, startY: Int, sizeX: Int, sizeY: Int, rotate: Int, pageX: Double, pageY: Double): Point

Map page coordinates to device screen coordinates

Link copied to clipboard
fun measureCharacterBox(pageIndex: Int, index: Int): RectF?

Get bounding box of a particular character.

Link copied to clipboard
external fun nativeAddTextAnnotation(docPtr: Long, pageIndex: Int, text: String, color: IntArray, bound: IntArray): Long
Link copied to clipboard
external fun nativeCloseDocument(docPtr: Long)
Link copied to clipboard
external fun nativeClosePage(pagePtr: Long)
Link copied to clipboard
external fun nativeClosePages(pagesPtr: LongArray)
Link copied to clipboard
external fun nativeCloseTextPage(pagePtr: Long)
Link copied to clipboard
external fun nativeCloseTextPages(pagesPtr: LongArray)
Link copied to clipboard
external fun nativeCountSearchResult(searchHandlePtr: Long): Int
Link copied to clipboard
external fun nativeDeviceCoordinateToPage(pagePtr: Long, startX: Int, startY: Int, sizeX: Int, sizeY: Int, rotate: Int, deviceX: Int, deviceY: Int): PointF
Link copied to clipboard
external fun nativeGetBookmarkDestIndex(docPtr: Long, bookmarkPtr: Long): Long
Link copied to clipboard
external fun nativeGetBookmarkTitle(bookmarkPtr: Long): String?
Link copied to clipboard
external fun nativeGetCharIndexOfSearchResult(searchHandlePtr: Long): Int
Link copied to clipboard
external fun nativeGetDestPageIndex(docPtr: Long, linkPtr: Long): Int?
Link copied to clipboard
external fun nativeGetDocumentMetaText(docPtr: Long, tag: String): String?
Link copied to clipboard
external fun nativeGetFirstChildBookmark(docPtr: Long, bookmarkPtr: Long?): Long?
Link copied to clipboard
external fun nativeGetLinkRect(linkPtr: Long): RectF?
Link copied to clipboard
external fun nativeGetLinkURI(docPtr: Long, linkPtr: Long): String?
Link copied to clipboard
external fun nativeGetPageCount(docPtr: Long): Int
Link copied to clipboard
external fun nativeGetPageHeightPixel(pagePtr: Long, dpi: Int): Int
Link copied to clipboard
external fun nativeGetPageHeightPoint(pagePtr: Long): Int
Link copied to clipboard
external fun nativeGetPageLinks(pagePtr: Long): LongArray
Link copied to clipboard
external fun nativeGetPageRotation(pagePtr: Long): Int
Link copied to clipboard
external fun nativeGetPageSizeByIndex(docPtr: Long, pageIndex: Int, dpi: Int): Size
Link copied to clipboard
external fun nativeGetPageWidthPixel(pagePtr: Long, dpi: Int): Int
Link copied to clipboard
external fun nativeGetPageWidthPoint(pagePtr: Long): Int
Link copied to clipboard
external fun nativeGetSiblingBookmark(docPtr: Long, bookmarkPtr: Long): Long?
Link copied to clipboard
external fun nativeLoadPage(docPtr: Long, pageIndex: Int): Long
Link copied to clipboard
external fun nativeLoadPages(docPtr: Long, fromIndex: Int, toIndex: Int): LongArray
Link copied to clipboard
external fun nativeLoadTextPage(docPtr: Long, pageIndex: Int): Long
Link copied to clipboard
external fun nativeLoadTextPages(docPtr: Long, fromIndex: Int, toIndex: Int): LongArray
Link copied to clipboard
external fun nativeOpenDocument(fd: Int, password: String?): Long
Link copied to clipboard
external fun nativeOpenMemDocument(data: ByteArray, password: String): Long
Link copied to clipboard
external fun nativePageCoordinateToDevice(pagePtr: Long, startX: Int, startY: Int, sizeX: Int, sizeY: Int, rotate: Int, pageX: Double, pageY: Double): Point
Link copied to clipboard
external fun nativeRenderPage(pagePtr: Long, surface: Surface, dpi: Int, startX: Int, startY: Int, drawSizeHor: Int, drawSizeVer: Int, renderAnnot: Boolean)
Link copied to clipboard
external fun nativeRenderPageBitmap(pagePtr: Long, bitmap: Bitmap, dpi: Int, startX: Int, startY: Int, drawSizeHor: Int, drawSizeVer: Int, renderAnnot: Boolean, docPtr: Long)
Link copied to clipboard
external fun nativeSearchNext(searchHandlePtr: Long): Boolean
Link copied to clipboard
external fun nativeSearchPrev(searchHandlePtr: Long): Boolean
Link copied to clipboard
external fun nativeSearchStart(textPagePtr: Long, query: String, matchCase: Boolean, matchWholeWord: Boolean): Long
Link copied to clipboard
external fun nativeSearchStop(searchHandlePtr: Long)
Link copied to clipboard
external fun nativeTextCountChars(textPagePtr: Long): Int
Link copied to clipboard
external fun nativeTextCountRects(textPagePtr: Long, start_index: Int, count: Int): Int
Link copied to clipboard
external fun nativeTextGetBoundedText(textPagePtr: Long, left: Double, top: Double, right: Double, bottom: Double, arr: ShortArray): Int
Link copied to clipboard
external fun nativeTextGetBoundedTextLength(textPagePtr: Long, left: Double, top: Double, right: Double, bottom: Double): Int
Link copied to clipboard
external fun nativeTextGetCharBox(textPagePtr: Long, index: Int): DoubleArray
Link copied to clipboard
external fun nativeTextGetCharIndexAtPos(textPagePtr: Long, x: Double, y: Double, xTolerance: Double, yTolerance: Double): Int
Link copied to clipboard
external fun nativeTextGetRect(textPagePtr: Long, rect_index: Int): DoubleArray
Link copied to clipboard
external fun nativeTextGetText(textPagePtr: Long, start_index: Int, count: Int, result: ShortArray): Int
Link copied to clipboard
external fun nativeTextGetUnicode(textPagePtr: Long, index: Int): Int
Link copied to clipboard

Create new document from file

fun newDocument(fileDescriptor: ParcelFileDescriptor, password: String?)

Create new document from file with password

Link copied to clipboard
fun newPageSearch(pageIndex: Int, query: String, matchCase: Boolean, matchWholeWord: Boolean): TextSearchContext

A handle class for the search context. stopSearch must be called to release this handle.

Link copied to clipboard
fun onAnnotationAdded(pageIndex: Int, pageNewPtr: Long)
Link copied to clipboard
fun onAnnotationRemoved(pageIndex: Int, pageNewPtr: Long)
Link copied to clipboard
fun onAnnotationUpdated(pageIndex: Int, pageNewPtr: Long)
Link copied to clipboard
fun openPage(pageIndex: Int): Long

Open page and store native pointer

fun openPage(fromIndex: Int, toIndex: Int): LongArray

Open range of pages and store native pointers

Link copied to clipboard
fun prepareTextInfo(pageIndex: Int): Long

Prepare information about all characters in a page. Application must call FPDFText_ClosePage to release the text page information.

fun prepareTextInfo(fromIndex: Int, toIndex: Int): LongArray

Prepare information about all characters in a range of pages. Application must call FPDFText_ClosePage to release the text page information.

Link copied to clipboard
fun recursiveGetBookmark(tree: ArrayList<Bookmark>, bookmarkPtr: Long)
Link copied to clipboard
fun releaseTextInfo(pageIndex: Int)
fun releaseTextInfo(fromIndex: Int, toIndex: Int)

Release all resources allocated for a text page information structure.

Link copied to clipboard
fun renderPage(surface: Surface, pageIndex: Int, startX: Int, startY: Int, drawSizeX: Int, drawSizeY: Int, renderAnnot: Boolean = false)

Render page fragment on Surface.

Page must be opened before rendering.

Link copied to clipboard
fun renderPageBitmap(bitmap: Bitmap, pageIndex: Int, startX: Int, startY: Int, drawSizeX: Int, drawSizeY: Int, renderAnnot: Boolean = false)

Render page fragment on Bitmap. This method allows to render annotations.

Page must be opened before rendering.

Link copied to clipboard
fun validPtr(ptr: Long?): Boolean