PdfLoader
interface PdfLoader
SandboxedPdfLoader |
A |
Provides an abstraction for asynchronously opening PDF documents from a Uri. Implementations of this interface are responsible for handling the retrieval, decryption (if necessary), and creation of a PdfDocument representation.
Summary
Public functions |
|
|---|---|
suspend PdfDocument |
openDocument(uri: Uri, password: String?)Asynchronously opens a |
suspend PdfDocument |
openDocument(Asynchronously opens a |
Public functions
openDocument
suspend fun openDocument(uri: Uri, password: String? = null): PdfDocument
Asynchronously opens a PdfDocument from the specified Uri.
| Parameters | |
|---|---|
uri: Uri |
The URI of the PDF document to open. |
password: String? = null |
(Optional) The password to unlock the document if it is encrypted. |
| Returns | |
|---|---|
PdfDocument |
The opened |
| Throws | |
|---|---|
androidx.pdf.PdfPasswordException |
If the provided password is incorrect. |
java.io.IOException |
If an error occurs while opening the document. |
openDocument
suspend fun openDocument(
uri: Uri,
fileDescriptor: ParcelFileDescriptor,
password: String? = null
): PdfDocument
Asynchronously opens a PdfDocument from the specified fileDescriptor. The file descriptor will become owned by the PdfDocument, and it should be closed using the document, unless an exception is thrown.
| Parameters | |
|---|---|
uri: Uri |
This is used only as a unique identifier for the |
fileDescriptor: ParcelFileDescriptor |
a |
password: String? = null |
(Optional) The password to unlock the document if it is encrypted. |
| Returns | |
|---|---|
PdfDocument |
The opened |
| Throws | |
|---|---|
androidx.pdf.PdfPasswordException |
If the provided password is incorrect. |
java.io.IOException |
If an error occurs while opening the document. |