Class PrintOperation
- All Implemented Interfaces:
Proxy
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 org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new PrintOperation.PrintOperation(MemorySegment address) Create a PrintOperation proxy instance for the provided memory address.PrintOperation(WebView webView) Create a newWebKitPrintOperationto printwebViewcontents. -
Method Summary
Modifier and TypeMethodDescriptionprotected PrintOperationasParent()Returns 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.Return the current page setup ofprintOperation.Return the current print settings ofprintOperation.static @Nullable TypegetType()Get the GType of the PrintOperation classonFailed(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 org.gnome.gobject.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, getMemoryLayout, 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 org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
PrintOperation
Create a PrintOperation proxy 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()Creates a new PrintOperation.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getPageSetup
Return the current page setup ofprintOperation.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 ofprintOperation.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 ofprintOperation.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 ofprintOperation.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(org.webkitgtk.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(org.webkitgtk.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
-