Package-level declarations

Types

Link copied to clipboard
object KitePDF

One-call entry point. Equivalent to PdfDocument.open — exists so KitePDF.open(bytes) reads nicely at call sites. For passwords, encryption checks, editing, etc. use PdfDocument directly.

Link copied to clipboard

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

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: Rectangle, val contents: String, val color: RgbColor?, val uri: String?, val action: PdfAction?, val rawDestination: PdfObject?, val appearanceStream: PdfStream?, 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
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 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
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 — ISO 32000-1 §12.3.3.

Link copied to clipboard
class PdfPage

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 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 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.

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

PDF rectangle: left, bottom, right, top in user-space units.