Gtk::PrintOperation Class Reference
Printing

PrintOperation is the high-level, portable printing API. More...

`#include <gtkmm/printoperation.h>`

Inheritance diagram for Gtk::PrintOperation:
[legend]

## Public Member Functions

| PrintOperation (PrintOperation&& src) noexcept
PrintOperation& | operator= (PrintOperation&& src) noexcept
| ~PrintOperation () noexcept override
GtkPrintOperation* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkPrintOperation* | gobj () const
| Provides access to the underlying C GObject. More...
GtkPrintOperation* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
void | set_default_page_setup (const Glib::RefPtr< PageSetup >& default_page_setup)
| Makes default_page_setup the default page setup for op. More...
Glib::RefPtr< PageSetup > | get_default_page_setup ()
| Returns the default page setup, see set_default_page_setup(). More...
Glib::RefPtr< const PageSetup > | get_default_page_setup () const
| Returns the default page setup, see set_default_page_setup(). More...
void | set_print_settings (const Glib::RefPtr< PrintSettings >& print_settings)
| Sets the print settings for op. More...
Glib::RefPtr< PrintSettings > | get_print_settings ()
| Returns the current print settings. More...
Glib::RefPtr< const PrintSettings > | get_print_settings () const
| Returns the current print settings. More...
void | set_job_name (const Glib::ustring& job_name)
| Sets the name of the print job. More...
void | set_n_pages (int n_pages)
| Sets the number of pages in the document. More...
void | set_current_page (int current_page)
| Sets the current page. More...
void | set_use_full_page (bool use_full_page=true)
| If use_full_page is `true`, the transformation for the cairo context obtained from Gtk::PrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet). More...
void | set_unit (Unit unit)
| Sets up the transformation for the cairo context obtained from Gtk::PrintContext in such a way that distances are measured in units of unit. More...
void | set_export_filename (const std::string& filename)
| Sets up the Gtk::PrintOperation to generate a file instead of showing the print dialog. More...
void | set_track_print_status (bool track_status=true)
| If track_status is `true`, the print operation will try to continue report on the status of the print job in the printer queues and printer. More...
void | set_show_progress (bool show_progress=true)
| If show_progress is `true`, the print operation will show a progress dialog during the print operation. More...
void | set_allow_async (bool allow_async=true)
| Sets whether the run() may return before the print operation is completed. More...
void | set_custom_tab_label (const Glib::ustring& label)
| Sets the label for the tab holding custom widgets. More...
PrintOperationResult | run (PrintOperationAction action=PRINT_OPERATION_ACTION_PRINT_DIALOG)
| See the run() method that takes both action and parent parameters. More...
PrintOperationResult | run (PrintOperationAction action, Window& parent)
| Runs the print operation, by first letting the user modify print settings in the print dialog, and then print the document. More...
PrintStatus | get_status () const
| Returns the status of the print operation. More...
Glib::ustring | get_status_string () const
| Returns a string representation of the status of the print operation. More...
void | cancel ()
| Cancels a running print operation. More...
bool | is_finished () const
| A convenience function to find out if the print operation is finished, either successfully (Gtk::PRINT_STATUS_FINISHED) or unsuccessfully (Gtk::PRINT_STATUS_FINISHED_ABORTED). More...
void | draw_page_finish ()
| Signalize that drawing of particular page is complete. More...
void | set_defer_drawing ()
| Sets up the Gtk::PrintOperation to wait for calling of draw_page_finish() from application. More...
void | set_support_selection (bool support_selection=true)
| Sets whether selection is supported by Gtk::PrintOperation. More...
bool | get_support_selection () const
| Gets the value of Gtk::PrintOperation::property_support_selection() property. More...
void | set_has_selection (bool has_selection=true)
| Sets whether there is a selection to print. More...
bool | get_has_selection () const
| Gets the value of Gtk::PrintOperation::property_has_selection() property. More...
void | set_embed_page_setup (bool embed=true)
| Embed page size combo box and orientation combo box into page setup page. More...
bool | get_embed_page_setup () const
| Gets the value of Gtk::PrintOperation::property_embed_page_setup() property. More...
int | get_n_pages_to_print () const
| Returns the number of pages that will be printed. More...
Glib::SignalProxy< void, PrintOperationResult > | signal_done ()
Glib::SignalProxy< void, const Glib::RefPtr< PrintContext >& > | signal_begin_print ()
Glib::SignalProxy< bool, const Glib::RefPtr< PrintContext >& > | signal_paginate ()
Glib::SignalProxy< void, const Glib::RefPtr< PrintContext >&, int, const Glib::RefPtr< PageSetup >& > | signal_request_page_setup ()
Glib::SignalProxy< void, const Glib::RefPtr< PrintContext >&, int > | signal_draw_page ()
Glib::SignalProxy< void, const Glib::RefPtr< PrintContext >& > | signal_end_print ()
Glib::SignalProxy< void > | signal_status_changed ()
Glib::SignalProxy< Widget* > | signal_create_custom_widget ()
Glib::SignalProxy< void, Widget* > | signal_custom_widget_apply ()
Glib::SignalProxy< bool, const Glib::RefPtr< PrintOperationPreview >&, const Glib::RefPtr< PrintContext >&, Window* > | signal_preview ()
Glib::SignalProxy< void, Widget*, const Glib::RefPtr< PageSetup >&, const Glib::RefPtr< PrintSettings >& > | signal_update_custom_widget ()
Glib::PropertyProxy< Glib::RefPtr< PageSetup > > | property_default_page_setup ()
| The Gtk::PageSetup used by default. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PageSetup > > | property_default_page_setup () const
| The Gtk::PageSetup used by default. More...
Glib::PropertyProxy< Glib::RefPtr< PrintSettings > > | property_print_settings ()
| The Gtk::PrintSettings used for initializing the dialog. More...
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PrintSettings > > | property_print_settings () const
| The Gtk::PrintSettings used for initializing the dialog. More...
Glib::PropertyProxy< Glib::ustring > | property_job_name ()
| A string used to identify the job (e.g. in monitoring applications like eggcups). More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_job_name () const
| A string used to identify the job (e.g. in monitoring applications like eggcups). More...
Glib::PropertyProxy< int > | property_n_pages ()
| The number of pages in the document. More...
Glib::PropertyProxy_ReadOnly< int > | property_n_pages () const
| The number of pages in the document. More...
Glib::PropertyProxy< int > | property_current_page ()
| The current page in the document. More...
Glib::PropertyProxy_ReadOnly< int > | property_current_page () const
| The current page in the document. More...
Glib::PropertyProxy< bool > | property_use_full_page ()
| If `true`, the transformation for the cairo context obtained from Gtk::PrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet). More...
Glib::PropertyProxy_ReadOnly< bool > | property_use_full_page () const
| If `true`, the transformation for the cairo context obtained from Gtk::PrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet). More...
Glib::PropertyProxy< bool > | property_track_print_status ()
| If `true`, the print operation will try to continue report on the status of the print job in the printer queues and printer. More...
Glib::PropertyProxy_ReadOnly< bool > | property_track_print_status () const
| If `true`, the print operation will try to continue report on the status of the print job in the printer queues and printer. More...
Glib::PropertyProxy< Unit > | property_unit ()
| The transformation for the cairo context obtained from Gtk::PrintContext is set up in such a way that distances are measured in units of unit. More...
Glib::PropertyProxy_ReadOnly< Unit > | property_unit () const
| The transformation for the cairo context obtained from Gtk::PrintContext is set up in such a way that distances are measured in units of unit. More...
Glib::PropertyProxy< bool > | property_show_progress ()
| Determines whether to show a progress dialog during the print operation. More...
Glib::PropertyProxy_ReadOnly< bool > | property_show_progress () const
| Determines whether to show a progress dialog during the print operation. More...
Glib::PropertyProxy< bool > | property_allow_async ()
| Determines whether the print operation may run asynchronously or not. More...
Glib::PropertyProxy_ReadOnly< bool > | property_allow_async () const
| Determines whether the print operation may run asynchronously or not. More...
Glib::PropertyProxy< std::string > | property_export_filename ()
| The name of a file to generate instead of showing the print dialog. More...
Glib::PropertyProxy_ReadOnly< std::string > | property_export_filename () const
| The name of a file to generate instead of showing the print dialog. More...
Glib::PropertyProxy_ReadOnly< PrintStatus > | property_status () const
| The status of the print operation. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_status_string () const
| A string representation of the status of the print operation. More...
Glib::PropertyProxy< Glib::ustring > | property_custom_tab_label ()
| Used as the label of the tab containing custom widgets. More...
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_custom_tab_label () const
| Used as the label of the tab containing custom widgets. More...
Glib::PropertyProxy< bool > | property_support_selection ()
| If `true`, the print operation will support print of selection. More...
Glib::PropertyProxy_ReadOnly< bool > | property_support_selection () const
| If `true`, the print operation will support print of selection. More...
Glib::PropertyProxy< bool > | property_has_selection ()
| Determines whether there is a selection in your application. More...
Glib::PropertyProxy_ReadOnly< bool > | property_has_selection () const
| Determines whether there is a selection in your application. More...
Glib::PropertyProxy< bool > | property_embed_page_setup ()
| If `true`, page size combo box and orientation combo box are embedded into page setup page. More...
Glib::PropertyProxy_ReadOnly< bool > | property_embed_page_setup () const
| If `true`, page size combo box and orientation combo box are embedded into page setup page. More...
Glib::PropertyProxy_ReadOnly< int > | property_n_pages_to_print () const
| The number of pages that will be printed. More...
Public Member Functions inherited from Gtk::PrintOperationPreview
| PrintOperationPreview (PrintOperationPreview&& src) noexcept
PrintOperationPreview& | operator= (PrintOperationPreview&& src) noexcept
| ~PrintOperationPreview () noexcept override
GtkPrintOperationPreview* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkPrintOperationPreview* | gobj () const
| Provides access to the underlying C GObject. More...
void | render_page (int page_nr)
| Renders a page to the preview, using the print context that was passed to the Gtk::PrintOperation::signal_preview() handler together with preview. More...
void | end_preview ()
| Ends a preview. More...
bool | is_selected (int page_nr) const
| Returns whether the given page is included in the set of pages that have been selected for printing. More...
virtual void | render_page_vfunc (int page_nr)
virtual void | end_preview_vfunc ()
virtual bool | is_selected_vfunc (int page_nr) const
Glib::SignalProxy< void, const Glib::RefPtr< PrintContext >& > | signal_ready ()
Glib::SignalProxy< void, const Glib::RefPtr< PrintContext >&, const Glib::RefPtr< PageSetup >& > | signal_got_page_size ()

