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

[2.8.0 pdfx] Exception: Unknow error when loading on web #534

Open
FelixUngerhoferAS opened this issue Sep 27, 2024 · 0 comments
Open

[2.8.0 pdfx] Exception: Unknow error when loading on web #534

FelixUngerhoferAS opened this issue Sep 27, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@FelixUngerhoferAS
Copy link

Describe the bug
When I run the web app, it first shows the DocumentLoaderBuilder (Progress Indicator), but then an unknown error occurs after loading and it doesn't show the pdf. I'm running the web app on a Mac. On my colleague's Linux, it works, and it also works when deploying it using Docker.

To Reproduce
This is our code:
Data is a pdf file that has to be retrieved. The same error also occurs when using openAsset with a stored pdf file.

Future<void> showFileDialog(BuildContext context, FutureOr<Uint8List> data, String displayName) async {

    final pdfPinchController = PdfControllerPinch(
      document: PdfDocument.openData(data),
    );

    return showDialog<void>(
      context: context,
      barrierDismissible: true,
      builder: (BuildContext context) {
        return StatefulBuilder(
          builder: (context, setState) {

            return AlertDialog(
              title: Row(
                children: [
                  Expanded(
                      child: Text(
                        displayName,
                        style: const TextStyle(fontWeight: FontWeight.bold),
                        textScaler: const TextScaler.linear(0.7),
                      )
                  ),

                  IconButton(
                      onPressed: (){
                        Navigator.of(context).pop();
                      },
                      icon: const Icon(Icons.close_rounded)
                  ),
                ],
              ),
              content: SizedBox(
                width: MediaQuery.of(context).size.height * 0.7,
                height: MediaQuery.of(context).size.height * 0.8,
                child:
                PdfViewPinch(
                  controller: pdfPinchController,
                  builders: PdfViewPinchBuilders<DefaultBuilderOptions>(
                    options: const DefaultBuilderOptions(),
                    documentLoaderBuilder: (_) =>
                      const Center(child: CircularProgressIndicator()),
                    pageLoaderBuilder: (_) =>
                      const Center(child: CircularProgressIndicator()),
                    errorBuilder: (_, error) {
                      return Center(child: Text(error.toString()));
                    },
                  ),
                ),
              ),
            );
          },
        );
      },
    );
  }

Expected behavior
An error occurs after loading.

@FelixUngerhoferAS FelixUngerhoferAS added the bug Something isn't working label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants