react-native-pdf-view
react-native-pdf-view copied to clipboard
Crashes when PDF data is invalid with RuntimeException 'PDF file is corrupted'
Pointing PDFView to bad data (example: an encrypted PDF file) causes PDFView to throw an exception that crashes the entire React-native application.
EXPECTED: regular exception with an optional user error handler
Exception:
D/PdfDroid(31514): initializing PdfRender JNI library based on MuPDF
I/PdfDroid(31514): Corrupted file '$FILEPATH', trying to repair
D/PdfDroid(31514): Exception 'java/lang/RuntimeException', Message: 'PDF file is corrupted'
D/PdfDroid(31514): PdfDocument.nativeOpen(): return handle = 0xe380e380
E/AndroidRuntime(31514): FATAL EXCEPTION: AsyncTask #4
E/AndroidRuntime(31514): Process: com.browser, PID: 31514
E/AndroidRuntime(31514): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime(31514): at android.os.AsyncTask$3.done(AsyncTask.java:300)
E/AndroidRuntime(31514): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime(31514): at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime(31514): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime(31514): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime(31514): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime(31514): at java.lang.Thread.run(Thread.java:818)
E/AndroidRuntime(31514): Caused by: java.lang.RuntimeException: PDF file is corrupted
E/AndroidRuntime(31514): at org.vudroid.pdfdroid.codec.PdfDocument.open(Native Method)
E/AndroidRuntime(31514): at org.vudroid.pdfdroid.codec.PdfDocument.openDocument(PdfDocument.java:28)
E/AndroidRuntime(31514): at org.vudroid.pdfdroid.codec.PdfContext.openDocument(PdfContext.java:18)
E/AndroidRuntime(31514): at org.vudroid.core.DecodeServiceBase.open(DecodeServiceBase.java:59)
E/AndroidRuntime(31514): at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:52)
E/AndroidRuntime(31514): at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:31)
E/AndroidRuntime(31514): at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/AndroidRuntime(31514): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime(31514): ... 3 more
Same issue here. The same PDF just works on iOS but crashes on Android.
@rngadam have you solved issue for yourself?
@gyzerok I have the same issue in another library based on vudroid. Did you find any solution?
@KostyaBakay after all my pdf was indeed corrupted
@gyzerok in my case I can open my pdf files using another apps (Google Drive or Dropbox)
+1
+1 when the file size>1M, i get the same error. but in browser ,it's OK