## Static Public Member Functions

static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< PrintOperation > | create ()
Static Public Member Functions inherited from Gtk::PrintOperationPreview
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...

## Protected Member Functions

| PrintOperation ()
virtual void | on_done (PrintOperationResult result)
| This is a default handler for the signal signal_done(). More...
virtual void | on_begin_print (const Glib::RefPtr< PrintContext >& context)
| This is a default handler for the signal signal_begin_print(). More...
virtual bool | on_paginate (const Glib::RefPtr< PrintContext >& context)
| This is a default handler for the signal signal_paginate(). More...
virtual void | on_request_page_setup (const Glib::RefPtr< PrintContext >& context, int page_no, const Glib::RefPtr< PageSetup >& setup)
| This is a default handler for the signal signal_request_page_setup(). More...
virtual void | on_draw_page (const Glib::RefPtr< PrintContext >& context, int page_nr)
| This is a default handler for the signal signal_draw_page(). More...
virtual void | on_end_print (const Glib::RefPtr< PrintContext >& context)
| This is a default handler for the signal signal_end_print(). More...
virtual void | on_status_changed ()
| This is a default handler for the signal signal_status_changed(). More...
virtual Widget* | on_create_custom_widget ()
| This is a default handler for the signal signal_create_custom_widget(). More...
virtual void | on_custom_widget_apply (Widget* widget)
| This is a default handler for the signal signal_custom_widget_apply(). More...
virtual bool | on_preview (const Glib::RefPtr< PrintOperationPreview >& preview, const Glib::RefPtr< PrintContext >& context, Window* parent)
| This is a default handler for the signal signal_preview(). More...
Protected Member Functions inherited from Gtk::PrintOperationPreview
| PrintOperationPreview ()
| You should derive from this class to use it. More...
virtual void | on_ready (const Glib::RefPtr< PrintContext >& context)
| This is a default handler for the signal signal_ready(). More...
virtual void | on_got_page_size (const Glib::RefPtr< PrintContext >& context, const Glib::RefPtr< PageSetup >& page_setup)
| This is a default handler for the signal signal_got_page_size(). More...

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gtk::PrintOperation > | wrap (GtkPrintOperation* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...
Related Functions inherited from Gtk::PrintOperationPreview
Glib::RefPtr< Gtk::PrintOperationPreview > | wrap (GtkPrintOperationPreview* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Detailed Description

PrintOperation is the high-level, portable printing API.

It looks a bit different than other GTK+ dialogs such as the FileChooser, since some platforms don't expose enough infrastructure to implement a good print dialog. On such platforms, PrintOperation uses the native print dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see PrintUnixDialog.

The typical way to use the high-level printing API is to create a PrintOperation object when the user chooses to print. Then you set some properties on it,such as the page size, any PrintSettings from previous print operations, the number of pages, the current page, etc.

Then you start the print operation by calling run(). It will then show a dialog to let the user select a printer and options. When the user finishes the dialog various signals will be emitted by the PrintOperation for you to handle, the main one being draw_page. You should then render the page on the provided PrintContext using Cairo.

Since gtkmm 2.10:

## Constructor & Destructor Documentation

## PrintOperation() [1/2]

Gtk::PrintOperation::PrintOperation | ( | PrintOperation&& | src | ) |

noexcept

## ~PrintOperation()

Gtk::PrintOperation::~PrintOperation | ( |  | ) |

override noexcept

## PrintOperation() [2/2]

Gtk::PrintOperation::PrintOperation | ( |  | ) |

protected

## Member Function Documentation

## cancel()

void Gtk::PrintOperation::cancel | ( |  | ) |

Cancels a running print operation.

This function may be called from a Gtk::PrintOperation::signal_begin_print(), Gtk::PrintOperation::signal_paginate() or Gtk::PrintOperation::signal_draw_page() signal handler to stop the currently running print operation.

Since gtkmm 2.10:

## create()

static Glib::RefPtr<PrintOperation> Gtk::PrintOperation::create | ( |  | ) |

static

## draw_page_finish()

void Gtk::PrintOperation::draw_page_finish | ( |  | ) |

Signalize that drawing of particular page is complete.

It is called after completion of page drawing (e.g. drawing in another thread). If set_defer_drawing() was called before, then this function has to be called by application. In another case it is called by the library itself.

Since gtkmm 2.16:

## get_default_page_setup() [1/2]

Glib::RefPtr<PageSetup> Gtk::PrintOperation::get_default_page_setup | ( |  | ) |

Returns the default page setup, see set_default_page_setup().

Since gtkmm 2.10:

Returns
  The default page setup.

## get_default_page_setup() [2/2]

Glib::RefPtr<const PageSetup> Gtk::PrintOperation::get_default_page_setup | ( |  | ) | const

Returns the default page setup, see set_default_page_setup().

Since gtkmm 2.10:

Returns
  The default page setup.

## get_embed_page_setup()

bool Gtk::PrintOperation::get_embed_page_setup | ( |  | ) | const

Gets the value of Gtk::PrintOperation::property_embed_page_setup() property.

Since gtkmm 2.18:

Returns
  Whether page setup selection combos are embedded.

## get_has_selection()

bool Gtk::PrintOperation::get_has_selection | ( |  | ) | const

Gets the value of Gtk::PrintOperation::property_has_selection() property.

Since gtkmm 2.18:

Returns
  Whether there is a selection.

## get_n_pages_to_print()

int Gtk::PrintOperation::get_n_pages_to_print | ( |  | ) | const

Returns the number of pages that will be printed.

Note that this value is set during print preparation phase (Gtk::PRINT_STATUS_PREPARING), so this function should never be called before the data generation phase (Gtk::PRINT_STATUS_GENERATING_DATA). You can connect to the Gtk::PrintOperation::signal_status_changed() signal and call get_n_pages_to_print() when print status is Gtk::PRINT_STATUS_GENERATING_DATA. This is typically used to track the progress of print operation.

Since gtkmm 2.18:

Returns
  The number of pages that will be printed.

## get_print_settings() [1/2]

Glib::RefPtr<PrintSettings> Gtk::PrintOperation::get_print_settings | ( |  | ) |

Returns the current print settings.

Note that the return value is `nullptr` until either set_print_settings() or run() have been called.

Since gtkmm 2.10:

Returns
  The current print settings of op.

## get_print_settings() [2/2]

Glib::RefPtr<const PrintSettings> Gtk::PrintOperation::get_print_settings | ( |  | ) | const

Returns the current print settings.

Note that the return value is `nullptr` until either set_print_settings() or run() have been called.

Since gtkmm 2.10:

Returns
  The current print settings of op.

## get_status()

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

Returns the status of the print operation.

Also see get_status_string().

Since gtkmm 2.10:

Returns
  The status of the print operation.

## get_status_string()

Glib::ustring Gtk::PrintOperation::get_status_string | ( |  | ) | const

Returns a string representation of the status of the print operation.

The string is translated and suitable for displaying the print status e.g. in a Gtk::Statusbar.

Use get_status() to obtain a status value that is suitable for programmatic use.

Since gtkmm 2.10:

Returns
  A string representation of the status of the print operation.

## get_support_selection()

bool Gtk::PrintOperation::get_support_selection | ( |  | ) | const

Gets the value of Gtk::PrintOperation::property_support_selection() property.

Since gtkmm 2.18:

Returns
  Whether the application supports print of selection.

## get_type()

static GType Gtk::PrintOperation::get_type | ( |  | ) |

static

Get the GType for this class, for use with the underlying GObject type system.

## gobj() [1/2]

GtkPrintOperation* Gtk::PrintOperation::gobj | ( |  | ) |

inline

Provides access to the underlying C GObject.

## gobj() [2/2]

const GtkPrintOperation* Gtk::PrintOperation::gobj | ( |  | ) | const

inline

Provides access to the underlying C GObject.

## gobj_copy()

GtkPrintOperation* Gtk::PrintOperation::gobj_copy | ( |  | ) |

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

## is_finished()

bool Gtk::PrintOperation::is_finished | ( |  | ) | const

A convenience function to find out if the print operation is finished, either successfully (Gtk::PRINT_STATUS_FINISHED) or unsuccessfully (Gtk::PRINT_STATUS_FINISHED_ABORTED).

Note
  when you enable print status tracking the print operation can be in a non-finished state even after done has been called, as the operation status then tracks the print job status on the printer.

Since gtkmm 2.10:

Returns
  `true`, if the print operation is finished.

## on_begin_print()

virtual void Gtk::PrintOperation::on_begin_print | ( | const Glib::RefPtr< PrintContext >& | context | ) |

protected virtual

This is a default handler for the signal signal_begin_print().

## on_create_custom_widget()

virtual Widget* Gtk::PrintOperation::on_create_custom_widget | ( |  | ) |

protected virtual

This is a default handler for the signal signal_create_custom_widget().

## on_custom_widget_apply()

virtual void Gtk::PrintOperation::on_custom_widget_apply | ( | Widget* | widget | ) |

protected virtual

This is a default handler for the signal signal_custom_widget_apply().

## on_done()

virtual void Gtk::PrintOperation::on_done | ( | PrintOperationResult | result | ) |

protected virtual

This is a default handler for the signal signal_done().

## on_draw_page()

virtual void Gtk::PrintOperation::on_draw_page | ( | const Glib::RefPtr< PrintContext >& | context,
|  | int | page_nr
| ) |  |

protected virtual

This is a default handler for the signal signal_draw_page().

## on_end_print()

virtual void Gtk::PrintOperation::on_end_print | ( | const Glib::RefPtr< PrintContext >& | context | ) |

protected virtual

This is a default handler for the signal signal_end_print().

## on_paginate()

virtual bool Gtk::PrintOperation::on_paginate | ( | const Glib::RefPtr< PrintContext >& | context | ) |

protected virtual

This is a default handler for the signal signal_paginate().

## on_preview()

virtual bool Gtk::PrintOperation::on_preview | ( | const Glib::RefPtr< PrintOperationPreview >& | preview,
|  | const Glib::RefPtr< PrintContext >& | context,
|  | Window* | parent
| ) |  |

protected virtual

This is a default handler for the signal signal_preview().

## on_request_page_setup()

virtual void Gtk::PrintOperation::on_request_page_setup | ( | const Glib::RefPtr< PrintContext >& | context,
|  | int | page_no,
|  | const Glib::RefPtr< PageSetup >& | setup
| ) |  |

protected virtual

This is a default handler for the signal signal_request_page_setup().

## on_status_changed()

virtual void Gtk::PrintOperation::on_status_changed | ( |  | ) |

protected virtual

This is a default handler for the signal signal_status_changed().

## operator=()

PrintOperation& Gtk::PrintOperation::operator= | ( | PrintOperation&& | src | ) |

noexcept

## property_allow_async() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintOperation::property_allow_async | ( |  | ) |

Determines whether the print operation may run asynchronously or not.

Some systems don't support asynchronous printing, but those that do will return Gtk::PRINT_OPERATION_RESULT_IN_PROGRESS as the status, and emit the Gtk::PrintOperation::signal_done() signal when the operation is actually done.

The Windows port does not support asynchronous operation at all (this is unlikely to change). On other platforms, all actions except for Gtk::PRINT_OPERATION_ACTION_EXPORT support asynchronous operation.

Since gtkmm 2.10:

Default value: `false`

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

## property_allow_async() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintOperation::property_allow_async | ( |  | ) | const

Determines whether the print operation may run asynchronously or not.

Some systems don't support asynchronous printing, but those that do will return Gtk::PRINT_OPERATION_RESULT_IN_PROGRESS as the status, and emit the Gtk::PrintOperation::signal_done() signal when the operation is actually done.

The Windows port does not support asynchronous operation at all (this is unlikely to change). On other platforms, all actions except for Gtk::PRINT_OPERATION_ACTION_EXPORT support asynchronous operation.

Since gtkmm 2.10:

Default value: `false`

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

## property_current_page() [1/2]

Glib::PropertyProxy< int > Gtk::PrintOperation::property_current_page | ( |  | ) |

The current page in the document.

If this is set before Gtk::PrintOperation::run(), the user will be able to select to print only the current page.

Note that this only makes sense for pre-paginated documents.

Since gtkmm 2.10:

Default value: -1

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

## property_current_page() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::PrintOperation::property_current_page | ( |  | ) | const

The current page in the document.

If this is set before Gtk::PrintOperation::run(), the user will be able to select to print only the current page.

Note that this only makes sense for pre-paginated documents.

Since gtkmm 2.10:

Default value: -1

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

## property_custom_tab_label() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::PrintOperation::property_custom_tab_label | ( |  | ) |

Used as the label of the tab containing custom widgets.

Note that this property may be ignored on some platforms.

If this is `nullptr`, GTK+ uses a default label.

Since gtkmm 2.10:

Default value: ""

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

## property_custom_tab_label() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::PrintOperation::property_custom_tab_label | ( |  | ) | const

Used as the label of the tab containing custom widgets.

Note that this property may be ignored on some platforms.

If this is `nullptr`, GTK+ uses a default label.

Since gtkmm 2.10:

Default value: ""

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

## property_default_page_setup() [1/2]

Glib::PropertyProxy< Glib::RefPtr<PageSetup> > Gtk::PrintOperation::property_default_page_setup | ( |  | ) |

The Gtk::PageSetup used by default.

This page setup will be used by Gtk::PrintOperation::run(), but it can be overridden on a per-page basis by connecting to the Gtk::PrintOperation::signal_request_page_setup() signal.

Since gtkmm 2.10:

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

## property_default_page_setup() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PageSetup> > Gtk::PrintOperation::property_default_page_setup | ( |  | ) | const

The Gtk::PageSetup used by default.

This page setup will be used by Gtk::PrintOperation::run(), but it can be overridden on a per-page basis by connecting to the Gtk::PrintOperation::signal_request_page_setup() signal.

Since gtkmm 2.10:

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

## property_embed_page_setup() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintOperation::property_embed_page_setup | ( |  | ) |

If `true`, page size combo box and orientation combo box are embedded into page setup page.

Since gtkmm 2.18:

Default value: `false`

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

## property_embed_page_setup() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintOperation::property_embed_page_setup | ( |  | ) | const

If `true`, page size combo box and orientation combo box are embedded into page setup page.

Since gtkmm 2.18:

Default value: `false`

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

## property_export_filename() [1/2]

Glib::PropertyProxy< std::string > Gtk::PrintOperation::property_export_filename | ( |  | ) |

The name of a file to generate instead of showing the print dialog.

Currently, PDF is the only supported format.

The intended use of this property is for implementing “Export to PDF” actions.

“Print to PDF” support is independent of this and is done by letting the user pick the “Print to PDF” item from the list of printers in the print dialog.

Since gtkmm 2.10:

Default value: ""

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

## property_export_filename() [2/2]

Glib::PropertyProxy_ReadOnly< std::string > Gtk::PrintOperation::property_export_filename | ( |  | ) | const

The name of a file to generate instead of showing the print dialog.

Currently, PDF is the only supported format.

The intended use of this property is for implementing “Export to PDF” actions.

“Print to PDF” support is independent of this and is done by letting the user pick the “Print to PDF” item from the list of printers in the print dialog.

Since gtkmm 2.10:

Default value: ""

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

## property_has_selection() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintOperation::property_has_selection | ( |  | ) |

Determines whether there is a selection in your application.

This can allow your application to print the selection. This is typically used to make a "Selection" button sensitive.

Since gtkmm 2.18:

Default value: `false`

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

## property_has_selection() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintOperation::property_has_selection | ( |  | ) | const

Determines whether there is a selection in your application.

This can allow your application to print the selection. This is typically used to make a "Selection" button sensitive.

Since gtkmm 2.18:

Default value: `false`

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

## property_job_name() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::PrintOperation::property_job_name | ( |  | ) |

A string used to identify the job (e.g. in monitoring applications like eggcups).

If you don't set a job name, GTK+ picks a default one by numbering successive print jobs.

Since gtkmm 2.10:

Default value: ""

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

## property_job_name() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::PrintOperation::property_job_name | ( |  | ) | const

A string used to identify the job (e.g. in monitoring applications like eggcups).

If you don't set a job name, GTK+ picks a default one by numbering successive print jobs.

Since gtkmm 2.10:

Default value: ""

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

## property_n_pages() [1/2]

Glib::PropertyProxy< int > Gtk::PrintOperation::property_n_pages | ( |  | ) |

The number of pages in the document.

This must be set to a positive number before the rendering starts. It may be set in a Gtk::PrintOperation::signal_begin_print() signal hander.

Note that the page numbers passed to the Gtk::PrintOperation::signal_request_page_setup() and Gtk::PrintOperation::signal_draw_page() signals are 0-based, i.e. if the user chooses to print all pages, the last signal_draw_page() signal will be for page n_pages - 1.

Since gtkmm 2.10:

Default value: -1

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

## property_n_pages() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gtk::PrintOperation::property_n_pages | ( |  | ) | const

The number of pages in the document.

This must be set to a positive number before the rendering starts. It may be set in a Gtk::PrintOperation::signal_begin_print() signal hander.

Note that the page numbers passed to the Gtk::PrintOperation::signal_request_page_setup() and Gtk::PrintOperation::signal_draw_page() signals are 0-based, i.e. if the user chooses to print all pages, the last signal_draw_page() signal will be for page n_pages - 1.

Since gtkmm 2.10:

Default value: -1

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

## property_n_pages_to_print()

Glib::PropertyProxy_ReadOnly< int > Gtk::PrintOperation::property_n_pages_to_print | ( |  | ) | const

The number of pages that will be printed.

Note that this value is set during print preparation phase (Gtk::PRINT_STATUS_PREPARING), so this value should never be get before the data generation phase (Gtk::PRINT_STATUS_GENERATING_DATA). You can connect to the Gtk::PrintOperation::signal_status_changed() signal and call Gtk::PrintOperation::get_n_pages_to_print() when print status is Gtk::PRINT_STATUS_GENERATING_DATA. This is typically used to track the progress of print operation.

Since gtkmm 2.18:

Default value: -1

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

## property_print_settings() [1/2]

Glib::PropertyProxy< Glib::RefPtr<PrintSettings> > Gtk::PrintOperation::property_print_settings | ( |  | ) |

The Gtk::PrintSettings used for initializing the dialog.

Setting this property is typically used to re-establish print settings from a previous print operation, see Gtk::PrintOperation::run().

Since gtkmm 2.10:

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

## property_print_settings() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<PrintSettings> > Gtk::PrintOperation::property_print_settings | ( |  | ) | const

The Gtk::PrintSettings used for initializing the dialog.

Setting this property is typically used to re-establish print settings from a previous print operation, see Gtk::PrintOperation::run().

Since gtkmm 2.10:

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

## property_show_progress() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintOperation::property_show_progress | ( |  | ) |

Determines whether to show a progress dialog during the print operation.

Since gtkmm 2.10:

Default value: `false`

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

## property_show_progress() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintOperation::property_show_progress | ( |  | ) | const

Determines whether to show a progress dialog during the print operation.

Since gtkmm 2.10:

Default value: `false`

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

## property_status()

Glib::PropertyProxy_ReadOnly< PrintStatus > Gtk::PrintOperation::property_status | ( |  | ) | const

The status of the print operation.

Since gtkmm 2.10:

Default value: Gtk::PRINT_STATUS_INITIAL

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

## property_status_string()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::PrintOperation::property_status_string | ( |  | ) | const

A string representation of the status of the print operation.

The string is translated and suitable for displaying the print status e.g. in a Gtk::Statusbar.

See the Gtk::PrintOperation::property_status() property for a status value that is suitable for programmatic use.

Since gtkmm 2.10:

Default value: ""

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

## property_support_selection() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintOperation::property_support_selection | ( |  | ) |

If `true`, the print operation will support print of selection.

This allows the print dialog to show a "Selection" button.

Since gtkmm 2.18:

Default value: `false`

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

## property_support_selection() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintOperation::property_support_selection | ( |  | ) | const

If `true`, the print operation will support print of selection.

This allows the print dialog to show a "Selection" button.

Since gtkmm 2.18:

Default value: `false`

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

## property_track_print_status() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintOperation::property_track_print_status | ( |  | ) |

If `true`, the print operation 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. However, this is often implemented using polling, and should not be enabled unless needed.

Since gtkmm 2.10:

Default value: `false`

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

## property_track_print_status() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintOperation::property_track_print_status | ( |  | ) | const

If `true`, the print operation 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. However, this is often implemented using polling, and should not be enabled unless needed.

Since gtkmm 2.10:

Default value: `false`

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

## property_unit() [1/2]

Glib::PropertyProxy< Unit > Gtk::PrintOperation::property_unit | ( |  | ) |

The transformation for the cairo context obtained from Gtk::PrintContext is set up in such a way that distances are measured in units of unit.

Since gtkmm 2.10:

Default value: Gtk::UNIT_NONE

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

## property_unit() [2/2]

Glib::PropertyProxy_ReadOnly< Unit > Gtk::PrintOperation::property_unit | ( |  | ) | const

The transformation for the cairo context obtained from Gtk::PrintContext is set up in such a way that distances are measured in units of unit.

Since gtkmm 2.10:

Default value: Gtk::UNIT_NONE

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

## property_use_full_page() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintOperation::property_use_full_page | ( |  | ) |

If `true`, the transformation for the cairo context obtained from Gtk::PrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet).

Otherwise, the origin is at the top left corner of the imageable area (i.e. inside the margins).

Since gtkmm 2.10:

Default value: `false`

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

## property_use_full_page() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintOperation::property_use_full_page | ( |  | ) | const

If `true`, the transformation for the cairo context obtained from Gtk::PrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet).

