Package-level declarations

Types

Link copied to clipboard

A rendered page image owned by the caller.

Link copied to clipboard
data class PdfBookmark(val title: String, val destination: PdfDestination?, val target: PdfLinkTarget?, val color: PdfColor?, val children: List<PdfBookmark>)

An entry of the document outline (bookmark tree).

Link copied to clipboard
data class PdfCapabilities(val text: Boolean, val search: Boolean, val bookmarks: Boolean, val links: Boolean, val thumbnails: Boolean, val progressiveLoading: Boolean, val progressiveRendering: Boolean, val forms: Boolean, val editing: Boolean, val javascriptExecution: Boolean, val xfa: Boolean)

Capabilities of the active PDFium backend and bundled PDFium build.

Link copied to clipboard
data class PdfCharacter(val characterIndex: Int, val unicodeCodePoint: Int, val bounds: PdfRect?, val origin: PdfPoint?, val fontSize: Double?, val angleRadians: Double?, val isGenerated: Boolean, val isHyphen: Boolean, val hasUnicodeMappingError: Boolean)

Geometry and attributes of a single character within a PdfTextLayout.

Link copied to clipboard
class PdfClosedException(val resource: String) : PdfException

A document or bitmap was used after being closed.

Link copied to clipboard
value class PdfColor(val argb: UInt)

A non-premultiplied ARGB color encoded as 0xAARRGGBB.

Link copied to clipboard
data class PdfDestination(val pageIndex: Int, val view: PdfDestinationView)

A location inside a document that a link or bookmark points to.

Link copied to clipboard
sealed interface PdfDestinationView

The view mode a PdfDestination requests for its page.

Link copied to clipboard

An open PDF document.

Link copied to clipboard
data class PdfDocumentInfo(val version: PdfVersion?, val permissions: PdfPermissions, val securityRevision: Int?, val hasValidCrossReferenceTable: Boolean, val isLinearized: Boolean?)

Structural information about a document.

Link copied to clipboard
sealed class PdfException : Exception

Base class of every failure this library throws for expected PDF errors.

Link copied to clipboard

The password supplied to PdfViewer.open did not decrypt the document.

Link copied to clipboard

The input is not a valid PDF document.

Link copied to clipboard
class PdfIoException(message: String = "Could not read the PDF document", cause: Throwable? = null) : PdfException

A read failure occurred while loading the document.

Link copied to clipboard
data class PdfLink(val bounds: List<PdfQuad>, val target: PdfLinkTarget)

A clickable link annotation on a page.

Link copied to clipboard
sealed interface PdfLinkTarget

What a link annotation activates when clicked.

Link copied to clipboard
data class PdfMetadata(val title: String?, val author: String?, val subject: String?, val keywords: String?, val creator: String?, val producer: String?, val creationDate: String?, val modificationDate: String?, val additional: Map<String, String> = emptyMap())

Document information dictionary values.

Link copied to clipboard
class PdfNativeException(val nativeErrorCode: Int, message: String = "PDFium failed with error code ", cause: Throwable? = null) : PdfException

PDFium returned a native error that is not mapped to a more specific exception.

Link copied to clipboard
class PdfPage

Lightweight page descriptor. It does not keep a native PDFium page open.

Link copied to clipboard
class PdfPageException(val pageIndex: Int, cause: Throwable? = null) : PdfException

A page-level operation failed.

Link copied to clipboard
data class PdfPageInfo(val size: PdfSize, val rotation: PdfRotation, val boundingBox: PdfRect?)

Basic geometry of a single page.

Link copied to clipboard

The document is encrypted and no password was supplied to PdfViewer.open.

Link copied to clipboard
data class PdfPermissions(val canPrint: Boolean, val canModify: Boolean, val canCopy: Boolean, val canAnnotate: Boolean, val canFillForms: Boolean, val canExtractForAccessibility: Boolean, val canAssemble: Boolean, val canPrintHighQuality: Boolean)

Operations an encrypted document's security handler allows. Every flag is true for unencrypted documents.

Link copied to clipboard

Pixel layouts a PdfBitmap can use.

Link copied to clipboard
data class PdfPixelSize(val width: Int, val height: Int)

A size in device pixels, typically a render target.

Link copied to clipboard
data class PdfPoint(val x: Double, val y: Double)

A point in PDF page space. Values are measured in PDF points.

Link copied to clipboard
data class PdfQuad(val first: PdfPoint, val second: PdfPoint, val third: PdfPoint, val fourth: PdfPoint)

A quadrilateral in PDF page space, as reported by PDFium for link areas and search matches. A rectangle is emitted as four corner points.

Link copied to clipboard
data class PdfRect(val left: Double, val bottom: Double, val right: Double, val top: Double)

A rectangle in PDF page space, whose origin is at the bottom-left.

Link copied to clipboard
data class PdfRenderRequest(val outputSize: PdfPixelSize, val sourceRect: PdfRect? = null, val rotation: PdfRotation = PdfRotation.Degrees0, val backgroundColor: PdfColor = PdfColor.White, val renderAnnotations: Boolean = true, val grayscale: Boolean = false, val optimizeTextForLcd: Boolean = false)

Describes how a page is rendered into a bitmap.

Link copied to clipboard

Page rotation in 90-degree steps, applied clockwise.

Link copied to clipboard
data class PdfSearchMatch(val range: PdfTextRange, val bounds: List<PdfRect>)

A single search hit on a page.

Link copied to clipboard
data class PdfSearchOptions(val matchCase: Boolean = false, val matchWholeWord: Boolean = false, val consecutive: Boolean = false)

Options for PdfPage.search.

Link copied to clipboard
data class PdfSize(val width: Double, val height: Double)

A size measured in PDF points.

Link copied to clipboard
sealed interface PdfSource : AutoCloseable

A synchronously readable PDF input owned by PdfViewer.open.

Link copied to clipboard

Full page text with per-character geometry.

Link copied to clipboard
data class PdfTextRange(val startCharacterIndex: Int, val characterCount: Int)

A range using PDFium character indexes, not Kotlin string indexes.

Link copied to clipboard

An operation that the current backends do not implement was requested. Check PdfViewer.capabilities before calling optional APIs.

Link copied to clipboard

The document uses a security scheme the bundled PDFium build cannot open.

Link copied to clipboard
data class PdfVersion(val major: Int, val minor: Int)

PDF file version, for example 1.7.

Link copied to clipboard
object PdfViewer

Process-wide entry point for opening PDF documents.