如何使用wxWidgets获取打印机的状态和发送到打印机的作业

How to get the status of printer and the job sent to a printer using wxWidgets

本文关键字:打印机 作业 状态 获取 何使用 wxWidgets      更新时间:2023-10-16

如何使用wxWidgets获取打印机的状态和发送到打印机的作业。找到打印机

我要做的事情是:1. 找一台打印机。2. 检查打印机状态。3.将作业发送打印。4. 作业失败/完成后返回。

您学习了wxWidgets打印概述吗?

http://docs.wxwidgets.org/stable/wx_printingoverview.html

您可以查询print调用后的最后一个错误,如下所示:

wxPrinter printer;
MyPrintout printout("My printout");
printer.Print(this, &printout, true);
wxPrinterError errorCode = printer.GetLastError();

返回值可以是:

wxPRINTER_NO_ERROR    No error happened.
wxPRINTER_CANCELLED   The user cancelled printing.
wxPRINTER_ERROR       There was an error during printing. 

查看更多参考:http://docs.wxwidgets.org/stable/wx_wxprinter.html#wxprinterprint