Not Able To Open Pdf In New Activity
I'm using this github source for my project. I've a listview with 10 elements and 10 different PDFs in assets folder. In 1 activity, I'm using listview and onItemClickListener as s
Solution 1:
intent.putExtra(PdfViewerActivity.EXTRA_PDFFILENAME, getAssets() + "/dummy.pdf");
getAssets() returns an AssetManager. getAssets() + "/dummy.pdf" calls toString() on the AssetManager instance, and then appends /dummy.pdf to it. This is why you wind up with android.content.res.AssetManager@817d40c/dummy.pdf. toString() on AssetManager does not somehow magically give you a filesystem path to an asset... in part because assets are not files on the device.
How can I work around it?
Either:
Follow the instructions in that issue and copy the asset to a file, or
Modify that library to support an asset, or
Do not use that library, but use something else that does support displaying a PDF from an asset
FWIW, I have sample apps demonstrating the use of pdf.js and pdfium for displaying PDFs from assets.
Post a Comment for "Not Able To Open Pdf In New Activity"