Main Page Widgets Namespaces Book

# Gtk::PrintJob Class Reference
[Printing]

Inheritance diagram for Gtk::PrintJob:

[legend]
List of all members.

## Detailed Description

A PrintJob object represents a job that is sent to a printer.

You only need to deal directly with print jobs if you use the non-portable PrintUnixDialog API.

Use get_surface() to obtain the cairo surface onto which the pages must be drawn. Use send() to send the finished job to the printer.If you don't use cairo then PrintJob also supports printing of manually generated postscript, via set_source_file().

Since gtkmm 2.10:

## Public Types

typedef sigc::slot< void, const Glib::RefPtr<PrintJob >&> | SlotPrintJobComplete
| For example, void on_print_job_complete(const Glib::RefPtr<PrintJob>& job);.

## Public Member Functions

Glib::RefPtr<const Printer> | get_printer () const
| Gets the Gtk::Printer of the print job.
Glib::RefPtr<Printer> | get_printer ()
| Gets the Gtk::Printer of the print job.
Glib::RefPtr<const PrintSettings> | get_settings () const
| Gets the Gtk::PrintSettings of the print job.
Glib::RefPtr<PrintSettings> | get_settings ()
| Gets the Gtk::PrintSettings of the print job.
PrintStatus | get_status () const
| Gets the status of the print job.
Cairo::RefPtr<const Cairo::Surface> | get_surface () const
| Gets a cairo surface onto which the pages of the print job should be rendered.
Cairo::RefPtr<Cairo::Surface> | get_surface ()
| Gets a cairo surface onto which the pages of the print job should be rendered.
Glib::ustring | get_title () const
| Gets the job title.
bool | get_track_print_status () const
| Return value: `true` if print job status will be reported after printing.
const GtkPrintJob* | gobj () const
| Provides access to the underlying C GObject.
GtkPrintJob* | gobj ()
| Provides access to the underlying C GObject.
GtkPrintJob* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PageSetup >> | property_page_setup () const
| Page Setup.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Printer >> | property_printer () const
| Printer to print the job to.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PrintSettings >> | property_settings () const
| Printer settings.
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_title () const
| Title of the print job.
void | send (const SlotPrintJobComplete& slot)
| Sends the print job off to the printer.
void | set_source_file (const std::string& filename)
| Make the Gtk::PrintJob send an existing document to the printing system.
void | set_track_print_status (bool track_status=true)
| If track_status is `true`, the print job will try to continue report on the status of the print job in the printer queues and printer.
Glib::SignalProxy0<void> | signal_status_changed ()

Prototype:
  `void on_my_status_changed()`

virtual | ~PrintJob ()

## Static Public Member Functions

static Glib::RefPtr<PrintJob> | create (const Glib::ustring& title, const Glib::RefPtr<Printer>& printer, const Glib::RefPtr<PrintSettings>& settings, const Glib::RefPtr<PageSetup>& page_setup)

## Protected Member Functions

