0

I am getting an error when I try to load pdf from internal storage. It is saying that the file or directory has not been found. This is in my android application.

File myfile= new File(openPDF.this.getFilesDir().getAbsolutePath() +"/"+fileName);

        final PDFView pdfView=findViewById(R.id.pdfView);


      //  pdfView =(PDFView)findViewById(R.id.pdfView);
        // pdfView.fromUri(Uri.parse(Utils.getRootDirPath(this)+"/"+filename))
        // pdfView.fromAsset("aqida1.pdf")

        pdfView.fromFile(myfile)
                .enableSwipe(true) // allows to block changing pages using swipe
                .swipeHorizontal(false)
                .enableDoubletap(true)
                .defaultPage(0)// called after document is rendered for the first time
                .enableAntialiasing(true) // improve rendering a little bit on low-res screens
                .enableAnnotationRendering(true)
                .scrollHandle(new DefaultScrollHandle(getApplicationContext(), false))
                .onRender(new OnRenderListener() {
                    @Override
                    public void onInitiallyRendered(int nbPages, float pageWidth, float pageHeight) {
                        pdfView.fitToWidth();


                    }
                })
                .load();
        pdfView.useBestQuality(true);
        pdfView.getKeepScreenOn();

2019-06-18 05:36:58.680 11555-11555/comechoman.dailynation E/PDFView: load pdf error 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:25) at android.os.AsyncTask$2.call(AsyncTask.java:335) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764) 2019-06-18 05:36:58.714 11555-11610/comechoman.dailynation E/[EGL-ERROR]: __egl_platform_cancel_buffers:644: surface->num_buffers(4) 2019-06-18 05:37:13.152 274-274/? E/memtrack_graphic: graphic_memtrack_get_memory error to open /sys/kernel/debug/ion/clients/593: Permission denied

Kishan Viramgama
  • 893
  • 1
  • 11
  • 23

0 Answers0