I tried to load the pdf file from the documents folder. I shared the error and code snippet for your reference like this
java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
at android.os.ParcelFileDescriptor.openInternal(ParcelFileDescriptor.java:313)
at android.os.ParcelFileDescriptor.open(ParcelFileDescriptor.java:211)
at com.github.barteksc.pdfviewer.source.FileSource.createDocument(FileSource.java:37)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:53)
at com.github.barteksc.pdfviewer.DecodingAsyncTask.doInBackground(DecodingAsyncTask.java:27)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
val f = File(
Environment.getExternalStorageDirectory()
.absolutePath,"/Documents/MindOrks_Android_Online_Professional_Course-Syllabus.pdf")
pdfView.fromFile(f)
.swipeHorizontal(false)
.enableDoubletap(true)
.defaultPage(0)
.enableAnnotationRendering(false)
.password(null)
.scrollHandle(null)
.load()
according to me, the error is in the file path for the PDF, not in the library part. Java isn't able to find the file to which you are giving the path to.
I tried to load the pdf file from the documents folder. I shared the error and code snippet for your reference like this
and my emulator is in android R