Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

Application crashing when displaying PDF from the Web #105

Open
noorbakerally opened this issue Mar 16, 2022 · 1 comment
Open

Application crashing when displaying PDF from the Web #105

noorbakerally opened this issue Mar 16, 2022 · 1 comment

Comments

@noorbakerally
Copy link

I am getting the following error when displaying a PDF from the Web.

I/System.out(22362): Already closed
W/System.err(22362): java.lang.IllegalStateException: Already closed
W/System.err(22362): 	at android.graphics.pdf.PdfRenderer.throwIfClosed(PdfRenderer.java:267)
W/System.err(22362): 	at android.graphics.pdf.PdfRenderer.close(PdfRenderer.java:185)
W/System.err(22362): 	at pt.tribeiro.flutter_plugin_pdf_viewer.FlutterPluginPdfViewerPlugin.getPage(FlutterPluginPdfViewerPlugin.java:206)
W/System.err(22362): 	at pt.tribeiro.flutter_plugin_pdf_viewer.FlutterPluginPdfViewerPlugin.access$100(FlutterPluginPdfViewerPlugin.java:31)
W/System.err(22362): 	at pt.tribeiro.flutter_plugin_pdf_viewer.FlutterPluginPdfViewerPlugin$1.run(FlutterPluginPdfViewerPlugin.java:84)
W/System.err(22362): 	at android.os.Handler.handleCallback(Handler.java:907)
W/System.err(22362): 	at android.os.Handler.dispatchMessage(Handler.java:105)
W/System.err(22362): 	at android.os.Looper.loop(Looper.java:216)
W/System.err(22362): 	at android.os.HandlerThread.run(HandlerThread.java:65)
D/PdfViewerPlugin(22362): Retrieving page failed.
D/AndroidRuntime(22362): Shutting down VM
W/ireui.fluxstor(22362): Accessing hidden method Lcom/msic/qarth/PatchStore;->createDisableExceptionQarthFile(Ljava/lang/Throwable;)Z (blacklist, JNI)
E/ireui.fluxstor(22362): [qarth_debug:]  get PatchStore::createDisableExceptionQarthFile method fail.
I/flutter (22362): ℹ️[10:46:31-4631ms]MissingPluginException(No implementation found for method getPage on channel flutter_plugin_pdf_viewer)
I/flutter (22362): ℹ️[10:46:31-4631ms]#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:175:7)
I/flutter (22362): <asynchronous suspension>
I/flutter (22362): #1      PDFDocument.get (package:advance_pdf_viewer/src/document.dart:97:18)
I/flutter (22362): <asynchronous suspension>
I/flutter (22362): #2      _PDFViewerState._loadPage (package:advance_pdf_viewer/src/viewer.dart:151:18)
I/flutter (22362): <asynchronous suspension>
I/flutter (22362): 
E/AndroidRuntime(22362): FATAL EXCEPTION: main
E/AndroidRuntime(22362): Process: com.inspireui.fluxstore, PID: 22362
E/AndroidRuntime(22362): java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(22362): 	at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:431)
E/AndroidRuntime(22362): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:267)
E/AndroidRuntime(22362): 	at pt.tribeiro.flutter_plugin_pdf_viewer.FlutterPluginPdfViewerPlugin$1$2.run(FlutterPluginPdfViewerPlugin.java:92)
E/AndroidRuntime(22362): 	at android.os.Handler.handleCallback(Handler.java:907)
E/AndroidRuntime(22362): 	at android.os.Handler.dispatchMessage(Handler.java:105)
E/AndroidRuntime(22362): 	at android.os.Looper.loop(Looper.java:216)
E/AndroidRuntime(22362): 	at android.app.ActivityThread.main(ActivityThread.java:7625)
E/AndroidRuntime(22362): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(22362): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/AndroidRuntime(22362): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
I/Process (22362): Sending signal. PID: 22362 SIG: 9

Here are my codes:


import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
import 'package:flutter/material.dart';

class PDFViewerContainer extends StatefulWidget {


  const PDFViewerContainer({
    Key? key,
  }) : super(key: key);

  @override
  State<StatefulWidget> createState() {
    return PDFViewerContainerState();
  }
}

class PDFViewerContainerState extends State<PDFViewerContainer>  {
  late PDFDocument document;
  bool isLoading = true;
  String url = "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf";

  @override
  void initState() {
    Future.delayed(Duration.zero,() async {
      document = await PDFDocument.fromURL(url);
      setState(() {
        isLoading = false;
      });
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    if (isLoading){
      return CircularProgressIndicator();
    } else {
      return PDFViewer(document: document,);
    }
  }
}
@locnt19
Copy link

locnt19 commented Mar 17, 2022

hello guy, you can check here:

#102 (comment)
and here

#102 (comment)

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

2 participants