Class PrintOperation
- All Implemented Interfaces:
Proxy
Controls a print operation.
A WebKitPrintOperation controls a print operation in WebKit. With
a similar API to GtkPrintOperation, it lets you set the print
settings with webkit_print_operation_set_print_settings() or
display the print dialog with webkit_print_operation_run_dialog().
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPrintOperation.Builder<B extends PrintOperation.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theFailedCallbackcallback.static interfaceFunctional interface declaration of theFinishedCallbackcallback.static classNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new PrintOperation.PrintOperation(MemorySegment address) Create a PrintOperation instance for the provided memory address.PrintOperation(WebView webView) Create a newWebKitPrintOperationto printwebViewcontents. -
Method Summary
Modifier and TypeMethodDescriptionprotected PrintOperationasParent()Return this instance as if it were its parent type.static PrintOperation.Builder<? extends PrintOperation.Builder> builder()APrintOperation.Builderobject constructs aPrintOperationwith the specified properties.voidemitFailed(@Nullable GError error) Emits the "failed" signal.voidEmits the "finished" signal.static MemoryLayoutThe memory layout of the native struct.Return the current page setup ofprintOperation.Return the current print settings ofprintOperation.static @Nullable TypegetType()Get the GType of the PrintOperation class.onFailed(PrintOperation.FailedCallback handler) Emitted when an error occurs while printing.Emitted when the print operation has finished doing everything required for printing.voidprint()Start a print operation using current print settings and page setup.Run the print dialog and start printing.voidsetPageSetup(PageSetup pageSetup) Set the current page setup ofprintOperation.voidsetPrintSettings(PrintSettings printSettings) Set the current print settings ofprintOperation.Methods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
PrintOperation
Create a PrintOperation instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
PrintOperation
Create a newWebKitPrintOperationto printwebViewcontents.- Parameters:
webView- aWebKitWebView
-
PrintOperation
public PrintOperation()Create a new PrintOperation.
-
-
Method Details
-
getType
Get the GType of the PrintOperation class.- Returns:
- the GType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code. -
getPageSetup
Return the current page setup of
printOperation.It returns
nulluntil either webkit_print_operation_set_page_setup() or webkit_print_operation_run_dialog() have been called.- Returns:
- the current
GtkPageSetupofprintOperation.
-
getPrintSettings
Return the current print settings of
printOperation.It returns
nulluntil either webkit_print_operation_set_print_settings() or webkit_print_operation_run_dialog() have been called.- Returns:
- the current
GtkPrintSettingsofprintOperation.
-
print
public void 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 webkit_print_operation_set_print_settings() and webkit_print_operation_set_page_setup(), the default options will be used and the print job will be sent to the default printer. The
WebKitPrintOperation::finished signal is emitted when the printing operation finishes. If an error occurs while printing the signalWebKitPrintOperation::failed is emitted beforeWebKitPrintOperation::finished.If the app is running in a sandbox, this function only works if printing to a file that is in a location accessible to the sandbox, usually acquired through the File Chooser portal. This function will not work for physical printers when running in a sandbox.
-
runDialog
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
PrintOperationResponse.CANCELis returned. If the user clicks on the print button,PrintOperationResponse.PRINTis returned and the print operation starts. In this case, theWebKitPrintOperation::finished signal is emitted when the operation finishes. If an error occurs while printing, the signalWebKitPrintOperation::failed is emitted beforeWebKitPrintOperation::finished. If the print dialog is not cancelled current print settings and page setup of this PrintOperation 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 webkit_print_operation_get_print_settings() and webkit_print_operation_get_page_setup() after this method.- Parameters:
parent- transient parent of the print dialog- Returns:
- the
WebKitPrintOperationResponseof the print dialog
-
setPageSetup
Set the current page setup of
printOperation.Current page setup is used for the initial values of the print dialog when webkit_print_operation_run_dialog() is called.
- Parameters:
pageSetup- aGtkPageSetupto set
-
setPrintSettings
Set the current print settings of
printOperation.Set the current print settings of
printOperation.Current print settings are used for the initial values of the print dialog when webkit_print_operation_run_dialog() is called.- Parameters:
printSettings- aGtkPrintSettingsto set
-
onFailed
public SignalConnection<PrintOperation.FailedCallback> onFailed(PrintOperation.FailedCallback handler) Emitted when an error occurs while printing. The givenerror,of the domainWEBKIT_PRINT_ERROR, contains further details of the failure. TheWebKitPrintOperation::finished signal is emitted after this one.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitFailed
Emits the "failed" signal. SeeonFailed(PrintOperation.FailedCallback). -
onFinished
public SignalConnection<PrintOperation.FinishedCallback> onFinished(PrintOperation.FinishedCallback handler) Emitted when the print operation has finished doing everything required for printing.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitFinished
public void emitFinished()Emits the "finished" signal. SeeonFinished(PrintOperation.FinishedCallback). -
builder
APrintOperation.Builderobject constructs aPrintOperationwith the specified properties. Use the variousset...()methods to set properties, and finish construction withPrintOperation.Builder.build().- Returns:
- the builder object
-