Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syncfusion_flutter_pdfviewer : iOS & android - Certain pdf documents are not loading (grey screen) #2267

Closed
Youssefbenmlih opened this issue Feb 3, 2025 · 7 comments
Labels
pdf viewer PDF viewer component

Comments

@Youssefbenmlih
Copy link

Youssefbenmlih commented Feb 3, 2025

Bug description

Certain pdf documents are not working (i upload it here but I get the pdf from a link):
[CS] 2025-01-29 ok.pdf

The document loads well with other packages such as pdfview.

Steps to reproduce

Put code smaple into showModalBottomSheet builder, run with .memory (it doesnt work with memory as well so you can) to use the pdf bytes, if the link of the pdf is needed i would like to give it privatly as it expires every 5 min.

Code sample

Code sample
class SyncfusionPDFView extends StatefulWidget {
  const SyncfusionPDFView(
      {super.key, required this.url, required this.controller});

  final String url;
  final PdfViewerController controller;

  @override
  State<SyncfusionPDFView> createState() => _SyncfusionPDFViewState();
}

class _SyncfusionPDFViewState extends State<SyncfusionPDFView> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return SfPdfViewer.network(
      widget.url,
      pageLayoutMode: PdfPageLayoutMode.single,
      controller: widget.controller,
      onDocumentLoaded: (PdfDocumentLoadedDetails details) {
        debugPrint("PDF Loaded Successfully");
      },
      onDocumentLoadFailed: (PdfDocumentLoadFailedDetails details) {
        debugPrint("Failed to load PDF: ${details.description}");
      },
    );
  }
}

It might be important to note that this widget is called in a showModalBottomSheet.

Screenshots or Video

Screenshots / Video demonstration

here is the behavior :
Image
certain documents do load well though.

Stack Traces

Stack Traces error : Image
_description = "There was an error opening this document."
_error = "Error"
description = "There was an error opening this document."
error = "Error"
hashCode = 4076443810
runtimeType = Type (PdfDocumentLoadFailedDetails)
    hashCode = 599428335... etc...

On which target platforms have you observed this bug?

iOS

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 3.29.0-1.0.pre.209, on macOS 15.2 24C101 darwin-arm64, locale fr-FR)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.96.4)
[✓] Connected device (5 available)
[✓] Network resources
@VijayakumarMariappan VijayakumarMariappan added pdf viewer PDF viewer component open Open labels Feb 4, 2025
@Youssefbenmlih
Copy link
Author

I'm using latest version of package (28.2.4), and tested multiple versions but none work.

@immankumarsync
Copy link
Contributor

Hi @Youssefbenmlih, we are able to replicate the reported issue where the specific PDF document is not loading in the SfPdfViewer widget. Currently, we are validating this issue and will provide further updates once the root cause is identified.

@Youssefbenmlih
Copy link
Author

Hi @Youssefbenmlih, we are able to replicate the reported issue where the specific PDF document is not loading in the SfPdfViewer widget. Currently, we are validating this issue and will provide further updates once the root cause is identified.

Any news ?

@immankumarsync
Copy link
Contributor

Hi @Youssefbenmlih,

We have confirmed the issue “TypeError occurs when getting the bounds of the form field in a specific document.” as a defect in our product and we will include the fix in any of the upcoming weekly release. We will notify once the fix is included in the weekly release.

Please use the below feedback link to track the status of the reported bug.
https://www.syncfusion.com/feedback/65279/typeerror-occurs-when-getting-the-bounds-of-the-form-field-in-a-specific-document

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”

@sebipirpi
Copy link

Hi @Youssefbenmlih, do you have any workaround? Is there something that can be done to the PDF so that the exception doesn't occur?

@immankumarsync
Copy link
Contributor

Hi @Youssefbenmlih,
We have included the fix for the reported issue "TypeError occurs when getting the bounds of the form field in a specific document." in our weekly release (v28.2.9).

Package link: syncfusion_flutter_pdf v28.2.9

**Root cause: **

The reported issue occurs when attempting to retrieve the bounds value of the form fields from a specific PDF document. The bounds value is typically retrieved as a double; however, in our case, an int value appears, leading to an exception.

@Deepak1799
Copy link
Collaborator

We are closing this as we believe the issue has been resolved. If you need further assistance or have any additional questions, please feel free to reopen the case or reach out to us at any time.

@Deepak1799 Deepak1799 removed the open Open label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pdf viewer PDF viewer component
Projects
None yet
Development

No branches or pull requests

5 participants