WebKit2.PrintOperation

g GObject.Object GObject.Object WebKit2.PrintOperation WebKit2.PrintOperation GObject.Object->WebKit2.PrintOperation

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (web_view)

get_page_setup ()

get_print_settings ()

print_ ()

run_dialog (parent)

set_page_setup (page_setup)

set_print_settings (print_settings)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

page-setup

Gtk.PageSetup

r/w

print-settings

Gtk.PrintSettings

r/w

web-view

WebKit2.WebView

r/w/co

Signals

Inherited:

GObject.Object (1)

Name

Short Description

create-custom-widget

Emitted when displaying the print dialog with WebKit2.PrintOperation.run_dialog(). deprecated

failed

Emitted when an error occurs while printing.

finished

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

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class WebKit2.PrintOperation(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

WebKit2.PrintOperationClass

Controls a print operation.

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

classmethod new(web_view)
Parameters:

web_view (WebKit2.WebView) – a WebKit2.WebView

Returns:

a new WebKit2.PrintOperation.

Return type:

WebKit2.PrintOperation

Create a new WebKit2.PrintOperation to print web_view contents.

get_page_setup()
Returns:

the current Gtk.PageSetup of self.

Return type:

Gtk.PageSetup

Return the current page setup of self.

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

get_print_settings()
Returns:

the current Gtk.PrintSettings of self.

Return type:

Gtk.PrintSettings

Return the current print settings of self.

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

print_()

Start a print operation using current print settings and page setup.

Start a print operation using current print settings and page setup without showing the print dialog. If either print settings or page setup are not set with WebKit2.PrintOperation.set_print_settings() and WebKit2.PrintOperation.set_page_setup(), the default options will be used and the print job will be sent to the default printer. The WebKit2.PrintOperation ::finished signal is emitted when the printing operation finishes. If an error occurs while printing the signal WebKit2.PrintOperation ::failed is emitted before WebKit2.PrintOperation ::finished.

Deprecated since version 2.46.: This function does nothing if the app is sandboxed.

run_dialog(parent)
Parameters:

parent (Gtk.Window or None) – transient parent of the print dialog

Returns:

the WebKit2.PrintOperationResponse of the print dialog

Return type:

WebKit2.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 WebKit2.PrintOperationResponse.CANCEL is returned. If the user clicks on the print button, WebKit2.PrintOperationResponse.PRINT is returned and the print operation starts. In this case, the WebKit2.PrintOperation ::finished signal is emitted when the operation finishes. If an error occurs while printing, the signal WebKit2.PrintOperation ::failed is emitted before WebKit2.PrintOperation ::finished. If the print dialog is not cancelled current print settings and page setup of self 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 WebKit2.PrintOperation.get_print_settings() and WebKit2.PrintOperation.get_page_setup() after this method.

set_page_setup(page_setup)
Parameters:

page_setup (Gtk.PageSetup) – a Gtk.PageSetup to set

Set the current page setup of self.

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

set_print_settings(print_settings)
Parameters:

print_settings (Gtk.PrintSettings) – a Gtk.PrintSettings to set

Set the current print settings of self.

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

Signal Details

WebKit2.PrintOperation.signals.create_custom_widget(print_operation)
Signal Name:

create-custom-widget

Flags:

RUN_LAST

Parameters:

print_operation (WebKit2.PrintOperation) – The object which received the signal

Returns:

A WebKit2.PrintCustomWidget that will be embedded in the dialog.

Return type:

WebKit2.PrintCustomWidget

Emitted when displaying the print dialog with WebKit2.PrintOperation.run_dialog(). The returned WebKit2.PrintCustomWidget will be added to the print dialog and it will be owned by the print_operation. However, the object is guaranteed to be alive until the WebKit2.PrintCustomWidget ::apply is emitted.

New in version 2.16.

Deprecated since version 2.40.

WebKit2.PrintOperation.signals.failed(print_operation, error)
Signal Name:

failed

Flags:

RUN_LAST

Parameters:

Emitted when an error occurs while printing. The given error, of the domain %WEBKIT_PRINT_ERROR, contains further details of the failure. The WebKit2.PrintOperation ::finished signal is emitted after this one.

WebKit2.PrintOperation.signals.finished(print_operation)
Signal Name:

finished

Flags:

RUN_LAST

Parameters:

print_operation (WebKit2.PrintOperation) – The object which received the signal

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

Property Details

WebKit2.PrintOperation.props.page_setup
Name:

page-setup

Type:

Gtk.PageSetup

Default Value:

None

Flags:

READABLE, WRITABLE

The initial Gtk.PageSetup for the print operation.

WebKit2.PrintOperation.props.print_settings
Name:

print-settings

Type:

Gtk.PrintSettings

Default Value:

None

Flags:

READABLE, WRITABLE

The initial Gtk.PrintSettings for the print operation.

WebKit2.PrintOperation.props.web_view
Name:

web-view

Type:

WebKit2.WebView

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The WebKit2.WebView that will be printed.