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 a sealed interface with three variants: Url, Bytes, and Base64. You pass a KPdfSource value to KPdfViewerState.open() or to KPdf.viewerState() to tell the SDK where to load the document from. Each variant is a data class, so equality and caching are based on the field values you provide.
KPdfSource.Url
UseKPdfSource.Url when your PDF is hosted at a remote HTTPS address. The SDK fetches the document through its internal source pipeline. Because HTTP headers can affect the response — for example, authentication tokens or content-negotiation directives — headers are part of the source identity: two Url instances with identical URLs but different headers are treated as distinct sources.
The HTTPS URL of the remote PDF document.
Custom HTTP request headers to include when fetching the PDF. Headers are part of the source identity — changing a header value produces a distinct source that bypasses the previous cache entry.
Because
headers contribute to source identity, supplying a new Authorization value or any other changed header causes the SDK to treat the request as a new source and fetch the document again rather than serving the cached copy.KPdfSource.Bytes
UseKPdfSource.Bytes when you have already loaded the raw PDF bytes in your application — for example, after reading a file from disk or downloading it yourself. The SDK does not perform any network request; it reads directly from the ByteArray you provide.
KPdfSource.Bytes implements structural equality via contentEquals, so two instances wrapping byte-for-byte identical arrays are considered equal.
The complete, raw bytes of a valid PDF document.
KPdfSource.Base64
UseKPdfSource.Base64 when your PDF is delivered as a Base64-encoded string. The SDK accepts both a raw Base64 string and a data URL of the form data:application/pdf;base64,<encoded>.
A raw Base64-encoded PDF string or a full data URL in the format
data:application/pdf;base64,<encoded>. Both forms are accepted.