Hi, I'm using PDFium in my app and if I try to open a pdf file that is corrupted I see the error message in log
But how to catch this event in my code so I can show it to the user?
I tried to use this - and it didn't work
Is there any other option to check if the PDF is corrupted?
B4X:
** Activity (viewpdf) Resume **
onError()
java.io.IOException: cannot create document: File not in PDF format or corrupted.
at com.shockwave.pdfium.PdfiumCore.nativeOpenDocument(Native Method)
at com.shockwave.pdfium.PdfiumCore.newDocument(PdfiumCore.java:135)
at com.github.barteksc.pdfviewer.source.UriSource.createDocument(UriSource.java:38)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:49)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:25)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
But how to catch this event in my code so I can show it to the user?
I tried to use this - and it didn't work
B4X:
Sub PDFium_OnErrorListener()
Log("Error")
End Sub
Is there any other option to check if the PDF is corrupted?