Re: printing goocanvasmm



On Fri, 2014-08-29 at 18:00 +0200, Klaus Rudolph wrote:
I simply want to print a goocanvasmm / Goocanvas::Canvas object.

I found an example how to print in principal, but I can't adapt to the canvas at all.

What I found: 
http://developer.gnome.org/gtkmm-tutorial/3.9/sec-printing-example.html.en

But I have no idea to get the content of the canvas involved.

Any documentation, any hints, maybe a demo program or sources of a program which uses goocanvasmm and do 
printing?


The C documentation for goo_canvas_render() may help:


This example code could be used in a GtkPrintOperation "draw-page"
callback to print each page in a multi-page document (assuming the pages
appear one after the other vertically in the canvas). Note the call to
cairo_translate() to translate the output to the correct position on the
printed page.

GooCanvasBounds bounds;
bounds.x1 = 0;
bounds.x2 = A4_PAGE_WIDTH;
bounds.y1 = A4_PAGE_HEIGHT * page_num;
bounds.y2 = A4_PAGE_HEIGHT * (page_num + 1);

cr = gtk_print_context_get_cairo_context (print_context);
cairo_translate (cr, 0, -A4_PAGE_HEIGHT * page_num);
goo_canvas_render (GOO_CANVAS (canvas), cr, &bounds, 0.0);


The C++ code should be pretty similar.

Damon




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]