Package-level declarations

Types

Link copied to clipboard
object KitePDF

Library-level constants.

Link copied to clipboard
enum class PageLayout : Enum<PageLayout>

Initial page-layout hint that tells the viewer how to lay pages out in the document area (ISO 32000-1 §7.7.2 Table 28, /PageLayout).

Link copied to clipboard
enum class PageMode : Enum<PageMode>

Initial UI hint that tells a viewer which side panel to show when the document opens (ISO 32000-1 §7.7.2 Table 28, /PageMode).

Link copied to clipboard
data class PdfAcroForm(val fieldCount: Int, val needAppearances: Boolean, val signatureFlags: Int, val defaultAppearance: String?, val defaultQuadding: Int, val raw: PdfDictionary)

Top-level interactive form metadata: catalog /AcroForm (ISO 32000-1 §12.7.2).

Link copied to clipboard
sealed class PdfAction

A PDF action (ISO 32000-1 §12.6). Actions describe what happens when the user activates a link, button, form field, or document open/close event.

Link copied to clipboard
data class PdfAnnotation(val subtype: PdfAnnotation.Subtype, val rect: KiteRectangle, val contents: String, val color: RgbColor?, val uri: String?, val action: PdfAction?, val rawDestination: PdfObject?, val appearanceStream: PdfStream?, val flags: Int = 0, val quadPoints: List<Double>? = null, val inkLists: List<List<Double>>? = null, val vertices: List<Double>? = null, val interiorColor: RgbColor? = null, val borderWidth: Double? = null, val borderStyle: String? = null, val borderDash: List<Double>? = null, val additionalActions: PdfWidgetActions? = null, val raw: PdfDictionary)

One PDF annotation (ISO 32000-1 §12.5).

Link copied to clipboard
data class PdfArticleThread(val title: String? = null, val author: String? = null, val subject: String? = null, val keywords: String? = null, val beads: List<PdfArticleThread.ArticleBead> = emptyList())

One article thread from the document (ISO 32000-1 §12.4.3).

Link copied to clipboard
data class PdfAttachment(val name: String, val filename: String, val description: String?, val mimeType: String?, val size: Long?, val bytesProvider: () -> ByteArray)

One embedded file attachment from the document (ISO 32000-1 §7.11.4).

Link copied to clipboard

An X.509 certificate from a signature (RFC 5280).

Link copied to clipboard
data class PdfChoiceOption(val index: Int, val exportValue: String, val label: String)

One /Opt entry, retaining its original index and both strings (ISO 32000-1, 12.7.4.4).

Link copied to clipboard
class PdfChoiceSelection(indices: List<Int>, val freeText: String? = null, unresolvedValues: List<String> = emptyList())

A choice field's complete value (ISO 32000-1, 12.7.4.4). indices identifies options, so equal labels or exports remain distinct. An editable combo can instead hold freeText. unresolvedValues preserves values from a damaged source file that match no option; new edits cannot introduce them. Empty indices with no text means no selection, which differs from selecting an option whose export string is empty. Lists are immutable snapshots.

Link copied to clipboard
data class PdfDate(val year: Int, val month: Int, val day: Int, val hour: Int, val minute: Int, val second: Int, val tzSign: Char, val tzHour: Int, val tzMinute: Int)

A PDF date-time (ISO 32000-1 §7.9.4): D:YYYYMMDDHHmmSSOHH'mm'.

Link copied to clipboard
data class PdfDestination(val view: PdfDestination.ViewFit, val pageIndex: Int?, val args: DoubleArray)

A resolved page destination (ISO 32000-1 §12.3.2). Holds the destination's target page (when we can resolve it) and the view-fit parameters.

Link copied to clipboard

A loaded PDF document. Construct with open.

Link copied to clipboard
data class PdfDocumentActions(val willClose: PdfAction? = null, val willSave: PdfAction? = null, val didSave: PdfAction? = null, val willPrint: PdfAction? = null, val didPrint: PdfAction? = null, val raw: PdfDictionary)

The scripts a document runs at the moments of its own life, from the catalog's /AA dictionary (ISO 32000-1 §12.6.3, Table 197).

Link copied to clipboard
data class PdfDocumentInfo(val title: String? = null, val author: String? = null, val subject: String? = null, val keywords: String? = null, val creator: String? = null, val producer: String? = null, val creationDate: PdfDate? = null, val modDate: PdfDate? = null, val trapped: PdfDocumentInfo.Trapped = Trapped.Unknown, val custom: Map<String, String> = emptyMap())

Contents of the trailer's /Info dictionary (ISO 32000-1 §14.3.3).

Link copied to clipboard

One terminal interactive-form field (ISO 32000-1 §12.7.3), flattened from the AcroForm field tree with inheritable attributes (/FT, /DA, /Ff, /V, /Q) resolved down from ancestors.

Link copied to clipboard
class PdfFormState(document: PdfDocument)

The live values of a document's form fields, while the reader has it open.

Link copied to clipboard
data class PdfMarkInfo(val marked: Boolean = false, val userProperties: Boolean = false, val suspects: Boolean = false)

Catalog /MarkInfo dictionary (ISO 32000-1 §14.7.1).

Link copied to clipboard
data class PdfOptionalContent(val groups: List<PdfOptionalContent.OptionalContentGroup>, val onByDefault: Set<String>, val offByDefault: Set<String>, val defaultConfigName: String?)

Optional Content metadata (ISO 32000-1 §8.11). Optional Content Groups (OCGs) are the PDF spec's name for "layers": chunks of content that can be selectively shown or hidden via /OC marked-content sections and Form XObjects with /OC entries.

