Re: printing content of goocanvasmm



Hi Klaus,

The Canvas documentation mentions a method render (https://developer.gnome.org/goocanvasmm/stable/classGoocanvas_1_1Canvas.html#a54aa434b9bfa110dc74e1435b9a6f81d), which can be used to draw the canvas onto a cairo context of your choosing. 

I think you can use this method from a Gtk::PrintOperation’s signal_draw_page handler, where the cairo context can be fetched from the printcontext using get_cairo_context.

I explained a similar workflow in https://tschoonj.github.io/blog/2015/07/05/embedding-plplot-in-gtk-drawingareas/ where you can send the contents of a Gtk::DrawingArea to either a file or a printer.

Best,

Tom

On 29 Dec 2017, at 13:12, Klaus Rudolph <lts-rudolph gmx de> wrote:

I want to print the content of a goocanvasmm.

The only resource I found about printing is: https://developer.gnome.org/gtkmm-tutorial/stable/chapter-printing.html.en

This is very very complex and I did not catch how I can involve a canvas here. All I found is a very magic class "PrintFormOperation" which can be filled with "comments" which will later be printed. Maybe I misunderstood that completely. But this was the only connection I found from the text widget to the printing. No idea how that works!

But coming form this point it looks I have to completely write my own method to render the canvas into some kind of Pango...something. Wow! I have never looked so deep into the gtkmm stuff.

Can somebody give me a hint how to rewrite the canvasmm to get a print output. Sorry, but I have never written code to directly render something. And rewriting all the stuff for canvas looks very unlucky...

Maybe there is some document to start reading with?

The job sounds so simple: Print a canvas, but after looking in the printing example I am totally confused :-(

Regards
Klaus
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list



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