CefView / QCefView

A Qt Widget encapsulated CEF view based on QWidget
https://cefview.github.io/QCefView/
GNU Lesser General Public License v2.1
521 stars 137 forks source link

[BUG]: Linux下,打印功能不可用,程序崩溃 #317

Open L-Super opened 11 months ago

L-Super commented 11 months ago

Describe the bug 【Bug描述】

在Linux平台下运行QCefViewTest程序,右键选择打印,程序崩溃,报错信息:

[0915/161844.284269:ERROR:print_dialog_linux.cc(156)] Null interface in CreatePrintDialog; printing will fail.
[0915/161844.284334:ERROR:device_event_log_impl.cc(222)] [16:18:44.284] Printer: print_error_dialog.cc:61 所选打印机无法使用或未正确安装。请检查打印机,或尝试选择其他打印机。
[0915/161844.286439:FATAL:message_box_dialog.cc(231)] Check failed: !is_system_modal. 

直接使用js的window.print(),或者开发者工具里调用window.print()均会导致程序崩溃。

另外,测试cefclient、cefsimple,NCW,OSR模式下均可以正常调用打印对话框,不会崩溃。

To Reproduce 【复现步骤】

  1. 调用打印功能
  2. 崩溃

Expected behavior 【正确的预期行为】

调用系统打印对话框

Screenshots 【截图】

...

Environment 【BUG产生的环境】

Additional context 【更多额外信息】

测试平台:UOS、Ubuntu 22.04.3 LTS

oufengfang commented 3 months ago

我也碰到这个问题,有初步的怀疑原因吗?

L-Super commented 3 months ago

我也碰到这个问题,有初步的怀疑原因吗?

当时怀疑是没有实现打印功能

oufengfang commented 3 months ago

是没实现,实现这个接口就好了:/// /// Implement this interface to handle printing on Linux. Each browser will have /// only one print job in progress at a time. The methods of this class will be /// called on the browser process UI thread. /// /--cef(source=client)--/ class CefPrintHandler : public virtual CefBaseRefCounted {

L-Super commented 3 months ago

是没实现,实现这个接口就好了:/// /// Implement this interface to handle printing on Linux. Each browser will have /// only one print job in progress at a time. The methods of this class will be /// called on the browser process UI thread. /// /--cef(source=client)--/ class CefPrintHandler : public virtual CefBaseRefCounted {

如果可以的话,欢迎提交PR