Otherwise, the origin is at the top left corner of the imageable area (i.e. inside the margins).

Since gtkmm 2.10:

Default value: `false`

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

## run() [1/2]

PrintOperationResult Gtk::PrintOperation::run | ( | PrintOperationAction | action,
|  | Window& | parent
| ) |  |

Runs the print operation, by first letting the user modify print settings in the print dialog, and then print the document.

Normally that this function does not return until the rendering of all pages is complete. You can connect to the Gtk::PrintOperation::signal_status_changed() signal on op to obtain some information about the progress of the print operation. Furthermore, it may use a recursive mainloop to show the print dialog.

If you call set_allow_async() or set the Gtk::PrintOperation::property_allow_async() property the operation will run asynchronously if this is supported on the platform. The Gtk::PrintOperation::signal_done() signal will be emitted with the result of the operation when the it is done (i.e. when the dialog is canceled, or when the print succeeds or fails).

[C example ellipted]

Note that run() can only be called once on a given Gtk::PrintOperation.

Since gtkmm 2.10:

Parameters

  action | The action to start.
  parent | Transient parent of the dialog.

Returns
  The result of the print operation. A return value of Gtk::PRINT_OPERATION_RESULT_APPLY indicates that the printing was completed successfully. In this case, it is a good idea to obtain the used print settings with get_print_settings() and store them for reuse with the next print operation. A value of Gtk::PRINT_OPERATION_RESULT_IN_PROGRESS means the operation is running asynchronously, and will emit the Gtk::PrintOperation::signal_done() signal when done.

