what am I doing wrong?
I've got this method:
private void displayFromUrl(PDFView pdfView, String pdfUrl) {
Uri uri = Uri.parse( pdfUrl );
pdfView.fromUri(uri)
.defaultPage(0)
.enableAnnotationRendering(true)
.spacing(10) // in dp
.load();
}
and when I call it with URL https://staging.jennylife.com/media/pdfs/MIB_Prenotice_CA.pdf
it comes back with:
08-29 22:21:33.671 E/PDFView: load pdf error
java.io.FileNotFoundException: No content provider: https://staging.jennylife.com/media/pdfs/MIB_Prenotice_CA.pdf
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1135)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:986)
at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:839)
at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:793)
at com.github.barteksc.pdfviewer.source.UriSource.createDocument(UriSource.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:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Passing PDF from URI.
new RetrivePDFStream().execute(filePath);
class RetrivePDFStream extends AsyncTask
@override
protected InputStream doInBackground(String... strings) {
InputStream inputStream = null;
try {
URL uri = new URL(strings[0]);
HttpURLConnection urlConnection = (HttpURLConnection) uri.openConnection();
if (urlConnection.getResponseCode() == 200) {
inputStream = new BufferedInputStream(urlConnection.getInputStream());
}
} catch (IOException e) {
return null;
}
return inputStream;
}
@override
protected void onPostExecute(InputStream inputStream) {
pdfView.fromStream(inputStream).password("Your Password").load();
}
}
Where u are saving ur pdf file
On Thu, 28 Feb 2019 at 8:56 PM IstrateAndrei notifications@github.com
wrote:
@abiemann https://github.com/abiemann I have the same problem and I
tried @shaanvipul https://github.com/shaanvipul 's solution but didn't
work. Did it work for you?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/barteksc/AndroidPdfViewer/issues/671#issuecomment-468314722,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARK-7JgSldLeSoMoHweZNdmpfXGttM1rks5vR_VCgaJpZM4WSRPm
.
I'm facing the same issue on this project please suggest to me.
2019-10-09 14:50:21.711 16992-16992/com.github.barteksc.sample E/PDFView: load pdf error
java.io.FileNotFoundException: No content provider: http://nwls.s3.amazonaws.com/temp/pdf/axmoore.pdf
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1580)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1431)
at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1278)
at android.content.ContentResolver.openFileDescriptor(ContentResolver.java:1232)
at com.github.barteksc.pdfviewer.source.UriSource.createDocument(UriSource.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)
so bad when can not run url pdf?
Most helpful comment
Passing PDF from URI.
new RetrivePDFStream().execute(filePath);
class RetrivePDFStream extends AsyncTask {
@override
protected InputStream doInBackground(String... strings) {
InputStream inputStream = null;
try {
URL uri = new URL(strings[0]);
HttpURLConnection urlConnection = (HttpURLConnection) uri.openConnection();
if (urlConnection.getResponseCode() == 200) {
inputStream = new BufferedInputStream(urlConnection.getInputStream());
}
} catch (IOException e) {
return null;
}
return inputStream;
}
@override
protected void onPostExecute(InputStream inputStream) {
pdfView.fromStream(inputStream).password("Your Password").load();
}
}