WebKitPrintOperation

WebKitPrintOperation — Controls a print operation

Synopsis

                    WebKitPrintOperation;
enum                WebKitPrintOperationResponse;
WebKitPrintOperation * webkit_print_operation_new       (WebKitWebView *web_view);
GtkPrintSettings *  webkit_print_operation_get_print_settings
                                                        (WebKitPrintOperation *print_operation);
void                webkit_print_operation_set_print_settings
                                                        (WebKitPrintOperation *print_operation,
                                                         GtkPrintSettings *print_settings);
GtkPageSetup *      webkit_print_operation_get_page_setup
                                                        (WebKitPrintOperation *print_operation);
void                webkit_print_operation_set_page_setup
                                                        (WebKitPrintOperation *print_operation,
                                                         GtkPageSetup *page_setup);
WebKitPrintOperationResponse webkit_print_operation_run_dialog
                                                        (WebKitPrintOperation *print_operation,
                                                         GtkWindow *parent);
void                webkit_print_operation_print        (WebKitPrintOperation *print_operation);

Object Hierarchy

  GObject
   +----WebKitPrintOperation

Properties

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

Signals

  "failed"                                         : Run Last
  "finished"                                       : Run Last

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

Details

WebKitPrintOperation

typedef struct _WebKitPrintOperation WebKitPrintOperation;


enum WebKitPrintOperationResponse

typedef enum {
    WEBKIT_PRINT_OPERATION_RESPONSE_PRINT,
    WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL
} WebKitPrintOperationResponse;

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

WEBKIT_PRINT_OPERATION_RESPONSE_PRINT

Print button was cliked in print dialog

WEBKIT_PRINT_OPERATION_RESPONSE_CANCEL

Print dialog was cancelled

webkit_print_operation_new ()

WebKitPrintOperation * webkit_print_operation_new       (WebKitWebView *web_view);

Create a new WebKitPrintOperation to print web_view contents.

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.

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.

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_print_settings() or webkit_print_operation_run_dialog() have been called.

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.

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.

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".

print_operation :

a WebKitPrintOperation

Property Details

The "page-setup" property

  "page-setup"               GtkPageSetup*         : Read / Write

The initial GtkPageSetup for the print operation.


The "print-settings" property

  "print-settings"           GtkPrintSettings*     : Read / Write

The initial GtkPrintSettings for the print operation.


The "web-view" property

  "web-view"                 WebKitWebView*        : Read / Write / Construct Only

The WebKitWebView that will be printed.

Signal Details

The "failed" signal

void                user_function                      (WebKitPrintOperation *print_operation,
                                                        gpointer              error,
                                                        gpointer              user_data)            : Run Last

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.

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.

The "finished" signal

void                user_function                      (WebKitPrintOperation *print_operation,
                                                        gpointer              user_data)            : Run Last

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

print_operation :

the WebKitPrintOperation on which the signal was emitted

user_data :

user data set when the signal handler was connected.