PrintOperation#

class PrintOperation(**properties: Any)#

Superclasses: Object

Controls a print operation.

A PrintOperation controls a print operation in WebKit. With a similar API to PrintOperation, it lets you set the print settings with set_print_settings() or display the print dialog with run_dialog().

Constructors#

class PrintOperation
classmethod new(web_view: WebView) PrintOperation#

Create a new PrintOperation to print web_view contents.

Parameters:

web_view – a WebView

Methods#

class PrintOperation
get_page_setup() PageSetup#

Return the current page setup of print_operation.

It returns None until either set_page_setup() or run_dialog() have been called.

get_print_settings() PrintSettings#

Return the current print settings of print_operation.

It returns None until either set_print_settings() or run_dialog() have been called.

print_() None#
run_dialog(parent: Window | None = None) PrintOperationResponse#

Run the print dialog and start printing.

Run the print dialog and start printing using the options selected by the user. This method returns when the print dialog is closed. If the print dialog is cancelled CANCEL is returned. If the user clicks on the print button, PRINT is returned and the print operation starts. In this case, the PrintOperation::finished signal is emitted when the operation finishes. If an error occurs while printing, the signal PrintOperation::failed is emitted before PrintOperation::finished. If the print dialog is not cancelled current print settings and page setup of print_operation are updated with options selected by the user when Print button is pressed in print dialog. You can get the updated print settings and page setup by calling get_print_settings() and get_page_setup() after this method.

Parameters:

parent – transient parent of the print dialog

set_page_setup(page_setup: PageSetup) None#

Set the current page setup of print_operation.

Current page setup is used for the initial values of the print dialog when run_dialog() is called.

Parameters:

page_setup – a PageSetup to set

set_print_settings(print_settings: PrintSettings) None#

Set the current print settings of print_operation.

Set the current print settings of print_operation. Current print settings are used for the initial values of the print dialog when run_dialog() is called.

Parameters:

print_settings – a PrintSettings to set

Properties#

class PrintOperation
props.page_setup: PageSetup#

The type of the None singleton.

props.print_settings: PrintSettings#

The type of the None singleton.

props.web_view: WebView#

The type of the None singleton.

Signals#

class PrintOperation.signals
failed(error: GError) None#

The type of the None singleton.

Parameters:

error – the Error that was triggered

finished() None#

The type of the None singleton.