Link copied to clipboard
data class PdfOutline(val title: String, val children: List<PdfOutline>, val rawDestination: PdfObject?, val action: PdfAction?, val count: Int, val italic: Boolean, val bold: Boolean, val color: RgbColor?)

One node in the document outline (a.k.a. bookmarks) tree. See ISO 32000-1 §12.3.3.

Link copied to clipboard

A single PDF page. Obtained from PdfDocument.pages; not constructed directly.

Link copied to clipboard
data class PdfPermissions(val canPrint: Boolean, val canModifyContents: Boolean, val canCopyContents: Boolean, val canModifyAnnotations: Boolean, val canFillForms: Boolean, val canExtractForAccessibility: Boolean, val canAssembleDocument: Boolean, val canPrintHighResolution: Boolean, val rawFlags: Int)

Document usage permissions: the typed view of the Standard Security Handler's /P bit-flags (ISO 32000-1 §7.6.3.2 Table 22).

Link copied to clipboard
data class PdfRasterGeometry(val widthPx: Int, val heightPx: Int, val deviceCtm: KiteMatrix)

Output geometry for rasterizing a PdfPage at a given scale: how big the target surface must be, in device pixels, and the matrix that carries unscaled PDF user space onto it.

Link copied to clipboard

A change that a later revision made after a signature (ISO 32000-1, 12.8.2.2), with whether the certification level and the field locks allow it. Without a certification signature, KitePDF applies the permissions of level 3.

Link copied to clipboard

What the revocation data says about a certificate of a signature's chain.

Link copied to clipboard

What a viewer needs from a document's scripts, without knowing how they run.

Link copied to clipboard

A digital signature in a signature field (ISO 32000-1, 12.8): what its signature dictionary says, and validate to check it. PdfDocument.signatures lists the signatures of a document.

Link copied to clipboard
Link copied to clipboard
data class PdfViewerPreferences(val hideToolbar: Boolean = false, val hideMenubar: Boolean = false, val hideWindowUI: Boolean = false, val fitWindow: Boolean = false, val centerWindow: Boolean = false, val displayDocTitle: Boolean = false, val nonFullScreenPageMode: PageMode = PageMode.UseNone, val direction: PdfViewerPreferences.ReadingDirection = ReadingDirection.LeftToRight, val viewArea: PdfViewerPreferences.PageBoxName = PageBoxName.CropBox, val viewClip: PdfViewerPreferences.PageBoxName = PageBoxName.CropBox, val printArea: PdfViewerPreferences.PageBoxName = PageBoxName.CropBox, val printClip: PdfViewerPreferences.PageBoxName = PageBoxName.CropBox, val printScaling: PdfViewerPreferences.PrintScaling = PrintScaling.AppDefault, val duplex: PdfViewerPreferences.Duplex = Duplex.Simplex, val pickTrayByPdfSize: Boolean = false, val numCopies: Int = 1, val printPageRange: List<IntRange> = emptyList())

Catalog /ViewerPreferences dictionary (ISO 32000-1 §12.2).

Link copied to clipboard
data class PdfWidgetActions(val mouseEnter: PdfAction? = null, val mouseExit: PdfAction? = null, val mouseDown: PdfAction? = null, val mouseUp: PdfAction? = null, val focus: PdfAction? = null, val blur: PdfAction? = null, val pageOpen: PdfAction? = null, val pageClose: PdfAction? = null, val pageVisible: PdfAction? = null, val pageInvisible: PdfAction? = null, val keystroke: PdfAction? = null, val format: PdfAction? = null, val validate: PdfAction? = null, val calculate: PdfAction? = null, val raw: PdfDictionary)

The scripts an annotation runs when the reader touches it, from its /AA dictionary (ISO 32000-1 §12.6.3, Table 194 and Table 196).

Link copied to clipboard

A form widget found under a point, with the field it shows. See PdfPage.widgetAt.

Link copied to clipboard
data class PdfXmpMetadata(val title: String? = null, val authors: List<String> = emptyList(), val description: String? = null, val keywords: String? = null, val subjects: List<String> = emptyList(), val producer: String? = null, val creatorTool: String? = null, val createDate: String? = null, val modifyDate: String? = null, val metadataDate: String? = null, val pdfVersion: String? = null, val xml: String)

Parsed view of an XMP (Extensible Metadata Platform) packet stored in the catalog's /Metadata stream. The XMP spec is ISO 16684-1; in PDF it's referenced from ISO 32000-1 §14.3.2 (PDF 2.0 §14.3) as the preferred way to carry document metadata. PDF 2.0 deprecates the trailer /Info dict but in practice readers consult both.

Functions

Link copied to clipboard
fun PdfDocument.Companion.openFile(path: String, password: ByteArray = byteArrayOf()): PdfDocument

Opens the PDF at path, loading the WHOLE file into memory first (thin sugar over PdfDocument.open; there is no incremental file reader).

fun PdfDocument.Companion.openFile(path: String, password: ByteArray = byteArrayOf()): PdfDocument

Opens the PDF at path, loading the WHOLE file into memory first (thin sugar over PdfDocument.open; there is no incremental file reader).

fun PdfDocument.Companion.openFile(path: String, password: ByteArray = byteArrayOf()): PdfDocument

Opens the PDF at path, loading the WHOLE file into memory first (thin sugar over PdfDocument.open; there is no incremental file reader).

Link copied to clipboard

rasterGeometry with the library's default allocation ceiling.

fun PdfPage.rasterGeometry(scale: Double = 1.0, maxPixels: Long): PdfRasterGeometry

The PdfRasterGeometry for rendering this page at scale device pixels per PDF user-space unit (so scale = dpi / 72.0). maxPixels prevents an untrusted page size, /UserUnit, or accidental scale from requesting an allocation large enough to terminate the host process.