Printoperation dunno howto

hi,

i managed to print some pages, header, footer positioned, i liked it,
almost felt it done.
then i wanted to extend my treeview class with a print capability,

but then i confronted with the fact, that i don’t know how many pages do
i need to print,
since i wanna have header, footer on the pages, and i don’t wanna miss
a character, so i set ellipsize to off and wrap to word,
but then i can’t estimate the height of my text lines,
so i have to lay the table to on the context so i can count the pages
and feed printoperation with it before printing, as it is in the docs.

i realized, i’m moving my code from draw_page event into paginate event.
and then i found that in paginate i have the context only of the first
page,
while in draw_page i could use the context of all the pages one by one.

first i thought i’ll have to construct the print context for
printoperation in paginate and have only a cairo::context.stroke per
page in the draw_page event.
but that can’t be done.

so i concluded that i have to lay all my headers, footers, table
headers, some rows of table data on paginate’s context
only to count how many table rows i was able to lay, so clear the
context an continue the laying of pango stuff like it was a the next
page.
and the end i get the number of my pages, and can start
printoperation.run, who will call draw_page and i can lay everything
again and stroke at the end.

but then it came to me, this has to be wrong, this is not how it’s
supposed to be.

so please, anyone, who has a clue about printing like this, point me to
the right direction.

thanks,
Balint

Hi,

On Mon, 20 Nov 2006 11:16:55 +0200
Dobai-Pataky Bálint [email protected] wrote:

hi,

i managed to print some pages, header, footer positioned, i liked it,
almost felt it done.
then i wanted to extend my treeview class with a print capability,

so please, anyone, who has a clue about printing like this, point me to
the right direction.

I think you are the first person who try Gtk::Print and stuffs on this
list.
So I think anyone can’t help you now.
I hope you find a good solution by yourself and introduce your code
anywhere.


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi,

Masao M. wrote:

I think you are the first person who try Gtk::Print and stuffs on this list.
So I think anyone can’t help you now.
I hope you find a good solution by yourself and introduce your code
anywhere.
Dobai-Pataky, it would be great if you could send sample scripts for the
Gtk::Print stuff. It is just not obvious how the different classes work
together.

Mathieu


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi Bálint,

Dobai-Pataky Bálint wrote:

any progress Mathieu?
Sorry about your first name in my last email!

I have tested your script today. I have two bugs with it:

  1. If I try to print some text in a PDF file (I don’t have a printer) I
    get :
    mathieu@mathieu-desktop:~/Desktop$ ruby printer2.rb
  • status changed: Initial state
  • status changed: Preparing to print
    begin-print called
    paginate called, pages: 0
    printer2.rb:33: undefined method get_page_height' for nil:NilClass from printer2.rb:145 from printer2.rb:173 /usr/local/lib/site_ruby/1.8/glib2.rb:45:in exit’: exit
    from /usr/local/lib/site_ruby/1.8/glib2.rb:45:in
    exit_application' from printer2.rb:33:in run’
    from printer2.rb:145
    from printer2.rb:173
  1. Whenever I click “cancel” or “apply” on the page setup dialog, I get:
    mathieu@mathieu-desktop:~/Desktop$ ruby printer2.rb
    ruby: symbol lookup error:
    /usr/local/lib/site_ruby/1.8/i486-linux/gtk2.so: undefined symbol:
    GOBJ2RVALU

When I compile Ruby/Gtk, I indeed get some warnings about GOBJ2RVALU
(and other things). See below. I can’t figure out why this macro is said
to be missing since looking at rbgobject.h, it is actually defined!

