android-pdfview
android-pdfview copied to clipboard
Load pdf from downloads folder ?
Is it possible to open a pdf from the downloads folder ( or any other folder ) ? I am using the pdfView.fromFile() method, but I only get a white blank screen.
It is possible dude, Look at what i did:
String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/myAppFolder/" + "example.pdf";
pdfView.fromFile(new File(path))
.load();
Hope it would help!
I tried with this snippet but got these errors. can you guess what may cause it and what I need to do.
FATAL EXCEPTION: AsyncTask #1 Process: com.enableit.eboimelabd, PID: 18358 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.RuntimeException: PDF file is corrupted at org.vudroid.pdfdroid.codec.PdfDocument.open(Native Method) at org.vudroid.pdfdroid.codec.PdfDocument.openDocument(PdfDocument.java:28) at org.vudroid.pdfdroid.codec.PdfContext.openDocument(PdfContext.java:18) at org.vudroid.core.DecodeServiceBase.open(DecodeServiceBase.java:59) at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:52) at com.joanzapata.pdfview.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:31) at android.os.AsyncTask$2.call(AsyncTask.java:288) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)
@milon87
Look the error is:
Caused by: java.lang.RuntimeException: PDF file is corrupted
I guess you have set the file name wrong! You have to call the file by the exact name you used to save it! for example if you saved the file by name "money", you have to use "money" not "money.pdf" !
Be careful about it, save the file with fileName + fileFormat, and call the both to open it,
.
I hope it would help dude :-)
Thanka. yes it is.