virtual void | on_status_changed ()
| PrintJob (const Glib::ustring& title, const Glib::RefPtr<Printer>& printer, const Glib::RefPtr<PrintSettings>& settings, const Glib::RefPtr<PageSetup>& page_setup)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr<Gtk::PrintJob> | wrap (GtkPrintJob* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Member Typedef Documentation

typedef sigc::slot<void, const Glib::RefPtr<PrintJob>&> Gtk::PrintJob::SlotPrintJobComplete

For example, void on_print_job_complete(const Glib::RefPtr<PrintJob>& job);.

Exceptions:

  | exception |

## Constructor & Destructor Documentation

virtual Gtk::PrintJob::~PrintJob | ( |  | ) | `[virtual]`

Gtk::PrintJob::PrintJob | ( | const Glib::ustring & | title,
|  | const Glib::RefPtr<Printer>& | printer,
|  | const Glib::RefPtr<PrintSettings>& | settings,
|  | const Glib::RefPtr<PageSetup>& | page_setup |
| ) |  |  | `[explicit, protected]`

## Member Function Documentation

static Glib::RefPtr<PrintJob> Gtk::PrintJob::create | ( | const Glib::ustring & | title,
|  | const Glib::RefPtr<Printer>& | printer,
|  | const Glib::RefPtr<PrintSettings>& | settings,
|  | const Glib::RefPtr<PageSetup>& | page_setup |
| ) |  |  | `[static]`

Glib::RefPtr<const Printer> Gtk::PrintJob::get_printer | ( |  | ) | const

Gets the Gtk::Printer of the print job.

Returns:
  The printer of job

Since gtkmm 2.10:

Glib::RefPtr<Printer> Gtk::PrintJob::get_printer | ( |  | ) |

Gets the Gtk::Printer of the print job.

Returns:
  The printer of job

Since gtkmm 2.10:

Glib::RefPtr<const PrintSettings> Gtk::PrintJob::get_settings | ( |  | ) | const

Gets the Gtk::PrintSettings of the print job.

Returns:
  The settings of job

Since gtkmm 2.10:

Glib::RefPtr<PrintSettings> Gtk::PrintJob::get_settings | ( |  | ) |

Gets the Gtk::PrintSettings of the print job.

Returns:
  The settings of job

Since gtkmm 2.10:

PrintStatus Gtk::PrintJob::get_status | ( |  | ) | const

Gets the status of the print job.

Returns:
  The status of job

Since gtkmm 2.10:

Cairo::RefPtr<const Cairo::Surface> Gtk::PrintJob::get_surface | ( |  | ) | const

Gets a cairo surface onto which the pages of the print job should be rendered.

Parameters:

  | error | Return location for errors, or `0`.

Returns:
  The cairo surface of job

Since gtkmm 2.10:

Cairo::RefPtr<Cairo::Surface> Gtk::PrintJob::get_surface | ( |  | ) |

Gets a cairo surface onto which the pages of the print job should be rendered.

Parameters:

  | error | Return location for errors, or `0`.

Returns:
  The cairo surface of job

Since gtkmm 2.10:

Glib::ustring Gtk::PrintJob::get_title | ( |  | ) | const

Gets the job title.

Returns:
  The title of job

Since gtkmm 2.10:

bool Gtk::PrintJob::get_track_print_status | ( |  | ) | const

Return value: `true` if print job status will be reported after printing.

Returns:
  `true` if print job status will be reported after printing

Since gtkmm 2.10:

const GtkPrintJob* Gtk::PrintJob::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GtkPrintJob* Gtk::PrintJob::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GtkPrintJob* Gtk::PrintJob::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

virtual void Gtk::PrintJob::on_status_changed | ( |  | ) | `[protected, virtual]`

Glib::PropertyProxy_ReadOnly<Glib::RefPtr<PageSetup>> Gtk::PrintJob::property_page_setup | ( |  | ) | const

Page Setup.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Printer>> Gtk::PrintJob::property_printer | ( |  | ) | const

Printer to print the job to.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::RefPtr<PrintSettings>> Gtk::PrintJob::property_settings | ( |  | ) | const

Printer settings.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Glib::ustring> Gtk::PrintJob::property_title | ( |  | ) | const

Title of the print job.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::PrintJob::send | ( | const SlotPrintJobComplete& | slot | ) |

Sends the print job off to the printer.

Parameters:

  | slot | A function to call when the job completes or an error occurs.

void Gtk::PrintJob::set_source_file | ( | const std::string & | filename | ) |

Make the Gtk::PrintJob send an existing document to the printing system.

The file can be in any format understood by the platforms printing system (typically PostScript, but on many platforms PDF may work too). See Gtk::Printer::accepts_pdf() and Gtk::Printer::accepts_ps().

Parameters:

  | filename | The file to be printed.
  | error | Return location for errors.

Returns:
  `false` if an error occurred

Since gtkmm 2.10:

void Gtk::PrintJob::set_track_print_status | ( | bool | track_status = `true` | ) |

If track_status is `true`, the print job will try to continue report on the status of the print job in the printer queues and printer.

This can allow your application to show things like "out of paper" issues, and when the print job actually reaches the printer.

This function is often implemented using some form of polling, so it should not be enabled unless needed.

Since gtkmm 2.10:

Parameters:

  | track_status | `true` to track status after printing.

Glib::SignalProxy0< void > Gtk::PrintJob::signal_status_changed | ( |  | ) |

Prototype:
  `void on_my_status_changed()`

## Friends And Related Function Documentation

Glib::RefPtr<Gtk::PrintJob> wrap | ( | GtkPrintJob * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- printjob.h