我想用Linux打印出一些vectordata。这就是我已经拥有的东西:
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()
。什么想法可能是错的?