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
Modifier and TypeClassDescriptionstatic class
PrintOperation.Builder<B extends PrintOperation.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theFailedCallback
callback.static interface
Functional interface declaration of theFinishedCallback
callback.static class
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionPrintOperation
(MemorySegment address) Create a PrintOperation proxy instance for the provided memory address.PrintOperation
(WebView webView) Create a newWebKitPrintOperation
to printwebView
contents. -
Method Summary
Modifier and TypeMethodDescriptionprotected PrintOperation
asParent()
Returns this instance as if it were its parent type.static PrintOperation.Builder
<? extends PrintOperation.Builder> builder()
APrintOperation.Builder
object constructs aPrintOperation
with the specified properties.void
emitFailed
(GError error) Emits the "failed" signal.void
Emits the "finished" signal.Return the current page setup of this PrintOperation.Return the current print settings of this PrintOperation.static Type
getType()
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.void
print()
Start a print operation using current print settings and page setup.Run the print dialog and start printing.void
setPageSetup
(PageSetup pageSetup) Set the current page setup of this PrintOperation.void
setPrintSettings
(PrintSettings printSettings) Set the current print settings of this PrintOperation.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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.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 newWebKitPrintOperation
to printwebView
contents.- Parameters:
webView
- aWebKitWebView
- Throws:
UnsupportedPlatformException
- when run on a platform other than linux
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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 of this PrintOperation.It returns
null
until either webkit_print_operation_set_page_setup() or webkit_print_operation_run_dialog() have been called.- Returns:
- the current
GtkPageSetup
of this PrintOperation.
-
getPrintSettings
Return the current print settings of this PrintOperation.It returns
null
until either webkit_print_operation_set_print_settings() or webkit_print_operation_run_dialog() have been called.- Returns:
- the current
GtkPrintSettings
of this PrintOperation.
-
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.CANCEL
is returned. If the user clicks on the print button,PrintOperationResponse.PRINT
is 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
WebKitPrintOperationResponse
of the print dialog
-
setPageSetup
Set the current page setup of this PrintOperation.Current page setup is used for the initial values of the print dialog when webkit_print_operation_run_dialog() is called.
- Parameters:
pageSetup
- aGtkPageSetup
to set
-
setPrintSettings
Set the current print settings of this PrintOperation.Set the current print settings of this PrintOperation. Current print settings are used for the initial values of the print dialog when webkit_print_operation_run_dialog() is called.
- Parameters:
printSettings
- aGtkPrintSettings
to 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.gnome.webkit.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.gnome.webkit.PrintOperation.FinishedCallback)
. -
builder
APrintOperation.Builder
object constructs aPrintOperation
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withPrintOperation.Builder.build()
.
-