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

Help, Get worker.min.js leak when resize flutter web #135

Open
anggaaryas opened this issue Nov 27, 2023 · 1 comment
Open

Help, Get worker.min.js leak when resize flutter web #135

anggaaryas opened this issue Nov 27, 2023 · 1 comment

Comments

@anggaaryas
Copy link

Screenshot 2023-11-27 120827

Dont know whats wrong with my code

 Expanded(
            child: openedFile != null
                ? PdfViewer.openData(openedFile!,
                    viewerController: controller,)
                : Container())

index.html script. i have qrcode scanner, and google maps api too but it is normal. I suspect that the bug is from worker

pdfjsLib.GlobalWorkerOptions.workerSrc =
   "https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.worker.min.js";
  <script src="https://unpkg.com/@zxing/[email protected]" type="application/javascript"></script>

  <!-- This script adds the flutter initialization JS code -->
  <script src="flutter.js" defer></script>

  <script src="https://maps.googleapis.com/maps/api/js?key=API-KEY"></script>

  <!-- IMPORTANT: load pdfjs files -->
  <script
          src="https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.min.js"
          type="text/javascript"
  ></script>
  <script type="text/javascript">
  pdfjsLib.GlobalWorkerOptions.workerSrc =
    "https://cdn.jsdelivr.net/npm/[email protected]/build/pdf.worker.min.js";
  pdfRenderOptions = {
    // where cmaps are downloaded from
    cMapUrl: "https://cdn.jsdelivr.net/npm/[email protected]/cmaps/",
    // The cmaps are compressed in the case
    cMapPacked: true,
    // any other options for pdfjsLib.getDocument.
    // params: {}
  };
</script>

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.13.9, on Microsoft Windows [Version 10.0.22631.2715], locale id-ID)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.4.4)
[√] Android Studio (version 2023.1)
[√] VS Code (version 1.85.0-insider)
[√] Connected device (3 available)
[√] Network resources

• No issues found!
@anggaaryas
Copy link
Author

anggaaryas commented Nov 27, 2023

I thinks it is related to #126 too because its flash and re download the pdf.js . Maybe bug when rebuilding viewer 🤔

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

1 participant