gpt4 book ai didi

linux - GTK-打印 : detect if printer is configured/printing would work?

转载 作者:太空宇宙 更新时间:2023-11-04 11:06:13 24 4
gpt4 key购买 nike

使用下面的代码我可以在Linux下顺利打印:

op = gtk_print_operation_new();
gtk_print_operation_set_allow_async(op,TRUE);
gtk_print_operation_set_n_pages(op, 1);
gtk_print_operation_set_unit (op,GTK_UNIT_MM);
g_signal_connect (op, "draw_page", G_CALLBACK(draw_page), NULL);
gtk_print_operation_run (op, GTK_PRINT_OPERATION_ACTION_PRINT,NULL, NULL);

我的问题:当打印不成功时(例如因为没有配置打印机) draw_page() 没有被调用,但我没有任何关于失败的反馈。那么:如何检查打印是否完成?

最佳答案

怎么样

void
gtk_print_operation_get_error (GtkPrintOperation *op,
GError **error);

Call this when the result of a print operation is GTK_PRINT_OPERATION_RESULT_ERROR, either as returned by gtk_print_operation_run(), or in the “done” signal handler. The returned GError will contain more details on what went wrong.

关于linux - GTK-打印 : detect if printer is configured/printing would work?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25167383/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com