Skip to content

Conversation

@maroney-tm
Copy link

Wrapped pdfiumCore.openPage() with a try catch to prevent an unrecoverable crash being passed on to the user. Ideally this should render an error page or give the user the option to show an error message. As it is now it just doesn't render anything and shows a black screen on the offending page

Attached is a PDF with a page that won't render. (page 7)
test.pdf

…ble crash being passed on to the user. Ideally this should be render an error page or give the user the option to show an error message. As it is now it just doesn't render anything and shows a black screen on the offending page
@1stmetro
Copy link

Thanks for the PDF this allowed me to resolve some other crashing issues which knocked on from the original crash. But i dont need to return null, the pdf works regardless after the initial crash, i can even create my thumbs etc with no issues.

@maroney-tm
Copy link
Author

What do you mean when you say "the pdf works regardless after the initial crash"? In my app, after you scroll to the page causing the crash I get

E/jniPdfium: Loaded page is null E/AndroidRuntime: FATAL EXCEPTION: PDF renderer Process: <process>, PID: 4912 java.lang.IllegalStateException: cannot load page at com.shockwave.pdfium.PdfiumCore.nativeLoadPage(Native Method) at com.shockwave.pdfium.PdfiumCore.openPage(PdfiumCore.java:137) at com.github.barteksc.pdfviewer.RenderingHandler.proceed(RenderingHandler.java:89) at com.github.barteksc.pdfviewer.RenderingHandler.handleMessage(RenderingHandler.java:71) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.os.HandlerThread.run(HandlerThread.java:61)

Which causes the app to crash and it needing to be launched again.

@1stmetro
Copy link

I investigated and found other issues which I partially fixed to do with concurrent something, after I fixed my orientation bug I added to try catch and I don't need to restart. I can view two blank pages and the see the rest of the pdf.

@maroney-tm
Copy link
Author

I see what you mean now. I just updated the library to 2.8.0 and it is no longer failing.

@maroney-tm maroney-tm closed this Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants