Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open document failed #6

Closed
elsennov opened this issue Jun 15, 2016 · 14 comments
Closed

Open document failed #6

elsennov opened this issue Jun 15, 2016 · 14 comments

Comments

@elsennov
Copy link

elsennov commented Jun 15, 2016

Hi, recently i got this error

com.shockwave.pdfium.PdfOpenException: Open document failed
at com.shockwave.pdfium.PdfiumCore.newDocument(PdfiumCore.java:72)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:61)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:32)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)

Do you have any idea why? How could i fix this? Thanks

@elsennov elsennov changed the title Error in opening PDF Open document failed Jun 15, 2016
@barteksc
Copy link
Collaborator

Show some code, there is nothing useful in this stacktrace

@elsennov
Copy link
Author

pdfView.fromFile(pdfFile)
                .defaultPage(DEFAULT_PAGE)
                .showMinimap(false)
                .enableSwipe(true)
                .onLoad(nbPages -> LogUtils.debug(TAG, "onLoad PDF"))
                .onPageChange((page, pageCount) -> LogUtils.debug(TAG, "onPageChange PDF"))
                .onError(throwable -> LogUtils.error(TAG, "Error in opening PDF", throwable))
                .load();

@barteksc
Copy link
Collaborator

Does pdfFile exist (by using pdfFile.exists())?

@elsennov
Copy link
Author

Yes, absolutely i defense the code before passed it

@barteksc
Copy link
Collaborator

What is the path of file? Internal memory, physical SD card?

@elsennov
Copy link
Author

The root is Environment.getExternalStorageDirectory();
This error happened intermittently.

@barteksc
Copy link
Collaborator

It must be issue in native lib, I'll take a look at it yesterday, but it looks strange

@elsennov
Copy link
Author

Okay thank you

@JbDenoual
Copy link

JbDenoual commented Jun 16, 2016

Hi, same error here :
`D/jniPdfium: Init FPDF library

D/ConnectivityReceiver: Internet Connected
D/AbsListView: unregisterIRListener() is called
D/jniPdfium: File Size: 295
D/jniPdfium: Destroy FPDF library
E/jniPdfium: Error loading document from file map
E/jniPdfium: Last Error: 3
E/com.shockwave.pdfium.PdfiumCore: Open document failed
D/v_gal: [tid=26645] gralloc_register_buffer: ===>Width = 480, Height = 800,
E/PDFView: load pdf error
com.shockwave.pdfium.PdfOpenException: Open document failed
at com.shockwave.pdfium.PdfiumCore.newDocument(PdfiumCore.java:72)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:61)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:32)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)`

Looks like getNumFd() catched an IllegalAccessException and returned -1

@barteksc
Copy link
Collaborator

@jayDLabs You got Pdfium error 3, it means that PDF is corrupted or some other unknown error occurred. Check if you can open this file in another reader

@JbDenoual
Copy link

Exact, the PDF is corrupted, something went wrong when downloading it on my side, my bad.
Thank you !

@barteksc
Copy link
Collaborator

@elsennov please check if version 1.1.0 fixes this issue

@elsennov
Copy link
Author

@barteksc ok

@elsennov
Copy link
Author

elsennov commented Jun 17, 2016

Seems it has been solved in 1.1.0. No crash occurred! Thanks @barteksc

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

No branches or pull requests

3 participants