1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
5 High-level Printing API
7 <!-- ##### SECTION Long_Description ##### -->
9 GtkPrintOperation is the high-level, portable printing API. It looks
10 a bit different than other GTK+ dialogs such as the #GtkFileChooser,
11 since some platforms don't expose enough infrastructure to implement
12 a good print dialog. On such platforms, GtkPrintOperation uses the
13 native print dialog. On platforms which do not provide a native
14 print dialog, GTK+ uses its own, see #GtkPrintUnixDialog.
18 The typical way to use the high-level printing API is to create a
19 #GtkPrintOperation object with gtk_print_operation_new() when the user
20 selects to print. Then you set some properties on it, e.g. the page size,
21 any #GtkPrintSettings from previous print operations, the number of pages,
22 the current page, etc.
25 Then you start the print operation by calling gtk_print_operation_run().
26 It will then show a dialog, let the user select a printer and options.
27 When the user finished the dialog various signals will be emitted on the
28 #GtkPrintOperation, the main one being ::draw-page, which you are supposed
29 to catch and render the page on the provided #GtkPrintContext using Cairo.
33 <title>The high-level printing API</title>
35 static GtkPrintSettings *settings = NULL;
40 GtkPrintOperation *print;
41 GtkPrintOperationResult res;
43 print = gtk_print_operation_new (<!-- -->);
46 gtk_print_operation_set_print_settings (print, settings);
48 g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL);
49 g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);
51 res = gtk_print_operation_run (print, GTK_WINDOW (main_window), NULL);
53 if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
56 g_object_unref (settings);
57 settings = g_object_ref (gtk_print_operation_get_print_settings (print));
60 g_object_unref (print);
67 Printing support was added in GTK+ 2.10.
70 <!-- ##### SECTION See_Also ##### -->
72 #GtkPrintContext, #GtkPrintUnixDialog
75 <!-- ##### SECTION Stability_Level ##### -->
78 <!-- ##### STRUCT GtkPrintOperation ##### -->
84 <!-- ##### SIGNAL GtkPrintOperation::begin-print ##### -->
89 @printoperation: the object which received the signal.
92 <!-- ##### SIGNAL GtkPrintOperation::draw-page ##### -->
97 @printoperation: the object which received the signal.
101 <!-- ##### SIGNAL GtkPrintOperation::end-print ##### -->
106 @printoperation: the object which received the signal.
109 <!-- ##### SIGNAL GtkPrintOperation::request-page-setup ##### -->
114 @printoperation: the object which received the signal.
119 <!-- ##### SIGNAL GtkPrintOperation::status-changed ##### -->
124 @printoperation: the object which received the signal.
126 <!-- ##### ARG GtkPrintOperation:current-page ##### -->
131 <!-- ##### ARG GtkPrintOperation:default-page-setup ##### -->
136 <!-- ##### ARG GtkPrintOperation:job-name ##### -->
141 <!-- ##### ARG GtkPrintOperation:number-of-pages ##### -->
146 <!-- ##### ARG GtkPrintOperation:pdf-target ##### -->
151 <!-- ##### ARG GtkPrintOperation:print-settings ##### -->
156 <!-- ##### ARG GtkPrintOperation:show-dialog ##### -->
161 <!-- ##### ARG GtkPrintOperation:status ##### -->
166 <!-- ##### ARG GtkPrintOperation:status-string ##### -->
171 <!-- ##### ARG GtkPrintOperation:unit ##### -->
176 <!-- ##### ARG GtkPrintOperation:use-full-page ##### -->
181 <!-- ##### ENUM GtkPrintStatus ##### -->
186 @GTK_PRINT_STATUS_INITIAL:
187 @GTK_PRINT_STATUS_PREPARING:
188 @GTK_PRINT_STATUS_GENERATING_DATA:
189 @GTK_PRINT_STATUS_SENDING_DATA:
190 @GTK_PRINT_STATUS_PENDING:
191 @GTK_PRINT_STATUS_PENDING_ISSUE:
192 @GTK_PRINT_STATUS_PRINTING:
193 @GTK_PRINT_STATUS_FINISHED:
194 @GTK_PRINT_STATUS_FINISHED_ABORTED:
196 <!-- ##### ENUM GtkPrintOperationResult ##### -->
201 @GTK_PRINT_OPERATION_RESULT_ERROR:
202 @GTK_PRINT_OPERATION_RESULT_APPLY:
203 @GTK_PRINT_OPERATION_RESULT_CANCEL:
205 <!-- ##### ENUM GtkPrintError ##### -->
210 @GTK_PRINT_ERROR_GENERAL:
211 @GTK_PRINT_ERROR_INTERNAL_ERROR:
212 @GTK_PRINT_ERROR_NOMEM:
214 <!-- ##### MACRO GTK_PRINT_ERROR ##### -->
216 The #GQuark used for #GtkPrintError errors.
221 <!-- ##### FUNCTION gtk_print_operation_new ##### -->
229 <!-- ##### FUNCTION gtk_print_operation_set_default_page_setup ##### -->
238 <!-- ##### FUNCTION gtk_print_operation_get_default_page_setup ##### -->
247 <!-- ##### FUNCTION gtk_print_operation_set_print_settings ##### -->
256 <!-- ##### FUNCTION gtk_print_operation_get_print_settings ##### -->
265 <!-- ##### FUNCTION gtk_print_operation_set_job_name ##### -->
274 <!-- ##### FUNCTION gtk_print_operation_set_nr_of_pages ##### -->
283 <!-- ##### FUNCTION gtk_print_operation_set_current_page ##### -->
292 <!-- ##### FUNCTION gtk_print_operation_set_use_full_page ##### -->
301 <!-- ##### FUNCTION gtk_print_operation_set_unit ##### -->
310 <!-- ##### FUNCTION gtk_print_operation_set_show_dialog ##### -->
319 <!-- ##### FUNCTION gtk_print_operation_set_pdf_target ##### -->
328 <!-- ##### FUNCTION gtk_print_operation_run ##### -->
339 <!-- ##### FUNCTION gtk_print_operation_run_async ##### -->
348 <!-- ##### FUNCTION gtk_print_operation_get_status ##### -->
357 <!-- ##### FUNCTION gtk_print_operation_get_status_string ##### -->
366 <!-- ##### FUNCTION gtk_print_operation_is_finished ##### -->
375 <!-- ##### FUNCTION gtk_print_run_page_setup_dialog ##### -->
386 <!-- ##### USER_FUNCTION GtkPageSetupDoneFunc ##### -->
395 <!-- ##### FUNCTION gtk_print_run_page_setup_dialog_async ##### -->