Exceptions

  Glib::Error |

## run() [2/2]

PrintOperationResult Gtk::PrintOperation::run | ( | PrintOperationAction | action = `PRINT_OPERATION_ACTION_PRINT_DIALOG` | ) |

See the run() method that takes both action and parent parameters.

## set_allow_async()

void Gtk::PrintOperation::set_allow_async | ( | bool | allow_async = `true` | ) |

Sets whether the run() may return before the print operation is completed.

Note that some platforms may not allow asynchronous operation.

Since gtkmm 2.10:

Parameters

  allow_async | `true` to allow asynchronous operation.

## set_current_page()

void Gtk::PrintOperation::set_current_page | ( | int | current_page | ) |

Sets the current page.

If this is called before run(), the user will be able to select to print only the current page.

Note that this only makes sense for pre-paginated documents.

Since gtkmm 2.10:

Parameters

  current_page | The current page, 0-based.

## set_custom_tab_label()

void Gtk::PrintOperation::set_custom_tab_label | ( | const Glib::ustring & | label | ) |

Sets the label for the tab holding custom widgets.

Since gtkmm 2.10:

Parameters

  label | The label to use, or `nullptr` to use the default label.

## set_default_page_setup()

void Gtk::PrintOperation::set_default_page_setup | ( | const Glib::RefPtr< PageSetup >& | default_page_setup | ) |

