-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
[BUG] IOException: file not in PDF format or corrupted #114
Comments
Thank you for creating your first issue. We appreciate your help in making this project better. We will look into it, and get back to you soon. Need help or want to discuss this issue? Join our Discord community here to ask questions and discuss this issue live! |
Hey @dookki, do you mind sharing the URL of the pdf and your implementation if possible. |
Hey The url I'm using is https://css4.pub/2015/textbook/somatosensory.pdf
|
If it cannot be reproduced, you can replace a relatively large pdf, then close it when it is loaded again, and then reopen it. It should be the problem that the resource is not released when the loading is not successful. |
After checking, it is found that it is caused by the if (cachedFile.exists()) of the PdfDownloader checkAndDownload. If it is closed without downloading successfully, the file is damaged and tries to modify it. However, this will trigger a re-download every time.
|
Or modify it like this.
|
Hi, The Above issue has been fixed in new release. https://github.com/afreakyelf/Pdf-Viewer/releases/tag/v2.1.0 Please migrate to Maven central. More here: https://github.com/afreakyelf/Pdf-Viewer/releases/tag/v2.1.0 Thank you for using the library. Please reopen/raise a new issue if you still face this error. Join our discord for more updates! |
I apologize for the delayed response. Thank you for fixing this error. |
I'm still facing the same issue when I try to open a random txt file as a PDF using |
The issue still persists and I cannot catch it since the compiler does not allow to catch it: try {
reportPdfView.initWithFile(internalReportFile);
} catch (IOException ioException) { // ERROR: Exception 'java. io. IOException' is never thrown in the corresponding try block
// but the IOException CAN actually be thrown if the file is corrupt...
finish();
} |
📝 Describe the Bug
Recently I encountered some problems with the app crash IOException, about malformed links or broken links (404)..., this case does not fall into the onError function in PdfRendererView.StatusCallBack, even though I catch the exception with try, catch but it still happens
📖 Library Version
The text was updated successfully, but these errors were encountered: