1

我想使用 Linux 打印出一些矢量数据。这就是我已经拥有的:

GtkPrintOperation *op;

op = gtk_print_operation_new();
gtk_print_operation_set_n_pages(op, 1);
gtk_print_operation_set_unit (op,GTK_UNIT_POINTS);
g_signal_connect (op, "draw_page", G_CALLBACK(draw_page), NULL);
if (data->config.m_printparams==1) 
    gtk_print_operation_run(op, GTK_PRINT_OPERATION_ACTION_PRINT,NULL, NULL);
else
    gtk_print_operation_run (op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,NULL, NULL);

draw_page当然也存在:

static void draw_page (GtkPrintOperation *operation,GtkPrintContext *context,int page_nr)
{
   GtkPrintSettings *settings;

   cairo_t *cr = gtk_print_context_get_cairo_context (context);
   settings = gtk_print_operation_get_print_settings (operation);
   ...do some printing stuff here...
}

不幸的是,它不起作用,gtk_print_operation_run()永远阻塞并且draw_page()永远不会被调用。有什么想法可能是错的吗?

4

0 回答 0