Makes default_page_setup the default page setup for op.

This page setup will be used by run(), but it can be overridden on a per-page basis by connecting to the Gtk::PrintOperation::signal_request_page_setup() signal.

Since gtkmm 2.10:

Parameters

  default_page_setup | A Gtk::PageSetup, or `nullptr`.

## set_defer_drawing()

void Gtk::PrintOperation::set_defer_drawing | ( |  | ) |

Sets up the Gtk::PrintOperation to wait for calling of draw_page_finish() from application.

It can be used for drawing page in another thread.

This function must be called in the callback of “draw-page” signal.

Since gtkmm 2.16:

## set_embed_page_setup()

void Gtk::PrintOperation::set_embed_page_setup | ( | bool | embed = `true` | ) |

Embed page size combo box and orientation combo box into page setup page.

Selected page setup is stored as default page setup in Gtk::PrintOperation.

Since gtkmm 2.18:

Parameters

  embed | `true` to embed page setup selection in the Gtk::PrintUnixDialog.

## set_export_filename()

void Gtk::PrintOperation::set_export_filename | ( | const std::string & | filename | ) |

Sets up the Gtk::PrintOperation to generate a file instead of showing the print dialog.

The indended use of this function is for implementing “Export to PDF” actions. Currently, PDF is the only supported format.

