PrintOperation#
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 printweb_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 eitherset_page_setup()
orrun_dialog()
have been called.
- get_print_settings() PrintSettings #
Return the current print settings of
print_operation
.It returns
None
until eitherset_print_settings()
orrun_dialog()
have been called.
- 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, thePrintOperation
::finished signal is emitted when the operation finishes. If an error occurs while printing, the signalPrintOperation
::failed is emitted beforePrintOperation
::finished. If the print dialog is not cancelled current print settings and page setup ofprint_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 callingget_print_settings()
andget_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 whenrun_dialog()
is called.- Parameters:
print_settings – a
PrintSettings
to set