diff --git a/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfRendererView.kt b/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfRendererView.kt index 0a06273..5d4948f 100644 --- a/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfRendererView.kt +++ b/pdfViewer/src/main/java/com/rajat/pdfviewer/PdfRendererView.kt @@ -92,8 +92,12 @@ class PdfRendererView @JvmOverloads constructor( statusListener?.onPdfLoadProgress(progress, currentBytes, totalBytes) } override fun onDownloadSuccess(absolutePath: String) { - initWithFile(File(absolutePath)) - statusListener?.onPdfLoadSuccess(absolutePath) + try { + initWithFile(File(absolutePath)) + statusListener?.onPdfLoadSuccess(absolutePath) + } catch (e: Exception) { + statusListener?.onError(e) + } } override fun onError(error: Throwable) { error.printStackTrace()