cesarvr / pdf-generator

Cordova plugin to generate pdf in the client-side
MIT License
106 stars 62 forks source link

Open the pdf pending. #71

Closed sharutza closed 6 years ago

sharutza commented 6 years ago

Plugin version 2.0.1 When trying to open the document I got the loader and the message "Preparing preview..." and it remains like this. When trying to debug the code in library it manages to open the document after all. I use hockey app and I got the next crash report: "org.chromium.android_webview.AwPdfExporter.exportToPdf java.lang.IllegalStateException: printing is already pending AwPdfExporter.java, line 8"

java.lang.IllegalStateException: printing is already pending at org.chromium.android_webview.AwPdfExporter.exportToPdf(AwPdfExporter.java:8) at org.chromium.android_webview.AwPrintDocumentAdapter.onWrite(AwPrintDocumentAdapter.java:29) at com.pdf.generator.PDFPrinter.onWrite(PDFPrinter.java:62) at android.print.PrintManager$PrintDocumentAdapterDelegate$MyHandler.handleMessage(PrintManager.java:1071) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6682) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

sharutza commented 6 years ago

The problem seemed to be that I was trying to show an alert in the "then" function, which was blocking the preview. Now works fine.