Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

[Flutter Web] PlatformException(error, InvalidPDFException: Invalid PDF structure., null, null) #122

Open
sherrylin728 opened this issue Jun 21, 2023 · 5 comments

Comments

@sherrylin728
Copy link

I used the following code, and it displays correctly on mobile, but I encounter the following error on the web app. Could you please help me identify the issue?

body:
      PdfViewer.openFile(
        widget.path!,
        viewerController: controller,
        onError: (err) => print(err),
        params: const PdfViewerParams(
          padding: 10,
          minScale: 1.0,
          // scrollDirection: Axis.horizontal,
        ),
      ),

Error message
PlatformException(error, InvalidPDFException: Invalid PDF structure., null, null)

@AkashBonito
Copy link

I'm also facing the same issue.

@Terranic
Copy link

Terranic commented Feb 28, 2024

observing a similar issue with Flutter web

does not work with PdfViewer.openAsset(...) or PdfViewer.openData(...)
also tried it with different version from 1.3.1 - 1.4.6, but never worked.

PlatformException(error, TypeError: Cannot read properties of undefined (reading 'getDocument'), null, null)

@espresso3389
Copy link
Owner

Basically, Web version uses different PDF engine from other platforms.
Do you test your PDF file with pdf.js Demo?

@RobertoGeek12
Copy link

Any solution ? I am getting the same issue PlatformException(error, InvalidPDFException: Invalid PDF structure., null, null)

@espresso3389
Copy link
Owner

espresso3389 commented Jun 28, 2024

@RobertoGeek12
Basically, it means the PDF file is broken or somehow complex structure that pdf.js could not open due to some limitation or some bug.

So anyway, could you please firstly check whether it can be opened or not by pdf.js demo.

If the demo site can open it, it means the issue may be just a bug or a limitation of the pdf.js version used by pdfrx; the bug may be fixed by upgrading pdf.js used by pdfrx.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants