WebKitPrintOperation

WebKitPrintOperation — Controls a print operation

Functions

Properties

GtkPageSetup * page-setup Read / Write
GtkPrintSettings * print-settings Read / Write
WebKitWebView * web-view Read / Write / Construct Only

Signals

void failed Run Last
void finished Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── WebKitPrintOperation

Description

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().

Functions

webkit_print_operation_new ()

WebKitPrintOperation *
webkit_print_operation_new (WebKitWebView *web_view);

Create a new WebKitPrintOperation to print web_view contents.

Parameters

web_view

a WebKitWebView

 

Returns

a new WebKitPrintOperation.

[transfer full]


webkit_print_operation_get_print_settings ()

GtkPrintSettings *
webkit_print_operation_get_print_settings
                               (WebKitPrintOperation *print_operation);

Return the current print settings of print_operation . It returns NULL until either webkit_print_operation_set_print_settings() or webkit_print_operation_run_dialog() have been called.

Parameters

print_operation

a WebKitPrintOperation

 

Returns

the current GtkPrintSettings of print_operation .

[transfer none]


webkit_print_operation_set_print_settings ()

void
webkit_print_operation_set_print_settings
                               (WebKitPrintOperation *print_operation,
                                GtkPrintSettings *print_settings);

Set the current print settings of print_operation . Current print settings are used for the initial values of the print dialog when webkit_print_operation_run_dialog() is called.

Parameters

print_operation

a WebKitPrintOperation

 

print_settings

a GtkPrintSettings to set

 

webkit_print_operation_get_page_setup ()

GtkPageSetup *
webkit_print_operation_get_page_setup (WebKitPrintOperation *print_operation);

Return the current page setup of print_operation . It returns NULL until either webkit_print_operation_set_page_setup() or webkit_print_operation_run_dialog() have been called.

Parameters

print_operation

a WebKitPrintOperation

 

Returns

the current GtkPageSetup of print_operation .

[transfer none]


webkit_print_operation_set_page_setup ()

void
webkit_print_operation_set_page_setup (WebKitPrintOperation *print_operation,
                                       GtkPageSetup *page_setup);

Set the current page setup of print_operation . Current page setup is used for the initial values of the print dialog when webkit_print_operation_run_dialog() is called.

Parameters

print_operation

a WebKitPrintOperation

 

page_setup

a GtkPageSetup to set

 

webkit_print_operation_run_dialog ()

WebKitPrintOperationResponse
webkit_print_operation_run_dialog (WebKitPrintOperation *print_operation,
                                   GtkWindow *parent);

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 WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL is returned. If the user clicks on the print button, WEBKIT_PRINT_OPERATION_RESPONSE_PRINT is returned and the print operation starts. In this case, the “finished” signal is emitted when the operation finishes. If an error occurs while printing, the signal “failed” is emitted before “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 webkit_print_operation_get_print_settings() and webkit_print_operation_get_page_setup() after this method.

Parameters

print_operation

a WebKitPrintOperation

 

parent

transient parent of the print dialog.

[allow-none]

Returns

the WebKitPrintOperationResponse of the print dialog


webkit_print_operation_print ()

void
webkit_print_operation_print (WebKitPrintOperation *print_operation);

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 “finished” signal is emitted when the printing operation finishes. If an error occurs while printing the signal “failed” is emitted before “finished”.

Parameters

print_operation

a WebKitPrintOperation

 

Types and Values

WebKitPrintOperation

typedef struct _WebKitPrintOperation WebKitPrintOperation;

enum WebKitPrintOperationResponse

Enum values representing the response of the print dialog shown with webkit_print_operation_run_dialog().

Members

WEBKIT_PRINT_OPERATION_RESPONSE_PRINT

Print button was cliked in print dialog

 

WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL

Print dialog was cancelled

 

Property Details

The “page-setup” property

  “page-setup”               GtkPageSetup *

The initial GtkPageSetup for the print operation.

Flags: Read / Write


The “print-settings” property

  “print-settings”           GtkPrintSettings *

The initial GtkPrintSettings for the print operation.

Flags: Read / Write


The “web-view” property

  “web-view”                 WebKitWebView *

The WebKitWebView that will be printed.

Flags: Read / Write / Construct Only

Signal Details

The “failed” signal

void
user_function (WebKitPrintOperation *print_operation,
               GError               *error,
               gpointer              user_data)

Emitted when an error occurs while printing. The given error , of the domain WEBKIT_PRINT_ERROR, contains further details of the failure. The “finished” signal is emitted after this one.

Parameters

print_operation

the WebKitPrintOperation on which the signal was emitted

 

error

the GError that was triggered

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “finished” signal

void
user_function (WebKitPrintOperation *print_operation,
               gpointer              user_data)

Emitted when the print operation has finished doing everything required for printing.

Parameters

print_operation

the WebKitPrintOperation on which the signal was emitted

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last