mathieu@mathieu-desktop:~/Desktop/sources/ruby-gnome2-cvs/gtk$ make >
/dev/null
rbgdkpixbuf.c: In function pixbuf_s_from_drawable': rbgdkpixbuf.c:118: warning: implicit declaration of function GOBJ2RVALU’
rbgtkpagesetup.c: In function ps_copy': rbgtkpagesetup.c:31: warning: implicit declaration of function GOBJ2RVALU’
rbgtkpapersize.c: In function ps_initialize': rbgtkpapersize.c:29: warning: implicit declaration of function RVAL2CSTR2’
rbgtkpapersize.c:29: warning: passing arg 1 of gtk_paper_size_new' makes pointer from integer without a cast rbgtkprintcontext.c: In function pc_create_pango_context’:
rbgtkprintcontext.c:69: warning: implicit declaration of function
GOBJ2RVALU' rbgtkprintoperation.c: In function po_run_page_setup_dialog’:
rbgtkprintoperation.c:113: warning: implicit declaration of function
GOBJ2RVALU' rbgtkprintsettings.c: In function ps_copy’:
rbgtkprintsettings.c:32: warning: implicit declaration of function
GOBJ2RVALU' rbgtkprintsettings.c: In function ps_set’:
rbgtkprintsettings.c:50: warning: implicit declaration of function
RVAL2CSTR2' rbgtkprintsettings.c:50: warning: passing arg 3 of gtk_print_settings_set’ makes pointer from integer without a cast
rbgtkprintsettings.c: In function ps_set_printer': rbgtkprintsettings.c:257: warning: passing arg 2 of gtk_print_settings_set_printer’ makes pointer from integer without a
cast
rbgtkprintsettings.c: In function ps_set_default_source': rbgtkprintsettings.c:518: warning: passing arg 2 of gtk_print_settings_set_default_source’ makes pointer from integer
without a cast
rbgtkprintsettings.c: In function ps_set_media_type': rbgtkprintsettings.c:531: warning: passing arg 2 of gtk_print_settings_set_media_type’ makes pointer from integer without a
cast
rbgtkprintsettings.c: In function ps_set_dither': rbgtkprintsettings.c:544: warning: passing arg 2 of gtk_print_settings_set_dither’ makes pointer from integer without a
cast
rbgtkprintsettings.c: In function ps_set_finishings': rbgtkprintsettings.c:557: warning: passing arg 2 of gtk_print_settings_set_finishings’ makes pointer from integer without a
cast
rbgtkprintsettings.c: In function ps_set_output_bin': rbgtkprintsettings.c:570: warning: passing arg 2 of gtk_print_settings_set_output_bin’ makes pointer from integer without a
cast
rbgtkrecentchooserdialog.c: In function rcd_initialize': rbgtkrecentchooserdialog.c:31: warning: implicit declaration of function RVAL2CSTR2’
rbgtkwidget.c: In function widget_create_pango_context': rbgtkwidget.c:617: warning: implicit declaration of function GOBJ2RVALU’
rbgtkwidget.c: In function widget_create_pango_layout': rbgtkwidget.c:635: warning: implicit declaration of function RVAL2CSTR2’
rbgtkwidget.c:635: warning: passing arg 2 of
gtk_widget_create_pango_layout' makes pointer from integer without a cast rbgtkwidget.c: In function widget_render_icon’:
rbgtkwidget.c:648: warning: passing arg 4 of `gtk_widget_render_icon’
makes pointer from integer without a cast

Mathieu


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi,

Masao M. wrote:

Hi,

GOBJ2RVALU, RVAL2CSTR2 are defined in the latest Ruby/GLib2.
Compile the CVS version of Ruby/GLib2 first, then recompile Ruby/GTK2
again.

No it does not work even though I am compiling the up-to-date CVS
version. Strange.

Mathieu


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Hi,

GOBJ2RVALU, RVAL2CSTR2 are defined in the latest Ruby/GLib2.
Compile the CVS version of Ruby/GLib2 first, then recompile Ruby/GTK2
again.

On Thu, 23 Nov 2006 17:42:32 +0800
Mathieu B. [email protected] wrote:

mathieu@mathieu-desktop:~/Desktop$ ruby printer2.rb
from printer2.rb:145
to be missing since looking at rbgobject.h, it is actually defined!
makes pointer from integer without a cast
rbgtkprintsettings.c:50: warning: implicit declaration of function
rbgtkprintsettings.c: In function ps_set_media_type': rbgtkprintsettings.c: In function ps_set_output_bin’:
rbgtkwidget.c:635: warning: passing arg 2 of
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


ruby-gnome2-devel-en mailing list
[email protected]
ruby-gnome2-devel-en List Signup and Options


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net’s Techsay panel and you’ll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV