:right-sidebar: True PrintOperation =================================================================== .. currentmodule:: gi.repository.WebKit .. class:: PrintOperation(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` :Constructors: :: PrintOperation(**properties) new(web_view:WebKit.WebView) -> WebKit.PrintOperation Constructors ------------ .. rst-class:: interim-class .. class:: PrintOperation :no-index: .. classmethod:: new(web_view: ~gi.repository.WebKit.WebView) -> ~gi.repository.WebKit.PrintOperation Create a new :obj:`~gi.repository.WebKit.PrintOperation` to print ``web_view`` contents. :param web_view: a :obj:`~gi.repository.WebKit.WebView` Methods ------- .. rst-class:: interim-class .. class:: PrintOperation :no-index: .. method:: get_page_setup() -> ~gi.repository.Gtk.PageSetup Return the current page setup of ``print_operation``. It returns :const:`None` until either :func:`~gi.repository.WebKit.PrintOperation.set_page_setup` or :func:`~gi.repository.WebKit.PrintOperation.run_dialog` have been called. .. method:: get_print_settings() -> ~gi.repository.Gtk.PrintSettings Return the current print settings of ``print_operation``. It returns :const:`None` until either :func:`~gi.repository.WebKit.PrintOperation.set_print_settings` or :func:`~gi.repository.WebKit.PrintOperation.run_dialog` have been called. .. method:: print_() -> None .. method:: run_dialog(parent: ~gi.repository.Gtk.Window | None = None) -> ~gi.repository.WebKit.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 :const:`~gi.repository.WebKit.PrintOperationResponse.CANCEL` is returned. If the user clicks on the print button, :const:`~gi.repository.WebKit.PrintOperationResponse.PRINT` is returned and the print operation starts. In this case, the :obj:`~gi.repository.WebKit.PrintOperation`::finished signal is emitted when the operation finishes. If an error occurs while printing, the signal :obj:`~gi.repository.WebKit.PrintOperation`::failed is emitted before :obj:`~gi.repository.WebKit.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 :func:`~gi.repository.WebKit.PrintOperation.get_print_settings` and :func:`~gi.repository.WebKit.PrintOperation.get_page_setup` after this method. :param parent: transient parent of the print dialog .. method:: set_page_setup(page_setup: ~gi.repository.Gtk.PageSetup) -> None Set the current page setup of ``print_operation``. Current page setup is used for the initial values of the print dialog when :func:`~gi.repository.WebKit.PrintOperation.run_dialog` is called. :param page_setup: a :obj:`~gi.repository.Gtk.PageSetup` to set .. method:: set_print_settings(print_settings: ~gi.repository.Gtk.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 :func:`~gi.repository.WebKit.PrintOperation.run_dialog` is called. :param print_settings: a :obj:`~gi.repository.Gtk.PrintSettings` to set Properties ---------- .. rst-class:: interim-class .. class:: PrintOperation :no-index: .. attribute:: props.page_setup :type: ~gi.repository.Gtk.PageSetup The initial :obj:`~gi.repository.Gtk.PageSetup` for the print operation. .. attribute:: props.print_settings :type: ~gi.repository.Gtk.PrintSettings The initial :obj:`~gi.repository.Gtk.PrintSettings` for the print operation. .. attribute:: props.web_view :type: ~gi.repository.WebKit.WebView The :obj:`~gi.repository.WebKit.WebView` that will be printed. Signals ------- .. rst-class:: interim-class .. class:: PrintOperation.signals :no-index: .. method:: failed(error: ~gi.repository.GLib.GError) -> None Emitted when an error occurs while printing. The given ``error``, of the domain ``%WEBKIT_PRINT_ERROR``, contains further details of the failure. The :obj:`~gi.repository.WebKit.PrintOperation`::finished signal is emitted after this one. :param error: the :obj:`~gi.repository.GLib.Error` that was triggered .. method:: finished() -> None Emitted when the print operation has finished doing everything required for printing.