Print Spooler已在PrintManager中停止

时间:2016-09-08 12:58:38

标签: android print-spooler-api

我正在使用PrintManager(加载webview时),如下所示:

PrintManager printManager = (PrintManager) getSystemService(Context.PRINT_SERVICE);
PrintDocumentAdapter printAdapter = webView.createPrintDocumentAdapter(jobName));
printManager.print(jobName, printAdapter, new PrintAttributes.Builder().build());

单击“保存”按钮时,HTML将另存为pdf。 当此过程非常快速地完成时,即在加载预览时,获得以下异常 “不幸的是Print Spooler已经停止了”

process: com.android.printspooler, PID: 5705
                                                 java.lang.IllegalArgumentException: end cannot be less than zero.
                                                     at android.print.PageRange.<init>(PageRange.java:50)
                                                     at com.android.printspooler.util.PageRangeUtils.asAbsoluteRange(PageRangeUtils.java:199)
                                                     at com.android.printspooler.ui.PrintActivity$DocumentTransformer.computePagesToShred(PrintActivity.java:2620)
                                                     at com.android.printspooler.ui.PrintActivity$DocumentTransformer.<init>(PrintActivity.java:2496)
                                                     at com.android.printspooler.ui.PrintActivity.transformDocumentAndFinish(PrintActivity.java:1733)
                                                     at com.android.printspooler.ui.PrintActivity.-wrap15(PrintActivity.java)
                                                     at com.android.printspooler.ui.PrintActivity$4.run(PrintActivity.java:620)
                                                     at android.os.Handler.handleCallback(Handler.java:739)
                                                     at android.os.Handler.dispatchMessage(Handler.java:95)
                                                     at android.os.Looper.loop(Looper.java:148)
                                                     at android.app.ActivityThread.main(ActivityThread.java:5417)
                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

任何解决或捕获此异常的建议

0 个答案:

没有答案