PrintOperationPreviewIF

Description GtkPrintOperation is the high-level, portable printing API. It looks a bit different than other GTK+ dialogs such as the GtkFileChooser, since some platforms don't expose enough infrastructure to implement a good print dialog. On such platforms, GtkPrintOperation uses the native print dialog. On platforms which do not provide a native print dialog, GTK+ uses its own, see GtkPrintUnixDialog. The typical way to use the high-level printing API is to create a GtkPrintOperation object with gtk_print_operation_new() when the user selects to print. Then you set some properties on it, e.g. the page size, any GtkPrintSettings from previous print operations, the number of pages, the current page, etc. Then you start the print operation by calling gtk_print_operation_run(). It will then show a dialog, let the user select a printer and options. When the user finished the dialog various signals will be emitted on the GtkPrintOperation, the main one being ::draw-page, which you are supposed to catch and render the page on the provided GtkPrintContext using Cairo. By default GtkPrintOperation uses an external application to do print preview. To implement a custom print preview, an application must connect to the preview signal. The functions gtk_print_operation_print_preview_render_page(), gtk_print_operation_preview_end_preview() and gtk_print_operation_preview_is_selected() are useful when implementing a print preview. Printing support was added in GTK+ 2.10.

Members

Functions

addOnGotPageSize
void addOnGotPageSize(void delegate(GtkPrintContext*, PageSetup, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags)

The ::got-page-size signal is emitted once for each page that gets rendered to the preview. A handler for this signal should update the context according to page_setup and set up a suitable cairo context, using gtk_print_context_set_cairo_context().

addOnReady
void addOnReady(void delegate(GtkPrintContext*, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags)

The ::ready signal gets emitted once per preview operation, before the first page is rendered. A handler for this signal can be used for setup tasks. See Also GtkPrintContext, GtkPrintUnixDialog

addOnUpdateCustomWidget
void addOnUpdateCustomWidget(void delegate(Widget, PageSetup, PrintSettings, PrintOperationPreviewIF) dlg, ConnectFlags connectFlags)

Emitted after change of selected printer. The actual page setup and print settings are passed to the custom widget, which can actualize itself according to this change. Since 2.18

endPreview
void endPreview()

Ends a preview. This function must be called to finish a custom print preview. Since 2.10

getPrintOperationPreviewTStruct
GtkPrintOperationPreview* getPrintOperationPreviewTStruct()
Undocumented in source.
getStruct
void* getStruct()

the main Gtk struct as a void*

isSelected
int isSelected(int pageNr)

Returns whether the given page is included in the set of pages that have been selected for printing. Since 2.10

onGotPageSizeListeners
void delegate(GtkPrintContext*, PageSetup, PrintOperationPreviewIF)[] onGotPageSizeListeners()
Undocumented in source.
onReadyListeners
void delegate(GtkPrintContext*, PrintOperationPreviewIF)[] onReadyListeners()
Undocumented in source.
onUpdateCustomWidgetListeners
void delegate(Widget, PageSetup, PrintSettings, PrintOperationPreviewIF)[] onUpdateCustomWidgetListeners()
renderPage
void renderPage(int pageNr)

Renders a page to the preview, using the print context that was passed to the "preview" handler together with preview. A custom iprint preview should use this function in its ::expose handler to render the currently selected page. Note that this function requires a suitable cairo context to be associated with the print context. Since 2.10

Meta