DataProvider

interface DataProvider

A data provider is allows PSPDFKit to load a PDF document for any custom source (e.g. cloud providers, files, in-memory, data providers, etc.).

Classes implementing this interface need to implement all methods correctly to allow PSPDFKit loading documents. Furthermore, if classes with this interface are meant to be used with PdfActivity, they must also implement android.os.Parcelable. If you plan to use the DataProvider only for PdfFragment parcelation code is not necessary.

All callbacks will be called on a background thread.

Inheritors

Properties

Link copied to clipboard
Constant value that can be return in getSize to signal an error during retrieval of the actual file size.
Link copied to clipboard
Constant value that can be returned in read to signal an error while reading.

Functions

Link copied to clipboard
abstract fun getSize(): Long
Return the actual file size of the PDF document which is provided by this data provider.
Link copied to clipboard
abstract fun getTitle(): String
Displayable document title to be used if PDF document does not contain metadata.
Link copied to clipboard
abstract fun getUid(): String
Unique document identifier used in all caching processes in PSPDFKit.
Link copied to clipboard
abstract fun read(size: Long, offset: Long): Array<Byte>
Called by PSPDFKit to read data from the document.
Link copied to clipboard
abstract fun release()
Called when the provided document is being closed.