pdfrx icon indicating copy to clipboard operation
pdfrx copied to clipboard

Failing to load some PDFs using PdfViewer.uri

Open AndyDavidJoyce opened this issue 10 months ago • 6 comments

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!

AndyDavidJoyce avatar Feb 12 '25 17:02 AndyDavidJoyce

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.

espresso3389 avatar Feb 13 '25 00:02 espresso3389

+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 avatar Mar 14 '25 03:03 nirmal-kc

~~@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 avatar Mar 14 '25 13:03 espresso3389

@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 avatar Mar 17 '25 05:03 nirmal-kc

@nirmal-kc, your issue seems to be a different issue and should be discussed on #330.

espresso3389 avatar Mar 17 '25 06:03 espresso3389

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.

espresso3389 avatar Mar 17 '25 06:03 espresso3389

I want to close the issue anyway. If you find any problems or such, please file a new issue again.

espresso3389 avatar Jul 18 '25 09:07 espresso3389