“Print to PDF” support is independent of this and is done by letting the user pick the “Print to PDF” item from the list of printers in the print dialog.

Since gtkmm 2.10:

Parameters

  filename | The filename for the exported file.

## set_has_selection()

void Gtk::PrintOperation::set_has_selection | ( | bool | has_selection = `true` | ) |

Sets whether there is a selection to print.

Application has to set number of pages to which the selection will draw by set_n_pages() in a callback of Gtk::PrintOperation::signal_begin_print().

Since gtkmm 2.18:

Parameters

  has_selection | `true` indicates that a selection exists.

## set_job_name()

void Gtk::PrintOperation::set_job_name | ( | const Glib::ustring & | job_name | ) |

Sets the name of the print job.

The name is used to identify the job (e.g. in monitoring applications like eggcups).

If you don’t set a job name, GTK+ picks a default one by numbering successive print jobs.

Since gtkmm 2.10:

Parameters

  job_name | A string that identifies the print job.

## set_n_pages()

void Gtk::PrintOperation::set_n_pages | ( | int | n_pages | ) |

Sets the number of pages in the document.

This must be set to a positive number before the rendering starts. It may be set in a Gtk::PrintOperation::signal_begin_print() signal hander.

Note that the page numbers passed to the Gtk::PrintOperation::signal_request_page_setup() and Gtk::PrintOperation::signal_draw_page() signals are 0-based, i.e. if the user chooses to print all pages, the last signal_draw_page() signal will be for page n_pages - 1.

