Failing to load some PDFs using PdfViewer.uri
Hi,
First off, thanks for the great package! I've been testing it, and most PDFs load without any issues. However, I’ve encountered a few that don’t seem to load—for example, https://www.st.com/resource/en/data_brief/nucleo-wb05kz.pdf.
I'm using errorBannerBuilder to handle errors, but it doesn’t get triggered. Instead, the loading widget remains stuck indefinitely. Here’s the code I’m using:
PdfViewer.uri(
Uri.parse('https://www.st.com/resource/en/data_brief/nucleo-wb05kz.pdf'),
params: PdfViewerParams(
panAxis: PanAxis.aligned,
backgroundColor: context.theme.scaffoldBackgroundColor,
loadingBannerBuilder: (context, bytesDownloaded, totalBytes) {
return const CircularProgressIndicator();
},
errorBannerBuilder: (context, error, stackTrace, documentRef) {
print('Stacktrace $stackTrace');
return SizedBox.shrink();
},
),
);
It seems like loadingBannerBuilder at the start and totalBytes is null. After that it is not called again.
Any idea what might be causing this?
Thanks!
It seems to be a server side issue but anyway I want to fix the nearly infinite(?) blocking issue.
Once the file is downloaded, the file is correctly shown in the viewer.
+1
Any updates on this one?
I am facing similar infinite loading issue. I have few pdfs which I cannot share due to privacy concerns. However, the pdf url https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf has the same issue. Please note that this loads on Web, and the issue persists only on IOS & Android.
~~@nirmal-kc Your PDF is correctly shown in the viewer. Possibly, different issue?~~
By the way, the ultimate cause of the issue is http.Request.send's blocking and I have googled it several times but I didn't find any cure for that...
@espresso3389, hmmmmm let me see if I can look into this one. For now, I tried switching the pfd's location to a different cloud path, and the issue just vanished. It is working for now, but will still try to search for multiple pdf's from the same host.
@nirmal-kc, your issue seems to be a different issue and should be discussed on #330.
For the original issue, now the viewer immediately returns error; it means it does not fix the loading error but it no longer stucks indefinitely.
So anyway, I don't close the issue anyway.
I want to close the issue anyway. If you find any problems or such, please file a new issue again.