Here's a hacked-up version of your previous code, with Emmanuele's fixes and several of my own, that prints something. Just substitute your own image for "foshizzle.png".-=-=-=-=-=- #!/usr/bin/perl -w use strict; use Glib qw/TRUE FALSE/; use Gtk2 '-init'; use Gnome2::Print; my $job = Gnome2::Print::Job->new; my $config = Gnome2::Print::Config->default; my $context = $job->get_context; $context->beginpage("1"); my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file ('foshizzle.png'); # rgbimage draws an image "in a unit square in the current coordinate # system." thus, in order to draw it at any decent size, we need to # transform and scale. $context->gsave; my ($page_width, $page_height) = $config->get_page_size; $context->translate (($page_width - $pixbuf->get_width) / 2, ($page_height - $pixbuf->get_height) / 2); $context->scale ($pixbuf->get_width, $pixbuf->get_height); $context->rgbimage ($pixbuf->get_pixels, $pixbuf->get_width, $pixbuf->get_height, $pixbuf->get_row_stride); $context->grestore; # alright, now we're finished. $context->showpage; $job->render ($context); $job->close; my $preview = Gnome2::Print::JobPreview->new ($job, 'Preview Window'); $preview->show; $preview->signal_connect (destroy => sub {Gtk2->main_quit}); Gtk2->main;
Works fine. Thank u very very much. _______________________________________________ gtk-perl-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtk-perl-list
