Documentation Index
Fetch the complete documentation index at: https://mahmoud-b28887f9.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
KPdfSource is the sealed interface that tells KPDF where to find a PDF document. Every viewer instance is backed by exactly one source, and the SDK treats distinct source values as distinct documents. Choose the variant that matches how your app obtains the PDF — a remote URL, an already-decoded byte array, or an inline Base64 string — and pass it to rememberPdfViewerState or KPdfViewerState.open.
The three source variants
KPdfSource.Url — remote PDF over HTTP/HTTPS
KPdfSource.Url — remote PDF over HTTP/HTTPS
Use
KPdfSource.Url when the document lives at a network address. Pass custom headers to authenticate the request or negotiate the response format. KPDF treats headers as part of the source identity: two Url instances with the same URL but different headers are considered different sources, so the viewer reloads when headers change.KPdfSource.Bytes — raw byte array
KPdfSource.Bytes — raw byte array
Use
KPdfSource.Bytes when your app already has the PDF content in memory — for example, after downloading it yourself, generating it programmatically, or reading it from a local file. Hand the ByteArray directly to KPDF; the SDK does not perform any network requests.KPdfSource.Bytes implements equals and hashCode using contentEquals / contentHashCode on the underlying array, so two Bytes instances wrapping identical content compare as equal.KPdfSource.Base64 — inline Base64 content
KPdfSource.Base64 — inline Base64 content
Use
KPdfSource.Base64 when the PDF arrives as a Base64-encoded string, such as from a JSON API response or an embedded asset. Pass either a raw Base64 string or a complete data URL — KPDF handles both formats.Passing a source to the viewer
viewerState.open(newSource). KPDF cancels any in-flight work and starts loading the new source immediately.