Since gtkmm 2.10:

Parameters

  n_pages | The number of pages.

## set_print_settings()

void Gtk::PrintOperation::set_print_settings | ( | const Glib::RefPtr< PrintSettings >& | print_settings | ) |

Sets the print settings for op.

This is typically used to re-establish print settings from a previous print operation, see run().

Since gtkmm 2.10:

Parameters

  print_settings | Gtk::PrintSettings.

## set_show_progress()

void Gtk::PrintOperation::set_show_progress | ( | bool | show_progress = `true` | ) |

If show_progress is `true`, the print operation will show a progress dialog during the print operation.

Since gtkmm 2.10:

Parameters

  show_progress | `true` to show a progress dialog.

## set_support_selection()

void Gtk::PrintOperation::set_support_selection | ( | bool | support_selection = `true` | ) |

Sets whether selection is supported by Gtk::PrintOperation.

Since gtkmm 2.18:

Parameters

  support_selection | `true` to support selection.

## set_track_print_status()

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

If track_status is `true`, the print operation 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.

## set_unit()

void Gtk::PrintOperation::set_unit | ( | Unit | unit | ) |

Sets up the transformation for the cairo context obtained from Gtk::PrintContext in such a way that distances are measured in units of unit.

Since gtkmm 2.10:

Parameters

  unit | The unit to use.

## set_use_full_page()

void Gtk::PrintOperation::set_use_full_page | ( | bool | use_full_page = `true` | ) |

If use_full_page is `true`, the transformation for the cairo context obtained from Gtk::PrintContext puts the origin at the top left corner of the page (which may not be the top left corner of the sheet, depending on page orientation and the number of pages per sheet).

Otherwise, the origin is at the top left corner of the imageable area (i.e. inside the margins).

Since gtkmm 2.10:

Parameters

  use_full_page | `true` to set up the Gtk::PrintContext for the full page.

## signal_begin_print()

Glib::SignalProxy< void,const Glib::RefPtr<PrintContext>& > Gtk::PrintOperation::signal_begin_print | ( |  | ) |

Slot Prototype:
  `void on_my_begin_print(const Glib::RefPtr<PrintContext>& context)`

Flags: Run Last

Emitted after the user has finished changing print settings in the dialog, before the actual rendering starts.

A typical use for signal_begin_print() is to use the parameters from the Gtk::PrintContext and paginate the document accordingly, and then set the number of pages with Gtk::PrintOperation::set_n_pages().

Since gtkmm 2.10:

Parameters

  context | The Gtk::PrintContext for the current operation.

## signal_create_custom_widget()

Glib::SignalProxy< Widget* > Gtk::PrintOperation::signal_create_custom_widget | ( |  | ) |

Slot Prototype:
  `Widget* on_my_create_custom_widget()`

Flags: Run Last

Emitted when displaying the print dialog. If you return a widget in a handler for this signal it will be added to a custom tab in the print dialog. You typically return a container widget with multiple widgets in it.

The print dialog owns the returned widget, and its lifetime is not controlled by the application. However, the widget is guaranteed to stay around until the Gtk::PrintOperation::signal_custom_widget_apply() signal is emitted on the operation. Then you can read out any information you need from the widgets.

Since gtkmm 2.10:

Returns
  A custom widget that gets embedded in the print dialog, or `nullptr`.

## signal_custom_widget_apply()

Glib::SignalProxy< void,Widget* > Gtk::PrintOperation::signal_custom_widget_apply | ( |  | ) |

Slot Prototype:
  `void on_my_custom_widget_apply(Widget* widget)`

Flags: Run Last

Emitted right before Gtk::PrintOperation::signal_begin_print() if you added a custom widget in the Gtk::PrintOperation::signal_create_custom_widget() handler. When you get this signal you should read the information from the custom widgets, as the widgets are not guaraneed to be around at a later time.

Since gtkmm 2.10:

Parameters

  widget | The custom widget added in create-custom-widget.

## signal_done()

Glib::SignalProxy< void,PrintOperationResult > Gtk::PrintOperation::signal_done | ( |  | ) |

Slot Prototype:
  `void on_my_done(PrintOperationResult result)`

Flags: Run Last

