I have played with the new gtk+ printing support.
I use gtk+ 2.10.6 with MinGW on Windows.

I have a pixbuf and I want to print it in A4 format.

the problem is:
when beginning the print process, the "Dimension" of the printing file 
(to printer) is 126 MB !!,
the process is slow and heavy....


this is the function that is performed when I press the button "print":

void   print_pixbuf()
{
    GtkPrintOperation *op;
    GtkPrintOperationResult res;
    GtkPrintSettings *settings;

    op = gtk_print_operation_new ();

    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);
    res = gtk_print_operation_run (op, 
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, NULL);
}

the callback function connected is:

static void
draw_page (GtkPrintOperation *operation,
GtkPrintContext *context,
int page_nr)
{
    cairo_t *cr = gtk_print_context_get_cairo_context (context);

    cairo_surface_t *image;
   

    gdk_cairo_set_source_pixbuf(cr, rotated_pixbuf, 0, 0);
    cairo_paint (cr);
    cairo_surface_destroy (image);

}

in alternative I have tried (with same result):

static void
draw_page (GtkPrintOperation *operation,
GtkPrintContext *context,
int page_nr)
{
cairo_surface_t *image;


cairo_t *cr = gtk_print_context_get_cairo_context (context);

gdk_pixbuf_save (rotated_pixbuf, "tmp.png", "png", 0L,  NULL);

image = cairo_image_surface_create_from_png ("tmp.png");

cairo_set_source_surface (cr, image, 0, 0);
cairo_paint (cr);
cairo_surface_destroy (image);

}

thanks
 Alessandro


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to