:right-sidebar: True PrintOperation =================================================================== .. currentmodule:: gi.repository.WebKit .. class:: PrintOperation(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Controls a print operation. A :obj:`~gi.repository.WebKit.PrintOperation` controls a print operation in WebKit. With a similar API to :obj:`~gi.repository.Gtk.PrintOperation`\, it lets you set the print settings with :func:`~gi.repository.WebKit.PrintOperation.set_print_settings` or display the print dialog with :func:`~gi.repository.WebKit.PrintOperation.run_dialog`. 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 type of the None singleton. .. attribute:: props.print_settings :type: ~gi.repository.Gtk.PrintSettings The type of the None singleton. .. attribute:: props.web_view :type: ~gi.repository.WebKit.WebView The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: PrintOperation.signals :no-index: .. method:: failed(error: ~gi.repository.GLib.GError) -> None The type of the None singleton. :param error: the :obj:`~gi.repository.GLib.Error` that was triggered .. method:: finished() -> None The type of the None singleton.