Emitted when the print operation run has finished doing everything required for printing.

result gives you information about what happened during the run. If result is Gtk::PRINT_OPERATION_RESULT_ERROR then you can call Gtk::PrintOperation::get_error() for more information.

If you enabled print status tracking then Gtk::PrintOperation::is_finished() may still return `false` after Gtk::PrintOperation::signal_done() was emitted.

Since gtkmm 2.10:

Parameters

  result | The result of the print operation.

## signal_draw_page()

Glib::SignalProxy< void,const Glib::RefPtr<PrintContext>&,int > Gtk::PrintOperation::signal_draw_page | ( |  | ) |

Slot Prototype:
  `void on_my_draw_page(const Glib::RefPtr<PrintContext>& context, int page_nr)`

Flags: Run Last

Emitted for every page that is printed. The signal handler must render the page_nr's page onto the cairo context obtained from context using Gtk::PrintContext::get_cairo_context().

[C example ellipted]

Use Gtk::PrintOperation::set_use_full_page() and Gtk::PrintOperation::set_unit() before starting the print operation to set up the transformation of the cairo context according to your needs.

Since gtkmm 2.10:

Parameters

  context | The Gtk::PrintContext for the current operation.
  page_nr | The number of the currently printed page (0-based).

## signal_end_print()

Glib::SignalProxy< void,const Glib::RefPtr<PrintContext>& > Gtk::PrintOperation::signal_end_print | ( |  | ) |

Slot Prototype:
  `void on_my_end_print(const Glib::RefPtr<PrintContext>& context)`

Flags: Run Last

Emitted after all pages have been rendered. A handler for this signal can clean up any resources that have been allocated in the Gtk::PrintOperation::signal_begin_print() handler.

Since gtkmm 2.10:

Parameters

  context | The Gtk::PrintContext for the current operation.

## signal_paginate()

Glib::SignalProxy< bool,const Glib::RefPtr<PrintContext>& > Gtk::PrintOperation::signal_paginate | ( |  | ) |

Slot Prototype:
  `bool on_my_paginate(const Glib::RefPtr<PrintContext>& context)`

Flags: Run Last

Emitted after the Gtk::PrintOperation::signal_begin_print() signal, but before the actual rendering starts. It keeps getting emitted until a connected signal handler returns `true`.

The signal_paginate() signal is intended to be used for paginating a document in small chunks, to avoid blocking the user interface for a long time. The signal handler should update the number of pages using Gtk::PrintOperation::set_n_pages(), and return `true` if the document has been completely paginated.

If you don't need to do pagination in chunks, you can simply do it all in the signal_begin_print() handler, and set the number of pages from there.

Since gtkmm 2.10:

Parameters

  context | The Gtk::PrintContext for the current operation.

Returns
  `true` if pagination is complete.

## signal_preview()

Glib::SignalProxy< bool,const Glib::RefPtr<PrintOperationPreview>&,const Glib::RefPtr<PrintContext>&,Window* > Gtk::PrintOperation::signal_preview | ( |  | ) |

Slot Prototype:
  `bool on_my_preview(const Glib::RefPtr<PrintOperationPreview>& preview, const Glib::RefPtr<PrintContext>& context, Window* parent)`

Flags: Run Last

Gets emitted when a preview is requested from the native dialog.

The default handler for this signal uses an external viewer application to preview.

To implement a custom print preview, an application must return `true` from its handler for this signal. In order to use the provided context for the preview implementation, it must be given a suitable cairo context with Gtk::PrintContext::set_cairo_context().

The custom preview implementation can use Gtk::PrintOperationPreview::is_selected() and Gtk::PrintOperationPreview::render_page() to find pages which are selected for print and render them. The preview must be finished by calling Gtk::PrintOperationPreview::end_preview() (typically in response to the user clicking a close button).

Since gtkmm 2.10:

Parameters

  preview | The Gtk::PrintOperationPreview for the current operation.
  context | The Gtk::PrintContext that will be used.
  parent | The Gtk::Window to use as window parent, or `nullptr`.

Returns
  `true` if the listener wants to take over control of the preview.

## signal_request_page_setup()

Glib::SignalProxy< void,const Glib::RefPtr<PrintContext>&,int,const Glib::RefPtr<PageSetup>& > Gtk::PrintOperation::signal_request_page_setup | ( |  | ) |

Slot Prototype:
  `void on_my_request_page_setup(const Glib::RefPtr<PrintContext>& context, int page_no, const Glib::RefPtr<PageSetup>& setup)`

Flags: Run Last

Emitted once for every page that is printed, to give the application a chance to modify the page setup. Any changes done to setup will be in force only for printing this page.

Since gtkmm 2.10:

Parameters

  context | The Gtk::PrintContext for the current operation.
  page_no | The number of the currently printed page (0-based).
  setup | The Gtk::PageSetup.

## signal_status_changed()

Glib::SignalProxy< void > Gtk::PrintOperation::signal_status_changed | ( |  | ) |

Slot Prototype:
  `void on_my_status_changed()`

Flags: Run Last

Emitted at between the various phases of the print operation. See Gtk::PrintStatus for the phases that are being discriminated. Use Gtk::PrintOperation::get_status() to find out the current status.

Since gtkmm 2.10:

## signal_update_custom_widget()

Glib::SignalProxy< void,Widget*,const Glib::RefPtr<PageSetup>&,const Glib::RefPtr<PrintSettings>& > Gtk::PrintOperation::signal_update_custom_widget | ( |  | ) |

Slot Prototype:
  `void on_my_update_custom_widget(Widget* widget, const Glib::RefPtr<PageSetup>& setup, const Glib::RefPtr<PrintSettings>& settings)`

Flags: Run Last

Emitted after change of selected printer. The actual page setup and print settings are passed to the custom widget, which can actualize itself according to this change.

Since gtkmm 2.18:

Parameters

  widget | The custom widget added in create-custom-widget.
  setup | Actual page setup.
  settings | Actual print settings.

## Friends And Related Function Documentation

## wrap()

Glib::RefPtr< Gtk::PrintOperation > wrap | ( | GtkPrintOperation * | 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.