NAME

Gtk2::Ex::PrintDialog - a simple, pure Perl dialog for printing PostScript data in GTK+ applications.

SYNOPSIS

use Gtk2::Ex::PrintDialog;

my $dialog = Gtk2::Ex::PrintDialog->new;	# a new dialog

$dialog->set_data($postscript_data);		# supply some postscript data

$dialog->set_filename($postscript_file);	# get postscript from a file

$dialog->run;					# show the dialog to the user

DESCRIPTION

This module implements a dialog widget that can be used to print PostScript data on any CUPS-aware system. It is intended to be a lightweight and pure-perl alternative to the Gnome2::Print libraries.

The dialog itself is intended to comply with the GNOME Human Interface Guidelines (HIG), and will gracefully fail if no printers have been installed, by providing an option to print to the lpr command. If lpr isn't installed either, the user can opt to print to another command, to a PDF file or to a PostScript file.

OBJECT HIERARCHY

Glib::Object
+----Gtk2::Object
     +----Gtk2::Widget
          +----Gtk2::Container
               +----Gtk2::Bin
                    +----Gtk2::Window
                         +----Gtk2::Dialog
                              +----Gtk2::Ex::PrintDialog

METHODS

my $dialog = Gtk2::Ex::PrintDialog->new;

Returns an instance of Gtk2::Ex::PrintDialog. These dialogs are subclasse of Gtk2::Dialog so all corresponding methods, signals and properties from that class are also available.

The dialog will handle user actions itself so you will probably not need to connect to any signals.

$dialog->set_data($data);

This tells the dialog to use the PostScript data in $data. This might be PostScript data you create yourself, or from another application. This data can subsequently retrieved using get_data().

$dialog->set_filename($file);

This tells the dialog to use the PostScript data in $file. The file name can be subsequently retrieved using get_filename(). The contents of the file are read into memory when set_filename() is called, so any subequent calls to get_data() will return the contents of $file.

LOCALISATION ISSUES

If the Locale::gettext module is available on the system, and your application uses it, all the strings used in the dialog will be automagically translated, as long as these default values are translated in your .mo files.

PREREQUISITES

Gtk2
Locale::gettext (recommended)
Net::CUPS
Ghostscript, for the ps2pdf command (recommended)

SEE ALSO

Gnome2::Print

TO DO

Implement a "Print Preview" function, maybe using Poppler.

AUTHOR

Gavin Brown (gavin dot brown at uk dot com)

COPYRIGHT

(c) 2005 Gavin Brown. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.