openDocument

fun openDocument(context: Context, documentUri: Uri): ImageDocument

Opens an image document from a Uri. Remote Uri's are supported and automatically downloaded.

Note that this method blocks until the image document is loaded and should not be invoked on main thread. If you're passing a remote Uri and run this method on the main thread, it will throw a com.pspdfkit.document.download.exceptions.DownloadException.DownloadOnMainThreadException.

Return

ImageDocument instance if the opening succeeded.

Parameters

context

Application context.

documentUri

Uri pointing to the PDF document.

Throws

If file was not opened correctly.

com.pspdfkit.exceptions.NutrientNotInitializedException

If PSPDFKit was not initialized with com.pspdfkit.Nutrient.initialize call.

com.pspdfkit.document.download.exceptions.DownloadException.DownloadOnMainThreadException

If trying to open a remote Uri on the main thread

com.pspdfkit.document.download.exceptions.DownloadException

If anything happened during the download of a remote Uri


Opens an image document from a Uri. Remote Uri's are supported and automatically downloaded.

Note that this method blocks until the image document is loaded and should not be invoked on main thread. If you're passing a remote Uri and run this method on the main thread, it will throw a com.pspdfkit.document.download.exceptions.DownloadException.DownloadOnMainThreadException.

Return

ImageDocument instance if the opening succeeded.

Parameters

context

Application context.

source

DocumentSource describing the source of the image document.

Throws

If file was not opened correctly.

com.pspdfkit.exceptions.NutrientNotInitializedException

If PSPDFKit was not initialized with com.pspdfkit.Nutrient.initialize call.

com.pspdfkit.document.download.exceptions.DownloadException.DownloadOnMainThreadException

If trying to open a remote Uri on the main thread

com.pspdfkit.document.download.exceptions.DownloadException

If anything happened during the download of a remote Uri