<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
<!ENTITY pi "&#960;">
<!ENTITY solidus "&#8260;">
]>
<refentry id="gtk4-High-level-Printing-API">
<refmeta>
<refentrytitle role="top_of_page" id="gtk4-High-level-Printing-API.top_of_page">GtkPrintOperation</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK4 Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>GtkPrintOperation</refname>
<refpurpose>High-level Printing API</refpurpose>
</refnamediv>

<refsect1 id="gtk4-High-level-Printing-API.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="GtkPrintOperation"><returnvalue>GtkPrintOperation</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-print-operation-new">gtk_print_operation_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-allow-async">gtk_print_operation_set_allow_async</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-error">gtk_print_operation_get_error</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-default-page-setup">gtk_print_operation_set_default_page_setup</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkPageSetup"><returnvalue>GtkPageSetup</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-default-page-setup">gtk_print_operation_get_default_page_setup</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-print-settings">gtk_print_operation_set_print_settings</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkPrintSettings"><returnvalue>GtkPrintSettings</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-print-settings">gtk_print_operation_get_print_settings</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-job-name">gtk_print_operation_set_job_name</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-n-pages">gtk_print_operation_set_n_pages</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gint"><returnvalue>gint</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-n-pages-to-print">gtk_print_operation_get_n_pages_to_print</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-current-page">gtk_print_operation_set_current_page</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-use-full-page">gtk_print_operation_set_use_full_page</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-unit">gtk_print_operation_set_unit</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-export-filename">gtk_print_operation_set_export_filename</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-show-progress">gtk_print_operation_set_show_progress</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-track-print-status">gtk_print_operation_set_track_print_status</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-custom-tab-label">gtk_print_operation_set_custom_tab_label</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkPrintOperationResult"><returnvalue>GtkPrintOperationResult</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-run">gtk_print_operation_run</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-cancel">gtk_print_operation_cancel</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-draw-page-finish">gtk_print_operation_draw_page_finish</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-defer-drawing">gtk_print_operation_set_defer_drawing</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkPrintStatus"><returnvalue>GtkPrintStatus</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-status">gtk_print_operation_get_status</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-status-string">gtk_print_operation_get_status_string</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-is-finished">gtk_print_operation_is_finished</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-support-selection">gtk_print_operation_set_support_selection</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-support-selection">gtk_print_operation_get_support_selection</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-has-selection">gtk_print_operation_set_has_selection</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-has-selection">gtk_print_operation_get_has_selection</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-set-embed-page-setup">gtk_print_operation_set_embed_page_setup</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-get-embed-page-setup">gtk_print_operation_get_embed_page_setup</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GtkPageSetup"><returnvalue>GtkPageSetup</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="gtk-print-run-page-setup-dialog">gtk_print_run_page_setup_dialog</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><phrase role="c_punctuation">(</phrase><link linkend="GtkPageSetupDoneFunc">*GtkPageSetupDoneFunc</link><phrase role="c_punctuation">)</phrase>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-run-page-setup-dialog-async">gtk_print_run_page_setup_dialog_async</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-preview-end-preview">gtk_print_operation_preview_end_preview</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-preview-is-selected">gtk_print_operation_preview_is_selected</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="gtk-print-operation-preview-render-page">gtk_print_operation_preview_render_page</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.properties" role="properties">
<title role="properties.title">Properties</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="properties_type" colwidth="150px"/>
<colspec colname="properties_name" colwidth="300px"/>
<colspec colname="properties_flags" colwidth="200px"/>
<tbody>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--allow-async">allow-async</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gint"><type>gint</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--current-page">current-page</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gchar"><type>gchar</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkPrintOperation--custom-tab-label">custom-tab-label</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkPrintOperation--default-page-setup">default-page-setup</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--embed-page-setup">embed-page-setup</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gchar"><type>gchar</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkPrintOperation--export-filename">export-filename</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--has-selection">has-selection</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gchar"><type>gchar</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkPrintOperation--job-name">job-name</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gint"><type>gint</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--n-pages">n-pages</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gint"><type>gint</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--n-pages-to-print">n-pages-to-print</link></entry><entry role="property_flags">Read</entry></row>
<row><entry role="property_type"><link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkPrintOperation--print-settings">print-settings</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--show-progress">show-progress</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="GtkPrintStatus"><type>GtkPrintStatus</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--status">status</link></entry><entry role="property_flags">Read</entry></row>
<row><entry role="property_type"><link linkend="gchar"><type>gchar</type></link>&#160;*</entry><entry role="property_name"><link linkend="GtkPrintOperation--status-string">status-string</link></entry><entry role="property_flags">Read</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--support-selection">support-selection</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--track-print-status">track-print-status</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="GtkUnit"><type>GtkUnit</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--unit">unit</link></entry><entry role="property_flags">Read / Write</entry></row>
<row><entry role="property_type"><link linkend="gboolean"><type>gboolean</type></link></entry><entry role="property_name"><link linkend="GtkPrintOperation--use-full-page">use-full-page</link></entry><entry role="property_flags">Read / Write</entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.signals" role="signal_proto">
<title role="signal_proto.title">Signals</title>
<informaltable frame="none">
<tgroup cols="3">
<colspec colname="signal_proto_type" colwidth="150px"/>
<colspec colname="signal_proto_name" colwidth="300px"/>
<colspec colname="signal_proto_flags" colwidth="200px"/>
<tbody>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-begin-print">begin-print</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="GObject"><returnvalue>GObject</returnvalue></link>*</entry><entry role="signal_name"><link linkend="GtkPrintOperation-create-custom-widget">create-custom-widget</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-custom-widget-apply">custom-widget-apply</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-done">done</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-draw-page">draw-page</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-end-print">end-print</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-paginate">paginate</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-preview">preview</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-request-page-setup">request-page-setup</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-status-changed">status-changed</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperation-update-custom-widget">update-custom-widget</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperationPreview-got-page-size">got-page-size</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>
<row><entry role="signal_type"><link linkend="void"><returnvalue>void</returnvalue></link></entry><entry role="signal_name"><link linkend="GtkPrintOperationPreview-ready">ready</link></entry><entry role="signal_flags"><link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<anchor id="GtkPrintOperation"/><anchor id="GtkPrintOperationPreview"/><refsect1 id="gtk4-High-level-Printing-API.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GtkPrintOperation-struct">GtkPrintOperation</link></entry></row>
<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GtkPrintOperationClass">GtkPrintOperationClass</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GtkPrintStatus">GtkPrintStatus</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GtkPrintOperationAction">GtkPrintOperationAction</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GtkPrintOperationResult">GtkPrintOperationResult</link></entry></row>
<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GtkPrintError">GtkPrintError</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="GTK-PRINT-ERROR:CAPS">GTK_PRINT_ERROR</link></entry></row>

<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GtkPrintOperationPreview-struct">GtkPrintOperationPreview</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<screen>    <link linkend="GInterface">GInterface</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkPrintOperationPreview
    <link linkend="GObject">GObject</link>
    <phrase role="lineart">&#9584;&#9472;&#9472;</phrase> GtkPrintOperation
</screen>
</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.prerequisites" role="prerequisites">
<title role="prerequisites.title">Prerequisites</title>
<para>
GtkPrintOperationPreview requires
 <link linkend="GObject">GObject</link>.</para>

</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkPrintOperation implements
 <link linkend="GtkPrintOperationPreview">GtkPrintOperationPreview</link>.</para>

</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.implementations" role="implementations">
<title role="implementations.title">Known Implementations</title>
<para>
GtkPrintOperationPreview is implemented by
 <link linkend="GtkPrintOperation">GtkPrintOperation</link>.</para>

</refsect1>

<refsect1 id="gtk4-High-level-Printing-API.includes"><title>Includes</title><synopsis>#include &lt;gtk/gtk.h&gt;
</synopsis></refsect1>

<refsect1 id="gtk4-High-level-Printing-API.description" role="desc">
<title role="desc.title">Description</title>
<para>GtkPrintOperation is the high-level, portable printing API.
It looks a bit different than other GTK+ dialogs such as the
<link linkend="GtkFileChooser"><type>GtkFileChooser</type></link>, 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 <link linkend="GtkPrintUnixDialog"><type>GtkPrintUnixDialog</type></link>.</para>
<para>The typical way to use the high-level printing API is to create
a GtkPrintOperation object with <link linkend="gtk-print-operation-new"><function>gtk_print_operation_new()</function></link> when
the user selects to print. Then you set some properties on it,
e.g. the page size, any <link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link> from previous print
operations, the number of pages, the current page, etc.</para>
<para>Then you start the print operation by calling <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>.
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 <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link>, the main one being
<link linkend="GtkPrintOperation-draw-page"><type>“draw-page”</type></link>, which you are supposed to catch
and render the page on the provided <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> using Cairo.</para>
<refsect2><title>The high-level printing API</title><informalexample><programlisting role="example"><![CDATA[
static GtkPrintSettings *settings = NULL;

static void
do_print (void)
{
  GtkPrintOperation *print;
  GtkPrintOperationResult res;

  print = gtk_print_operation_new ();

  if (settings != NULL)
    gtk_print_operation_set_print_settings (print, settings);

  g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL);
  g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);

  res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
                                 GTK_WINDOW (main_window), NULL);

  if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
    {
      if (settings != NULL)
        g_object_unref (settings);
      settings = g_object_ref (gtk_print_operation_get_print_settings (print));
    }

  g_object_unref (print);
}
]]></programlisting></informalexample>
<para></para>
<para>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
<link linkend="gtk-print-operation-preview-render-page"><function>gtk_print_operation_preview_render_page()</function></link>,
<link linkend="gtk-print-operation-preview-end-preview"><function>gtk_print_operation_preview_end_preview()</function></link> and
<link linkend="gtk-print-operation-preview-is-selected"><function>gtk_print_operation_preview_is_selected()</function></link>
are useful when implementing a print preview.</para>
</refsect2>

</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="gtk-print-operation-new" role="function">
<title>gtk_print_operation_new&#160;()</title>
<indexterm zone="gtk-print-operation-new"><primary>gtk_print_operation_new</primary></indexterm>
<programlisting language="C"><link linkend="GtkPrintOperation"><returnvalue>GtkPrintOperation</returnvalue></link>&#160;*
gtk_print_operation_new (<parameter><type>void</type></parameter>);</programlisting>
<para>Creates a new <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link>.</para>
<refsect3 id="gtk-print-operation-new.returns" role="returns">
<title>Returns</title>
<para> a new <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-allow-async" role="function">
<title>gtk_print_operation_set_allow_async&#160;()</title>
<indexterm zone="gtk-print-operation-set-allow-async"><primary>gtk_print_operation_set_allow_async</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_allow_async (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                     <parameter><link linkend="gboolean"><type>gboolean</type></link> allow_async</parameter>);</programlisting>
<para>Sets whether the <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link> may return
before the print operation is completed. Note that
some platforms may not allow asynchronous operation.</para>
<refsect3 id="gtk-print-operation-set-allow-async.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>allow_async</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to allow asynchronous operation</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-error" role="function">
<title>gtk_print_operation_get_error&#160;()</title>
<indexterm zone="gtk-print-operation-get-error"><primary>gtk_print_operation_get_error</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_get_error (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                               <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Call this when the result of a print operation is
<link linkend="GTK-PRINT-OPERATION-RESULT-ERROR:CAPS"><literal>GTK_PRINT_OPERATION_RESULT_ERROR</literal></link>, either as returned by 
<link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>, or in the <link linkend="GtkPrintOperation-done"><type>“done”</type></link> signal 
handler. The returned <link linkend="GError"><type>GError</type></link> will contain more details on what went wrong.</para>
<refsect3 id="gtk-print-operation-get-error.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for the error</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-default-page-setup" role="function">
<title>gtk_print_operation_set_default_page_setup&#160;()</title>
<indexterm zone="gtk-print-operation-set-default-page-setup"><primary>gtk_print_operation_set_default_page_setup</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_default_page_setup
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                <parameter><link linkend="GtkPageSetup"><type>GtkPageSetup</type></link> *default_page_setup</parameter>);</programlisting>
<para>Makes <parameter>default_page_setup</parameter>
 the default page setup for <parameter>op</parameter>
.</para>
<para>This page setup will be used by <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>,
but it can be overridden on a per-page basis by connecting
to the <link linkend="GtkPrintOperation-request-page-setup"><type>“request-page-setup”</type></link> signal.</para>
<refsect3 id="gtk-print-operation-set-default-page-setup.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>default_page_setup</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-default-page-setup" role="function">
<title>gtk_print_operation_get_default_page_setup&#160;()</title>
<indexterm zone="gtk-print-operation-get-default-page-setup"><primary>gtk_print_operation_get_default_page_setup</primary></indexterm>
<programlisting language="C"><link linkend="GtkPageSetup"><returnvalue>GtkPageSetup</returnvalue></link>&#160;*
gtk_print_operation_get_default_page_setup
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Returns the default page setup, see
<link linkend="gtk-print-operation-set-default-page-setup"><function>gtk_print_operation_set_default_page_setup()</function></link>.</para>
<refsect3 id="gtk-print-operation-get-default-page-setup.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-get-default-page-setup.returns" role="returns">
<title>Returns</title>
<para>the default page setup. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-print-settings" role="function">
<title>gtk_print_operation_set_print_settings&#160;()</title>
<indexterm zone="gtk-print-operation-set-print-settings"><primary>gtk_print_operation_set_print_settings</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_print_settings
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                <parameter><link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link> *print_settings</parameter>);</programlisting>
<para>Sets the print settings for <parameter>op</parameter>
. This is typically used to
re-establish print settings from a previous print operation,
see <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>.</para>
<refsect3 id="gtk-print-operation-set-print-settings.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>print_settings</para></entry>
<entry role="parameter_description"><para><link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-print-settings" role="function">
<title>gtk_print_operation_get_print_settings&#160;()</title>
<indexterm zone="gtk-print-operation-get-print-settings"><primary>gtk_print_operation_get_print_settings</primary></indexterm>
<programlisting language="C"><link linkend="GtkPrintSettings"><returnvalue>GtkPrintSettings</returnvalue></link>&#160;*
gtk_print_operation_get_print_settings
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Returns the current print settings.</para>
<para>Note that the return value is <link linkend="NULL:CAPS"><literal>NULL</literal></link> until either
<link linkend="gtk-print-operation-set-print-settings"><function>gtk_print_operation_set_print_settings()</function></link> or
<link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link> have been called.</para>
<refsect3 id="gtk-print-operation-get-print-settings.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-get-print-settings.returns" role="returns">
<title>Returns</title>
<para>the current print settings of <parameter>op</parameter>
. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-job-name" role="function">
<title>gtk_print_operation_set_job_name&#160;()</title>
<indexterm zone="gtk-print-operation-set-job-name"><primary>gtk_print_operation_set_job_name</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_job_name (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                  <parameter>const <link linkend="gchar"><type>gchar</type></link> *job_name</parameter>);</programlisting>
<para>Sets the name of the print job. The name is used to identify 
the job (e.g. in monitoring applications like eggcups). </para>
<para>If you don’t set a job name, GTK+ picks a default one by 
numbering successive print jobs.</para>
<refsect3 id="gtk-print-operation-set-job-name.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>job_name</para></entry>
<entry role="parameter_description"><para>a string that identifies the print job</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-n-pages" role="function">
<title>gtk_print_operation_set_n_pages&#160;()</title>
<indexterm zone="gtk-print-operation-set-n-pages"><primary>gtk_print_operation_set_n_pages</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_n_pages (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                 <parameter><link linkend="gint"><type>gint</type></link> n_pages</parameter>);</programlisting>
<para>Sets the number of pages in the document. </para>
<para>This must be set to a positive number
before the rendering starts. It may be set in a 
<link linkend="GtkPrintOperation-begin-print"><type>“begin-print”</type></link> signal hander.</para>
<para>Note that the page numbers passed to the 
<link linkend="GtkPrintOperation-request-page-setup"><type>“request-page-setup”</type></link> 
and <link linkend="GtkPrintOperation-draw-page"><type>“draw-page”</type></link> signals are 0-based, i.e. if 
the user chooses to print all pages, the last ::draw-page signal 
will be for page <parameter>n_pages</parameter>
 - 1.</para>
<refsect3 id="gtk-print-operation-set-n-pages.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>n_pages</para></entry>
<entry role="parameter_description"><para>the number of pages</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-n-pages-to-print" role="function">
<title>gtk_print_operation_get_n_pages_to_print&#160;()</title>
<indexterm zone="gtk-print-operation-get-n-pages-to-print"><primary>gtk_print_operation_get_n_pages_to_print</primary></indexterm>
<programlisting language="C"><link linkend="gint"><returnvalue>gint</returnvalue></link>
gtk_print_operation_get_n_pages_to_print
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Returns the number of pages that will be printed.</para>
<para>Note that this value is set during print preparation phase
(<link linkend="GTK-PRINT-STATUS-PREPARING:CAPS"><literal>GTK_PRINT_STATUS_PREPARING</literal></link>), so this function should never be
called before the data generation phase (<link linkend="GTK-PRINT-STATUS-GENERATING-DATA:CAPS"><literal>GTK_PRINT_STATUS_GENERATING_DATA</literal></link>).
You can connect to the <link linkend="GtkPrintOperation-status-changed"><type>“status-changed”</type></link> signal
and call <link linkend="gtk-print-operation-get-n-pages-to-print"><function>gtk_print_operation_get_n_pages_to_print()</function></link> when
print status is <link linkend="GTK-PRINT-STATUS-GENERATING-DATA:CAPS"><literal>GTK_PRINT_STATUS_GENERATING_DATA</literal></link>.
This is typically used to track the progress of print operation.</para>
<refsect3 id="gtk-print-operation-get-n-pages-to-print.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-get-n-pages-to-print.returns" role="returns">
<title>Returns</title>
<para> the number of pages that will be printed</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-current-page" role="function">
<title>gtk_print_operation_set_current_page&#160;()</title>
<indexterm zone="gtk-print-operation-set-current-page"><primary>gtk_print_operation_set_current_page</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_current_page (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                      <parameter><link linkend="gint"><type>gint</type></link> current_page</parameter>);</programlisting>
<para>Sets the current page.</para>
<para>If this is called before <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>, 
the user will be able to select to print only the current page.</para>
<para>Note that this only makes sense for pre-paginated documents.</para>
<refsect3 id="gtk-print-operation-set-current-page.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>current_page</para></entry>
<entry role="parameter_description"><para>the current page, 0-based</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-use-full-page" role="function">
<title>gtk_print_operation_set_use_full_page&#160;()</title>
<indexterm zone="gtk-print-operation-set-use-full-page"><primary>gtk_print_operation_set_use_full_page</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_use_full_page (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                       <parameter><link linkend="gboolean"><type>gboolean</type></link> full_page</parameter>);</programlisting>
<para>If <parameter>full_page</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the transformation for the cairo context 
obtained from <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> puts the origin at the top left 
corner of the page (which may not be the top left corner of the 
sheet, depending on page orientation and the number of pages per 
sheet). Otherwise, the origin is at the top left corner of the
imageable area (i.e. inside the margins).</para>
<refsect3 id="gtk-print-operation-set-use-full-page.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>full_page</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to set up the <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> for the full page</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-unit" role="function">
<title>gtk_print_operation_set_unit&#160;()</title>
<indexterm zone="gtk-print-operation-set-unit"><primary>gtk_print_operation_set_unit</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_unit (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                              <parameter><link linkend="GtkUnit"><type>GtkUnit</type></link> unit</parameter>);</programlisting>
<para>Sets up the transformation for the cairo context obtained from
<link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> in such a way that distances are measured in 
units of <parameter>unit</parameter>
.</para>
<refsect3 id="gtk-print-operation-set-unit.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>unit</para></entry>
<entry role="parameter_description"><para>the unit to use</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-export-filename" role="function">
<title>gtk_print_operation_set_export_filename&#160;()</title>
<indexterm zone="gtk-print-operation-set-export-filename"><primary>gtk_print_operation_set_export_filename</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_export_filename
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                <parameter>const <link linkend="gchar"><type>gchar</type></link> *filename</parameter>);</programlisting>
<para>Sets up the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> to generate a file instead
of showing the print dialog. The indended use of this function
is for implementing “Export to PDF” actions. Currently, PDF
is the only supported format.</para>
<para>“Print to PDF” support is independent of this and is done
by letting the user pick the “Print to PDF” item from the list
of printers in the print dialog.</para>
<refsect3 id="gtk-print-operation-set-export-filename.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>filename</para></entry>
<entry role="parameter_description"><para>the filename for the exported file. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>type</acronym> filename]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-show-progress" role="function">
<title>gtk_print_operation_set_show_progress&#160;()</title>
<indexterm zone="gtk-print-operation-set-show-progress"><primary>gtk_print_operation_set_show_progress</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_show_progress (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                       <parameter><link linkend="gboolean"><type>gboolean</type></link> show_progress</parameter>);</programlisting>
<para>If <parameter>show_progress</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the print operation will show a 
progress dialog during the print operation.</para>
<refsect3 id="gtk-print-operation-set-show-progress.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>show_progress</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to show a progress dialog</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-track-print-status" role="function">
<title>gtk_print_operation_set_track_print_status&#160;()</title>
<indexterm zone="gtk-print-operation-set-track-print-status"><primary>gtk_print_operation_set_track_print_status</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_track_print_status
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                <parameter><link linkend="gboolean"><type>gboolean</type></link> track_status</parameter>);</programlisting>
<para>If track_status is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the print operation will try to continue report
on the status of the print job in the printer queues and printer. This
can allow your application to show things like “out of paper” issues,
and when the print job actually reaches the printer.</para>
<para>This function is often implemented using some form of polling, so it should
not be enabled unless needed.</para>
<refsect3 id="gtk-print-operation-set-track-print-status.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>track_status</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to track status after printing</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-custom-tab-label" role="function">
<title>gtk_print_operation_set_custom_tab_label&#160;()</title>
<indexterm zone="gtk-print-operation-set-custom-tab-label"><primary>gtk_print_operation_set_custom_tab_label</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_custom_tab_label
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                <parameter>const <link linkend="gchar"><type>gchar</type></link> *label</parameter>);</programlisting>
<para>Sets the label for the tab holding custom widgets.</para>
<refsect3 id="gtk-print-operation-set-custom-tab-label.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>label</para></entry>
<entry role="parameter_description"><para>the label to use, or <link linkend="NULL:CAPS"><literal>NULL</literal></link> to use the default label. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-run" role="function">
<title>gtk_print_operation_run&#160;()</title>
<indexterm zone="gtk-print-operation-run"><primary>gtk_print_operation_run</primary></indexterm>
<programlisting language="C"><link linkend="GtkPrintOperationResult"><returnvalue>GtkPrintOperationResult</returnvalue></link>
gtk_print_operation_run (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                         <parameter><link linkend="GtkPrintOperationAction"><type>GtkPrintOperationAction</type></link> action</parameter>,
                         <parameter><link linkend="GtkWindow"><type>GtkWindow</type></link> *parent</parameter>,
                         <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<para>Runs the print operation, by first letting the user modify
print settings in the print dialog, and then print the document.</para>
<para>Normally that this function does not return until the rendering of all 
pages is complete. You can connect to the 
<link linkend="GtkPrintOperation-status-changed"><type>“status-changed”</type></link> signal on <parameter>op</parameter>
 to obtain some 
information about the progress of the print operation. 
Furthermore, it may use a recursive mainloop to show the print dialog.</para>
<para>If you call <link linkend="gtk-print-operation-set-allow-async"><function>gtk_print_operation_set_allow_async()</function></link> or set the 
<link linkend="GtkPrintOperation--allow-async"><type>“allow-async”</type></link> property the operation will run 
asynchronously if this is supported on the platform. The 
<link linkend="GtkPrintOperation-done"><type>“done”</type></link> signal will be emitted with the result of the 
operation when the it is done (i.e. when the dialog is canceled, or when 
the print succeeds or fails).</para>
<informalexample><programlisting role="example"><![CDATA[
if (settings != NULL)
  gtk_print_operation_set_print_settings (print, settings);
  
if (page_setup != NULL)
  gtk_print_operation_set_default_page_setup (print, page_setup);
  
g_signal_connect (print, "begin-print", 
                  G_CALLBACK (begin_print), &data);
g_signal_connect (print, "draw-page", 
                  G_CALLBACK (draw_page), &data);
 
res = gtk_print_operation_run (print, 
                               GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, 
                               parent, 
                               &error);
 
if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
 {
   error_dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
  			                     GTK_DIALOG_DESTROY_WITH_PARENT,
					     GTK_MESSAGE_ERROR,
					     GTK_BUTTONS_CLOSE,
					     "Error printing file:\n%s",
					     error->message);
   g_signal_connect (error_dialog, "response", 
                     G_CALLBACK (gtk_window_destroy), NULL);
   gtk_widget_show (error_dialog);
   g_error_free (error);
 }
else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
 {
   if (settings != NULL)
g_object_unref (settings);
   settings = g_object_ref (gtk_print_operation_get_print_settings (print));
 }
]]></programlisting></informalexample>
<para></para>
<para>Note that <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link> can only be called once on a
given <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link>.</para>
<refsect3 id="gtk-print-operation-run.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>action</para></entry>
<entry role="parameter_description"><para>the action to start</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>parent</para></entry>
<entry role="parameter_description"><para>Transient parent of the dialog. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>Return location for errors, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-run.returns" role="returns">
<title>Returns</title>
<para> the result of the print operation. A return value of
<link linkend="GTK-PRINT-OPERATION-RESULT-APPLY:CAPS"><literal>GTK_PRINT_OPERATION_RESULT_APPLY</literal></link> indicates that the printing was
completed successfully. In this case, it is a good idea to obtain
the used print settings with <link linkend="gtk-print-operation-get-print-settings"><function>gtk_print_operation_get_print_settings()</function></link>
and store them for reuse with the next print operation. A value of
<link linkend="GTK-PRINT-OPERATION-RESULT-IN-PROGRESS:CAPS"><literal>GTK_PRINT_OPERATION_RESULT_IN_PROGRESS</literal></link> means the operation is running
asynchronously, and will emit the <link linkend="GtkPrintOperation-done"><type>“done”</type></link> signal when
done.</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-cancel" role="function">
<title>gtk_print_operation_cancel&#160;()</title>
<indexterm zone="gtk-print-operation-cancel"><primary>gtk_print_operation_cancel</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_cancel (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Cancels a running print operation. This function may
be called from a <link linkend="GtkPrintOperation-begin-print"><type>“begin-print”</type></link>, 
<link linkend="GtkPrintOperation-paginate"><type>“paginate”</type></link> or <link linkend="GtkPrintOperation-draw-page"><type>“draw-page”</type></link>
signal handler to stop the currently running print 
operation.</para>
<refsect3 id="gtk-print-operation-cancel.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-draw-page-finish" role="function">
<title>gtk_print_operation_draw_page_finish&#160;()</title>
<indexterm zone="gtk-print-operation-draw-page-finish"><primary>gtk_print_operation_draw_page_finish</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_draw_page_finish (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Signalize that drawing of particular page is complete.</para>
<para>It is called after completion of page drawing (e.g. drawing in another
thread).
If <link linkend="gtk-print-operation-set-defer-drawing"><function>gtk_print_operation_set_defer_drawing()</function></link> was called before, then this function
has to be called by application. In another case it is called by the library
itself.</para>
<refsect3 id="gtk-print-operation-draw-page-finish.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-defer-drawing" role="function">
<title>gtk_print_operation_set_defer_drawing&#160;()</title>
<indexterm zone="gtk-print-operation-set-defer-drawing"><primary>gtk_print_operation_set_defer_drawing</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_defer_drawing (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Sets up the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> to wait for calling of
<link linkend="gtk-print-operation-draw-page-finish"><function>gtk_print_operation_draw_page_finish()</function></link> from application. It can
be used for drawing page in another thread.</para>
<para>This function must be called in the callback of “draw-page” signal.</para>
<refsect3 id="gtk-print-operation-set-defer-drawing.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-status" role="function">
<title>gtk_print_operation_get_status&#160;()</title>
<indexterm zone="gtk-print-operation-get-status"><primary>gtk_print_operation_get_status</primary></indexterm>
<programlisting language="C"><link linkend="GtkPrintStatus"><returnvalue>GtkPrintStatus</returnvalue></link>
gtk_print_operation_get_status (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Returns the status of the print operation. 
Also see <link linkend="gtk-print-operation-get-status-string"><function>gtk_print_operation_get_status_string()</function></link>.</para>
<refsect3 id="gtk-print-operation-get-status.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-get-status.returns" role="returns">
<title>Returns</title>
<para> the status of the print operation</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-status-string" role="function">
<title>gtk_print_operation_get_status_string&#160;()</title>
<indexterm zone="gtk-print-operation-get-status-string"><primary>gtk_print_operation_get_status_string</primary></indexterm>
<programlisting language="C">const <link linkend="gchar"><returnvalue>gchar</returnvalue></link>&#160;*
gtk_print_operation_get_status_string (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Returns a string representation of the status of the 
print operation. The string is translated and suitable
for displaying the print status e.g. in a <link linkend="GtkStatusbar"><type>GtkStatusbar</type></link>.</para>
<para>Use <link linkend="gtk-print-operation-get-status"><function>gtk_print_operation_get_status()</function></link> to obtain a status
value that is suitable for programmatic use.</para>
<refsect3 id="gtk-print-operation-get-status-string.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-get-status-string.returns" role="returns">
<title>Returns</title>
<para> a string representation of the status
of the print operation</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-is-finished" role="function">
<title>gtk_print_operation_is_finished&#160;()</title>
<indexterm zone="gtk-print-operation-is-finished"><primary>gtk_print_operation_is_finished</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_print_operation_is_finished (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>A convenience function to find out if the print operation
is finished, either successfully (<link linkend="GTK-PRINT-STATUS-FINISHED:CAPS"><literal>GTK_PRINT_STATUS_FINISHED</literal></link>)
or unsuccessfully (<link linkend="GTK-PRINT-STATUS-FINISHED-ABORTED:CAPS"><literal>GTK_PRINT_STATUS_FINISHED_ABORTED</literal></link>).</para>
<para>Note: when you enable print status tracking the print operation
can be in a non-finished state even after done has been called, as
the operation status then tracks the print job status on the printer.</para>
<refsect3 id="gtk-print-operation-is-finished.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-is-finished.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, if the print operation is finished.</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-support-selection" role="function">
<title>gtk_print_operation_set_support_selection&#160;()</title>
<indexterm zone="gtk-print-operation-set-support-selection"><primary>gtk_print_operation_set_support_selection</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_support_selection
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                <parameter><link linkend="gboolean"><type>gboolean</type></link> support_selection</parameter>);</programlisting>
<para>Sets whether selection is supported by <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link>.</para>
<refsect3 id="gtk-print-operation-set-support-selection.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>support_selection</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to support selection</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-support-selection" role="function">
<title>gtk_print_operation_get_support_selection&#160;()</title>
<indexterm zone="gtk-print-operation-get-support-selection"><primary>gtk_print_operation_get_support_selection</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_print_operation_get_support_selection
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Gets the value of <link linkend="GtkPrintOperation--support-selection"><type>“support-selection”</type></link> property.</para>
<refsect3 id="gtk-print-operation-get-support-selection.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-get-support-selection.returns" role="returns">
<title>Returns</title>
<para> whether the application supports print of selection</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-has-selection" role="function">
<title>gtk_print_operation_set_has_selection&#160;()</title>
<indexterm zone="gtk-print-operation-set-has-selection"><primary>gtk_print_operation_set_has_selection</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_has_selection (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                       <parameter><link linkend="gboolean"><type>gboolean</type></link> has_selection</parameter>);</programlisting>
<para>Sets whether there is a selection to print.</para>
<para>Application has to set number of pages to which the selection
will draw by <link linkend="gtk-print-operation-set-n-pages"><function>gtk_print_operation_set_n_pages()</function></link> in a callback of
<link linkend="GtkPrintOperation-begin-print"><type>“begin-print”</type></link>.</para>
<refsect3 id="gtk-print-operation-set-has-selection.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>has_selection</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> indicates that a selection exists</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-has-selection" role="function">
<title>gtk_print_operation_get_has_selection&#160;()</title>
<indexterm zone="gtk-print-operation-get-has-selection"><primary>gtk_print_operation_get_has_selection</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_print_operation_get_has_selection (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Gets the value of <link linkend="GtkPrintOperation--has-selection"><type>“has-selection”</type></link> property.</para>
<refsect3 id="gtk-print-operation-get-has-selection.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-get-has-selection.returns" role="returns">
<title>Returns</title>
<para> whether there is a selection</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-set-embed-page-setup" role="function">
<title>gtk_print_operation_set_embed_page_setup&#160;()</title>
<indexterm zone="gtk-print-operation-set-embed-page-setup"><primary>gtk_print_operation_set_embed_page_setup</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_set_embed_page_setup
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>,
                                <parameter><link linkend="gboolean"><type>gboolean</type></link> embed</parameter>);</programlisting>
<para>Embed page size combo box and orientation combo box into page setup page.
Selected page setup is stored as default page setup in <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link>.</para>
<refsect3 id="gtk-print-operation-set-embed-page-setup.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>embed</para></entry>
<entry role="parameter_description"><para><link linkend="TRUE:CAPS"><literal>TRUE</literal></link> to embed page setup selection in the <link linkend="GtkPrintUnixDialog"><type>GtkPrintUnixDialog</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-get-embed-page-setup" role="function">
<title>gtk_print_operation_get_embed_page_setup&#160;()</title>
<indexterm zone="gtk-print-operation-get-embed-page-setup"><primary>gtk_print_operation_get_embed_page_setup</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_print_operation_get_embed_page_setup
                               (<parameter><link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *op</parameter>);</programlisting>
<para>Gets the value of <link linkend="GtkPrintOperation--embed-page-setup"><type>“embed-page-setup”</type></link> property.</para>
<refsect3 id="gtk-print-operation-get-embed-page-setup.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>op</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-get-embed-page-setup.returns" role="returns">
<title>Returns</title>
<para> whether page setup selection combos are embedded</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-run-page-setup-dialog" role="function">
<title>gtk_print_run_page_setup_dialog&#160;()</title>
<indexterm zone="gtk-print-run-page-setup-dialog"><primary>gtk_print_run_page_setup_dialog</primary></indexterm>
<programlisting language="C"><link linkend="GtkPageSetup"><returnvalue>GtkPageSetup</returnvalue></link>&#160;*
gtk_print_run_page_setup_dialog (<parameter><link linkend="GtkWindow"><type>GtkWindow</type></link> *parent</parameter>,
                                 <parameter><link linkend="GtkPageSetup"><type>GtkPageSetup</type></link> *page_setup</parameter>,
                                 <parameter><link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link> *settings</parameter>);</programlisting>
<para>Runs a page setup dialog, letting the user modify the values from
<parameter>page_setup</parameter>
. If the user cancels the dialog, the returned <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>
is identical to the passed in <parameter>page_setup</parameter>
, otherwise it contains the 
modifications done in the dialog.</para>
<para>Note that this function may use a recursive mainloop to show the page
setup dialog. See <link linkend="gtk-print-run-page-setup-dialog-async"><function>gtk_print_run_page_setup_dialog_async()</function></link> if this is 
a problem.</para>
<refsect3 id="gtk-print-run-page-setup-dialog.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>parent</para></entry>
<entry role="parameter_description"><para>transient parent. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>page_setup</para></entry>
<entry role="parameter_description"><para>an existing <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>settings</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-run-page-setup-dialog.returns" role="returns">
<title>Returns</title>
<para>a new <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer full</acronym>]</emphasis></para>
</refsect3></refsect2>
<refsect2 id="GtkPageSetupDoneFunc" role="function">
<title>GtkPageSetupDoneFunc&#160;()</title>
<indexterm zone="GtkPageSetupDoneFunc"><primary>GtkPageSetupDoneFunc</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
<phrase role="c_punctuation">(</phrase>*GtkPageSetupDoneFunc<phrase role="c_punctuation">)</phrase> (<parameter><link linkend="GtkPageSetup"><type>GtkPageSetup</type></link> *page_setup</parameter>,
                         <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>The type of function that is passed to
<link linkend="gtk-print-run-page-setup-dialog-async"><function>gtk_print_run_page_setup_dialog_async()</function></link>.</para>
<para>This function will be called when the page setup dialog
is dismissed, and also serves as destroy notify for <parameter>data</parameter>
.</para>
<refsect3 id="GtkPageSetupDoneFunc.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>page_setup</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link> that has been</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>user data that has been passed to
<link linkend="gtk-print-run-page-setup-dialog-async"><function>gtk_print_run_page_setup_dialog_async()</function></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>closure</acronym>]</emphasis></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-run-page-setup-dialog-async" role="function">
<title>gtk_print_run_page_setup_dialog_async&#160;()</title>
<indexterm zone="gtk-print-run-page-setup-dialog-async"><primary>gtk_print_run_page_setup_dialog_async</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_run_page_setup_dialog_async (<parameter><link linkend="GtkWindow"><type>GtkWindow</type></link> *parent</parameter>,
                                       <parameter><link linkend="GtkPageSetup"><type>GtkPageSetup</type></link> *page_setup</parameter>,
                                       <parameter><link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link> *settings</parameter>,
                                       <parameter><link linkend="GtkPageSetupDoneFunc"><type>GtkPageSetupDoneFunc</type></link> done_cb</parameter>,
                                       <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>);</programlisting>
<para>Runs a page setup dialog, letting the user modify the values from <parameter>page_setup</parameter>
. </para>
<para>In contrast to <link linkend="gtk-print-run-page-setup-dialog"><function>gtk_print_run_page_setup_dialog()</function></link>, this function  returns after 
showing the page setup dialog on platforms that support this, and calls <parameter>done_cb</parameter>
 
from a signal handler for the ::response signal of the dialog.</para>
<refsect3 id="gtk-print-run-page-setup-dialog-async.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>parent</para></entry>
<entry role="parameter_description"><para>transient parent, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>page_setup</para></entry>
<entry role="parameter_description"><para>an existing <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>settings</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>done_cb</para></entry>
<entry role="parameter_description"><para>a function to call when the user saves
the modified page setup. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>scope async</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>user data to pass to <parameter>done_cb</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-preview-end-preview" role="function">
<title>gtk_print_operation_preview_end_preview&#160;()</title>
<indexterm zone="gtk-print-operation-preview-end-preview"><primary>gtk_print_operation_preview_end_preview</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_preview_end_preview
                               (<parameter><link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link> *preview</parameter>);</programlisting>
<para>Ends a preview. </para>
<para>This function must be called to finish a custom print preview.</para>
<refsect3 id="gtk-print-operation-preview-end-preview.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>preview</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-preview-is-selected" role="function">
<title>gtk_print_operation_preview_is_selected&#160;()</title>
<indexterm zone="gtk-print-operation-preview-is-selected"><primary>gtk_print_operation_preview_is_selected</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
gtk_print_operation_preview_is_selected
                               (<parameter><link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link> *preview</parameter>,
                                <parameter><link linkend="gint"><type>gint</type></link> page_nr</parameter>);</programlisting>
<para>Returns whether the given page is included in the set of pages that
have been selected for printing.</para>
<refsect3 id="gtk-print-operation-preview-is-selected.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>preview</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>page_nr</para></entry>
<entry role="parameter_description"><para>a page number</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="gtk-print-operation-preview-is-selected.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the page has been selected for printing</para>
</refsect3></refsect2>
<refsect2 id="gtk-print-operation-preview-render-page" role="function">
<title>gtk_print_operation_preview_render_page&#160;()</title>
<indexterm zone="gtk-print-operation-preview-render-page"><primary>gtk_print_operation_preview_render_page</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
gtk_print_operation_preview_render_page
                               (<parameter><link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link> *preview</parameter>,
                                <parameter><link linkend="gint"><type>gint</type></link> page_nr</parameter>);</programlisting>
<para>Renders a page to the preview, using the print context that
was passed to the <link linkend="GtkPrintOperation-preview"><type>“preview”</type></link> handler together
with <parameter>preview</parameter>
.</para>
<para>A custom iprint preview should use this function in its ::expose
handler to render the currently selected page.</para>
<para>Note that this function requires a suitable cairo context to 
be associated with the print context.</para>
<refsect3 id="gtk-print-operation-preview-render-page.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>preview</para></entry>
<entry role="parameter_description"><para>a <link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>page_nr</para></entry>
<entry role="parameter_description"><para>the page to render</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="GtkPrintOperation-struct" role="struct">
<title>struct GtkPrintOperation</title>
<indexterm zone="GtkPrintOperation-struct"><primary>GtkPrintOperation</primary></indexterm>
<programlisting language="C">struct GtkPrintOperation;</programlisting>
</refsect2>
<refsect2 id="GtkPrintOperationClass" role="struct">
<title>struct GtkPrintOperationClass</title>
<indexterm zone="GtkPrintOperationClass"><primary>GtkPrintOperationClass</primary></indexterm>
<programlisting language="C">struct GtkPrintOperationClass {
  GObjectClass parent_class;

  void     (*done)               (GtkPrintOperation *operation,
                                  GtkPrintOperationResult result);
  void     (*begin_print)        (GtkPrintOperation *operation,
                                  GtkPrintContext   *context);
  gboolean (*paginate)           (GtkPrintOperation *operation,
                                  GtkPrintContext   *context);
  void     (*request_page_setup) (GtkPrintOperation *operation,
                                  GtkPrintContext   *context,
                                  gint               page_nr,
                                  GtkPageSetup      *setup);
  void     (*draw_page)          (GtkPrintOperation *operation,
                                  GtkPrintContext   *context,
                                  gint               page_nr);
  void     (*end_print)          (GtkPrintOperation *operation,
                                  GtkPrintContext   *context);
  void     (*status_changed)     (GtkPrintOperation *operation);

  GtkWidget *(*create_custom_widget) (GtkPrintOperation *operation);
  void       (*custom_widget_apply)  (GtkPrintOperation *operation,
                                      GtkWidget         *widget);

  gboolean (*preview)        (GtkPrintOperation        *operation,
                              GtkPrintOperationPreview *preview,
                              GtkPrintContext          *context,
                              GtkWindow                *parent);

  void     (*update_custom_widget) (GtkPrintOperation *operation,
                                    GtkWidget         *widget,
                                    GtkPageSetup      *setup,
                                    GtkPrintSettings  *settings);
};
</programlisting>
<refsect3 id="GtkPrintOperationClass.members" role="struct_members">
<title>Members</title>
<informaltable role="struct_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="struct_members_name" colwidth="300px"/>
<colspec colname="struct_members_description"/>
<colspec colname="struct_members_annotations" colwidth="200px"/>
<tbody>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.done">done</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted when the print operation run has finished
doing everything required for printing.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.begin-print">begin_print</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted after the user has finished changing
print settings in the dialog, before the actual rendering starts.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.paginate">paginate</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted after the “begin-print” signal, but
before the actual rendering starts.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.request-page-setup">request_page_setup</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Emitted once for every page that is printed,
to give the application a chance to modify the page setup.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.draw-page">draw_page</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted for every page that is printed.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.end-print">end_print</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted after all pages have been rendered.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.status-changed">status_changed</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Emitted at between the various phases of the print
operation.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.create-custom-widget">create_custom_widget</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted when displaying the print dialog.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.custom-widget-apply">custom_widget_apply</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted right before “begin-print” if
you added a custom widget in the “create-custom-widget” handler.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.preview">preview</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Signal emitted when a preview is requested from the
native dialog.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
<row role="member"><entry role="struct_member_name"><para><structfield id="GtkPrintOperationClass.update-custom-widget">update_custom_widget</structfield>&#160;()</para></entry>
<entry role="struct_member_description"><para>Emitted after change of selected printer.</para></entry>
<entry role="struct_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3>
</refsect2>
<refsect2 id="GtkPrintStatus" role="enum">
<title>enum GtkPrintStatus</title>
<indexterm zone="GtkPrintStatus"><primary>GtkPrintStatus</primary></indexterm>
<para>The status gives a rough indication of the completion of a running
print operation.</para>
<refsect3 id="GtkPrintStatus.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-INITIAL:CAPS">GTK_PRINT_STATUS_INITIAL</para></entry>
<entry role="enum_member_description"><para>The printing has not started yet; this
status is set initially, and while the print dialog is shown.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-PREPARING:CAPS">GTK_PRINT_STATUS_PREPARING</para></entry>
<entry role="enum_member_description"><para>This status is set while the begin-print
signal is emitted and during pagination.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-GENERATING-DATA:CAPS">GTK_PRINT_STATUS_GENERATING_DATA</para></entry>
<entry role="enum_member_description"><para>This status is set while the
pages are being rendered.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-SENDING-DATA:CAPS">GTK_PRINT_STATUS_SENDING_DATA</para></entry>
<entry role="enum_member_description"><para>The print job is being sent off to the
printer.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-PENDING:CAPS">GTK_PRINT_STATUS_PENDING</para></entry>
<entry role="enum_member_description"><para>The print job has been sent to the printer,
but is not printed for some reason, e.g. the printer may be stopped.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-PENDING-ISSUE:CAPS">GTK_PRINT_STATUS_PENDING_ISSUE</para></entry>
<entry role="enum_member_description"><para>Some problem has occurred during
printing, e.g. a paper jam.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-PRINTING:CAPS">GTK_PRINT_STATUS_PRINTING</para></entry>
<entry role="enum_member_description"><para>The printer is processing the print job.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-FINISHED:CAPS">GTK_PRINT_STATUS_FINISHED</para></entry>
<entry role="enum_member_description"><para>The printing has been completed successfully.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-STATUS-FINISHED-ABORTED:CAPS">GTK_PRINT_STATUS_FINISHED_ABORTED</para></entry>
<entry role="enum_member_description"><para>The printing has been aborted.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GtkPrintOperationAction" role="enum">
<title>enum GtkPrintOperationAction</title>
<indexterm zone="GtkPrintOperationAction"><primary>GtkPrintOperationAction</primary></indexterm>
<para>The <parameter>action</parameter>
 parameter to <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>
determines what action the print operation should perform.</para>
<refsect3 id="GtkPrintOperationAction.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-OPERATION-ACTION-PRINT-DIALOG:CAPS">GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG</para></entry>
<entry role="enum_member_description"><para>Show the print dialog.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-OPERATION-ACTION-PRINT:CAPS">GTK_PRINT_OPERATION_ACTION_PRINT</para></entry>
<entry role="enum_member_description"><para>Start to print without showing
the print dialog, based on the current print settings.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-OPERATION-ACTION-PREVIEW:CAPS">GTK_PRINT_OPERATION_ACTION_PREVIEW</para></entry>
<entry role="enum_member_description"><para>Show the print preview.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-OPERATION-ACTION-EXPORT:CAPS">GTK_PRINT_OPERATION_ACTION_EXPORT</para></entry>
<entry role="enum_member_description"><para>Export to a file. This requires
the export-filename property to be set.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GtkPrintOperationResult" role="enum">
<title>enum GtkPrintOperationResult</title>
<indexterm zone="GtkPrintOperationResult"><primary>GtkPrintOperationResult</primary></indexterm>
<para>A value of this type is returned by <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>.</para>
<refsect3 id="GtkPrintOperationResult.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-OPERATION-RESULT-ERROR:CAPS">GTK_PRINT_OPERATION_RESULT_ERROR</para></entry>
<entry role="enum_member_description"><para>An error has occurred.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-OPERATION-RESULT-APPLY:CAPS">GTK_PRINT_OPERATION_RESULT_APPLY</para></entry>
<entry role="enum_member_description"><para>The print settings should be stored.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-OPERATION-RESULT-CANCEL:CAPS">GTK_PRINT_OPERATION_RESULT_CANCEL</para></entry>
<entry role="enum_member_description"><para>The print operation has been canceled,
the print settings should not be stored.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-OPERATION-RESULT-IN-PROGRESS:CAPS">GTK_PRINT_OPERATION_RESULT_IN_PROGRESS</para></entry>
<entry role="enum_member_description"><para>The print operation is not complete
yet. This value will only be returned when running asynchronously.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GtkPrintError" role="enum">
<title>enum GtkPrintError</title>
<indexterm zone="GtkPrintError"><primary>GtkPrintError</primary></indexterm>
<para>Error codes that identify various errors that can occur while
using the GTK+ printing support.</para>
<refsect3 id="GtkPrintError.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-ERROR-GENERAL:CAPS">GTK_PRINT_ERROR_GENERAL</para></entry>
<entry role="enum_member_description"><para>An unspecified error occurred.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-ERROR-INTERNAL-ERROR:CAPS">GTK_PRINT_ERROR_INTERNAL_ERROR</para></entry>
<entry role="enum_member_description"><para>An internal error occurred.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-ERROR-NOMEM:CAPS">GTK_PRINT_ERROR_NOMEM</para></entry>
<entry role="enum_member_description"><para>A memory allocation failed.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="GTK-PRINT-ERROR-INVALID-FILE:CAPS">GTK_PRINT_ERROR_INVALID_FILE</para></entry>
<entry role="enum_member_description"><para>An error occurred while loading a page setup
or paper size from a key file.</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GTK-PRINT-ERROR:CAPS" role="macro">
<title>GTK_PRINT_ERROR</title>
<indexterm zone="GTK-PRINT-ERROR:CAPS"><primary>GTK_PRINT_ERROR</primary></indexterm>
<programlisting language="C">#define GTK_PRINT_ERROR gtk_print_error_quark ()
</programlisting>
<para>The error domain for <link linkend="GtkPrintError"><type>GtkPrintError</type></link> errors.</para>
</refsect2>
<refsect2 id="GtkPrintOperationPreview-struct" role="struct">
<title>GtkPrintOperationPreview</title>
<indexterm zone="GtkPrintOperationPreview-struct"><primary>GtkPrintOperationPreview</primary></indexterm>
<programlisting language="C">typedef struct _GtkPrintOperationPreview GtkPrintOperationPreview;</programlisting>
</refsect2>

</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkPrintOperation--allow-async" role="property"><title>The <literal>“allow-async”</literal> property</title>
<indexterm zone="GtkPrintOperation--allow-async"><primary>GtkPrintOperation:allow-async</primary></indexterm>
<programlisting>  “allow-async”              <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>Determines whether the print operation may run asynchronously or not.</para>
<para>Some systems don't support asynchronous printing, but those that do
will return <link linkend="GTK-PRINT-OPERATION-RESULT-IN-PROGRESS:CAPS"><literal>GTK_PRINT_OPERATION_RESULT_IN_PROGRESS</literal></link> as the status, and
emit the <link linkend="GtkPrintOperation-done"><type>“done”</type></link> signal when the operation is actually

done.</para>
<para>The Windows port does not support asynchronous operation at all (this

is unlikely to change). On other platforms, all actions except for

<link linkend="GTK-PRINT-OPERATION-ACTION-EXPORT:CAPS"><literal>GTK_PRINT_OPERATION_ACTION_EXPORT</literal></link> support asynchronous operation.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkPrintOperation--current-page" role="property"><title>The <literal>“current-page”</literal> property</title>
<indexterm zone="GtkPrintOperation--current-page"><primary>GtkPrintOperation:current-page</primary></indexterm>
<programlisting>  “current-page”             <link linkend="gint"><type>gint</type></link></programlisting>
<para>The current page in the document.</para>
<para>If this is set before <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>,

the user will be able to select to print only the current page.</para>
<para>Note that this only makes sense for pre-paginated documents.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Allowed values: &gt;= -1</para>
<para>Default value: -1</para>
</refsect2>
<refsect2 id="GtkPrintOperation--custom-tab-label" role="property"><title>The <literal>“custom-tab-label”</literal> property</title>
<indexterm zone="GtkPrintOperation--custom-tab-label"><primary>GtkPrintOperation:custom-tab-label</primary></indexterm>
<programlisting>  “custom-tab-label”         <link linkend="gchar"><type>gchar</type></link>&#160;*</programlisting>
<para>Used as the label of the tab containing custom widgets.
Note that this property may be ignored on some platforms.</para>
<para>If this is <link linkend="NULL:CAPS"><literal>NULL</literal></link>, GTK+ uses a default label.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: NULL</para>
</refsect2>
<refsect2 id="GtkPrintOperation--default-page-setup" role="property"><title>The <literal>“default-page-setup”</literal> property</title>
<indexterm zone="GtkPrintOperation--default-page-setup"><primary>GtkPrintOperation:default-page-setup</primary></indexterm>
<programlisting>  “default-page-setup”       <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>&#160;*</programlisting>
<para>The <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link> used by default.</para>
<para>This page setup will be used by <link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>,
but it can be overridden on a per-page basis by connecting
to the <link linkend="GtkPrintOperation-request-page-setup"><type>“request-page-setup”</type></link> signal.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
</refsect2>
<refsect2 id="GtkPrintOperation--embed-page-setup" role="property"><title>The <literal>“embed-page-setup”</literal> property</title>
<indexterm zone="GtkPrintOperation--embed-page-setup"><primary>GtkPrintOperation:embed-page-setup</primary></indexterm>
<programlisting>  “embed-page-setup”         <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>If <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, page size combo box and orientation combo box are embedded into page setup page.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkPrintOperation--export-filename" role="property"><title>The <literal>“export-filename”</literal> property</title>
<indexterm zone="GtkPrintOperation--export-filename"><primary>GtkPrintOperation:export-filename</primary></indexterm>
<programlisting>  “export-filename”          <link linkend="gchar"><type>gchar</type></link>&#160;*</programlisting>
<para>The name of a file to generate instead of showing the print dialog.

Currently, PDF is the only supported format.</para>
<para>The intended use of this property is for implementing

“Export to PDF” actions.</para>
<para>“Print to PDF” support is independent of this and is done
by letting the user pick the “Print to PDF” item from the

list of printers in the print dialog.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: NULL</para>
</refsect2>
<refsect2 id="GtkPrintOperation--has-selection" role="property"><title>The <literal>“has-selection”</literal> property</title>
<indexterm zone="GtkPrintOperation--has-selection"><primary>GtkPrintOperation:has-selection</primary></indexterm>
<programlisting>  “has-selection”            <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>Determines whether there is a selection in your application.
This can allow your application to print the selection.
This is typically used to make a "Selection" button sensitive.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkPrintOperation--job-name" role="property"><title>The <literal>“job-name”</literal> property</title>
<indexterm zone="GtkPrintOperation--job-name"><primary>GtkPrintOperation:job-name</primary></indexterm>
<programlisting>  “job-name”                 <link linkend="gchar"><type>gchar</type></link>&#160;*</programlisting>
<para>A string used to identify the job (e.g. in monitoring

applications like eggcups). </para>
<para>If you don't set a job name, GTK+ picks a default one

by numbering successive print jobs.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: ""</para>
</refsect2>
<refsect2 id="GtkPrintOperation--n-pages" role="property"><title>The <literal>“n-pages”</literal> property</title>
<indexterm zone="GtkPrintOperation--n-pages"><primary>GtkPrintOperation:n-pages</primary></indexterm>
<programlisting>  “n-pages”                  <link linkend="gint"><type>gint</type></link></programlisting>
<para>The number of pages in the document. </para>
<para>This must be set to a positive number
before the rendering starts. It may be set in a

<link linkend="GtkPrintOperation-begin-print"><type>“begin-print”</type></link> signal hander.</para>
<para>Note that the page numbers passed to the

<link linkend="GtkPrintOperation-request-page-setup"><type>“request-page-setup”</type></link> and

<link linkend="GtkPrintOperation-draw-page"><type>“draw-page”</type></link> signals are 0-based, i.e. if

the user chooses to print all pages, the last ::draw-page signal

will be for page <parameter>n_pages</parameter>
 - 1.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Allowed values: &gt;= -1</para>
<para>Default value: -1</para>
</refsect2>
<refsect2 id="GtkPrintOperation--n-pages-to-print" role="property"><title>The <literal>“n-pages-to-print”</literal> property</title>
<indexterm zone="GtkPrintOperation--n-pages-to-print"><primary>GtkPrintOperation:n-pages-to-print</primary></indexterm>
<programlisting>  “n-pages-to-print”         <link linkend="gint"><type>gint</type></link></programlisting>
<para>The number of pages that will be printed.</para>
<para>Note that this value is set during print preparation phase
(<link linkend="GTK-PRINT-STATUS-PREPARING:CAPS"><literal>GTK_PRINT_STATUS_PREPARING</literal></link>), so this value should never be
get before the data generation phase (<link linkend="GTK-PRINT-STATUS-GENERATING-DATA:CAPS"><literal>GTK_PRINT_STATUS_GENERATING_DATA</literal></link>).
You can connect to the <link linkend="GtkPrintOperation-status-changed"><type>“status-changed”</type></link> signal
and call <link linkend="gtk-print-operation-get-n-pages-to-print"><function>gtk_print_operation_get_n_pages_to_print()</function></link> when
print status is <link linkend="GTK-PRINT-STATUS-GENERATING-DATA:CAPS"><literal>GTK_PRINT_STATUS_GENERATING_DATA</literal></link>.
This is typically used to track the progress of print operation.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read</para>
<para>Allowed values: &gt;= -1</para>
<para>Default value: -1</para>
</refsect2>
<refsect2 id="GtkPrintOperation--print-settings" role="property"><title>The <literal>“print-settings”</literal> property</title>
<indexterm zone="GtkPrintOperation--print-settings"><primary>GtkPrintOperation:print-settings</primary></indexterm>
<programlisting>  “print-settings”           <link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link>&#160;*</programlisting>
<para>The <link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link> used for initializing the dialog.</para>
<para>Setting this property is typically used to re-establish

print settings from a previous print operation, see

<link linkend="gtk-print-operation-run"><function>gtk_print_operation_run()</function></link>.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
</refsect2>
<refsect2 id="GtkPrintOperation--show-progress" role="property"><title>The <literal>“show-progress”</literal> property</title>
<indexterm zone="GtkPrintOperation--show-progress"><primary>GtkPrintOperation:show-progress</primary></indexterm>
<programlisting>  “show-progress”            <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>Determines whether to show a progress dialog during the

print operation.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkPrintOperation--status" role="property"><title>The <literal>“status”</literal> property</title>
<indexterm zone="GtkPrintOperation--status"><primary>GtkPrintOperation:status</primary></indexterm>
<programlisting>  “status”                   <link linkend="GtkPrintStatus"><type>GtkPrintStatus</type></link></programlisting>
<para>The status of the print operation.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read</para>
<para>Default value: GTK_PRINT_STATUS_INITIAL</para>
</refsect2>
<refsect2 id="GtkPrintOperation--status-string" role="property"><title>The <literal>“status-string”</literal> property</title>
<indexterm zone="GtkPrintOperation--status-string"><primary>GtkPrintOperation:status-string</primary></indexterm>
<programlisting>  “status-string”            <link linkend="gchar"><type>gchar</type></link>&#160;*</programlisting>
<para>A string representation of the status of the print operation.

The string is translated and suitable for displaying the print

status e.g. in a <link linkend="GtkStatusbar"><type>GtkStatusbar</type></link>.</para>
<para>See the <link linkend="GtkPrintOperation--status"><type>“status”</type></link> property for a status value that

is suitable for programmatic use.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read</para>
<para>Default value: ""</para>
</refsect2>
<refsect2 id="GtkPrintOperation--support-selection" role="property"><title>The <literal>“support-selection”</literal> property</title>
<indexterm zone="GtkPrintOperation--support-selection"><primary>GtkPrintOperation:support-selection</primary></indexterm>
<programlisting>  “support-selection”        <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>If <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the print operation will support print of selection.
This allows the print dialog to show a "Selection" button.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkPrintOperation--track-print-status" role="property"><title>The <literal>“track-print-status”</literal> property</title>
<indexterm zone="GtkPrintOperation--track-print-status"><primary>GtkPrintOperation:track-print-status</primary></indexterm>
<programlisting>  “track-print-status”       <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>If <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the print operation will try to continue report on

the status of the print job in the printer queues and printer.

This can allow your application to show things like “out of paper”

issues, and when the print job actually reaches the printer.

However, this is often implemented using polling, and should

not be enabled unless needed.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>
<refsect2 id="GtkPrintOperation--unit" role="property"><title>The <literal>“unit”</literal> property</title>
<indexterm zone="GtkPrintOperation--unit"><primary>GtkPrintOperation:unit</primary></indexterm>
<programlisting>  “unit”                     <link linkend="GtkUnit"><type>GtkUnit</type></link></programlisting>
<para>The transformation for the cairo context obtained from
<link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> is set up in such a way that distances

are measured in units of <parameter>unit</parameter>
.</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: GTK_UNIT_NONE</para>
</refsect2>
<refsect2 id="GtkPrintOperation--use-full-page" role="property"><title>The <literal>“use-full-page”</literal> property</title>
<indexterm zone="GtkPrintOperation--use-full-page"><primary>GtkPrintOperation:use-full-page</primary></indexterm>
<programlisting>  “use-full-page”            <link linkend="gboolean"><type>gboolean</type></link></programlisting>
<para>If <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, the transformation for the cairo context obtained

from <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> puts the origin at the top left corner

of the page (which may not be the top left corner of the sheet,

depending on page orientation and the number of pages per sheet).

Otherwise, the origin is at the top left corner of the imageable

area (i.e. inside the margins).</para>
<para>Owner: GtkPrintOperation</para>
<para>Flags: Read / Write</para>
<para>Default value: FALSE</para>
</refsect2>

</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.signal-details" role="signals">
<title role="signals.title">Signal Details</title>
<refsect2 id="GtkPrintOperation-begin-print" role="signal"><title>The <literal>“begin-print”</literal> signal</title>
<indexterm zone="GtkPrintOperation-begin-print"><primary>GtkPrintOperation::begin-print</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>   *context,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>Emitted after the user has finished changing print settings
in the dialog, before the actual rendering starts. </para>
<para>A typical use for ::begin-print is to use the parameters from the
<link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> and paginate the document accordingly, and then
set the number of pages with <link linkend="gtk-print-operation-set-n-pages"><function>gtk_print_operation_set_n_pages()</function></link>.</para>
<refsect3 id="GtkPrintOperation-begin-print.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>context</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> for the current operation</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-create-custom-widget" role="signal"><title>The <literal>“create-custom-widget”</literal> signal</title>
<indexterm zone="GtkPrintOperation-create-custom-widget"><primary>GtkPrintOperation::create-custom-widget</primary></indexterm>
<programlisting language="C"><link linkend="GObject"><returnvalue>GObject</returnvalue></link>*
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>Emitted when displaying the print dialog. If you return a
widget in a handler for this signal it will be added to a custom
tab in the print dialog. You typically return a container widget
with multiple widgets in it.</para>
<para>The print dialog owns the returned widget, and its lifetime is not

controlled by the application. However, the widget is guaranteed

to stay around until the <link linkend="GtkPrintOperation-custom-widget-apply"><type>“custom-widget-apply”</type></link>

signal is emitted on the operation. Then you can read out any

information you need from the widgets.</para>
<refsect3 id="GtkPrintOperation-create-custom-widget.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GtkPrintOperation-create-custom-widget.returns" role="returns">
<title>Returns</title>
<para>A custom widget that gets embedded in
the print dialog, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para>
<para><emphasis role="annotation">[<acronym>transfer none</acronym>]</emphasis></para>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-custom-widget-apply" role="signal"><title>The <literal>“custom-widget-apply”</literal> signal</title>
<indexterm zone="GtkPrintOperation-custom-widget-apply"><primary>GtkPrintOperation::custom-widget-apply</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="GtkWidget"><type>GtkWidget</type></link>         *widget,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>Emitted right before <link linkend="GtkPrintOperation-begin-print"><type>“begin-print”</type></link> if you added
a custom widget in the <link linkend="GtkPrintOperation-create-custom-widget"><type>“create-custom-widget”</type></link> handler.

When you get this signal you should read the information from the

custom widgets, as the widgets are not guaraneed to be around at a

later time.</para>
<refsect3 id="GtkPrintOperation-custom-widget-apply.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>widget</para></entry>
<entry role="parameter_description"><para>the custom widget added in create-custom-widget</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-done" role="signal"><title>The <literal>“done”</literal> signal</title>
<indexterm zone="GtkPrintOperation-done"><primary>GtkPrintOperation::done</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link>      *operation,
               <link linkend="GtkPrintOperationResult"><type>GtkPrintOperationResult</type></link> result,
               <link linkend="gpointer"><type>gpointer</type></link>                user_data)</programlisting>
<para>Emitted when the print operation run has finished doing
everything required for printing. </para>
<para><parameter>result</parameter>
 gives you information about what happened during the run.

If <parameter>result</parameter>
 is <link linkend="GTK-PRINT-OPERATION-RESULT-ERROR:CAPS"><literal>GTK_PRINT_OPERATION_RESULT_ERROR</literal></link> then you can call
<link linkend="gtk-print-operation-get-error"><function>gtk_print_operation_get_error()</function></link> for more information.</para>
<para>If you enabled print status tracking then

<link linkend="gtk-print-operation-is-finished"><function>gtk_print_operation_is_finished()</function></link> may still return <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>

after <link linkend="GtkPrintOperation-done"><type>“done”</type></link> was emitted.</para>
<refsect3 id="GtkPrintOperation-done.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>result</para></entry>
<entry role="parameter_description"><para>the result of the print operation</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-draw-page" role="signal"><title>The <literal>“draw-page”</literal> signal</title>
<indexterm zone="GtkPrintOperation-draw-page"><primary>GtkPrintOperation::draw-page</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>   *context,
               <link linkend="gint"><type>gint</type></link>               page_nr,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>Emitted for every page that is printed. The signal handler
must render the <parameter>page_nr</parameter>
's page onto the cairo context obtained
from <parameter>context</parameter>
 using <link linkend="gtk-print-context-get-cairo-context"><function>gtk_print_context_get_cairo_context()</function></link>.</para>
<informalexample><programlisting role="example"><![CDATA[
static void
draw_page (GtkPrintOperation *operation,
           GtkPrintContext   *context,
           gint               page_nr,
           gpointer           user_data)
{
  cairo_t *cr;
  PangoLayout *layout;
  gdouble width, text_height;
  gint layout_height;
  PangoFontDescription *desc;

  cr = gtk_print_context_get_cairo_context (context);
  width = gtk_print_context_get_width (context);

  cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);

  cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
  cairo_fill (cr);

  layout = gtk_print_context_create_pango_layout (context);

  desc = pango_font_description_from_string ("sans 14");
  pango_layout_set_font_description (layout, desc);
  pango_font_description_free (desc);

  pango_layout_set_text (layout, "some text", -1);
  pango_layout_set_width (layout, width * PANGO_SCALE);
  pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);

  pango_layout_get_size (layout, NULL, &layout_height);
  text_height = (gdouble)layout_height / PANGO_SCALE;

  cairo_move_to (cr, width / 2,  (HEADER_HEIGHT - text_height) / 2);
  pango_cairo_show_layout (cr, layout);

  g_object_unref (layout);
}
]]></programlisting></informalexample>
<para></para>
<para>Use <link linkend="gtk-print-operation-set-use-full-page"><function>gtk_print_operation_set_use_full_page()</function></link> and

<link linkend="gtk-print-operation-set-unit"><function>gtk_print_operation_set_unit()</function></link> before starting the print operation
to set up the transformation of the cairo context according to your
needs.</para>
<refsect3 id="GtkPrintOperation-draw-page.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>context</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> for the current operation</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>page_nr</para></entry>
<entry role="parameter_description"><para>the number of the currently printed page (0-based)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-end-print" role="signal"><title>The <literal>“end-print”</literal> signal</title>
<indexterm zone="GtkPrintOperation-end-print"><primary>GtkPrintOperation::end-print</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>   *context,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>Emitted after all pages have been rendered.

A handler for this signal can clean up any resources that have
been allocated in the <link linkend="GtkPrintOperation-begin-print"><type>“begin-print”</type></link> handler.</para>
<refsect3 id="GtkPrintOperation-end-print.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>context</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> for the current operation</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-paginate" role="signal"><title>The <literal>“paginate”</literal> signal</title>
<indexterm zone="GtkPrintOperation-paginate"><primary>GtkPrintOperation::paginate</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>   *context,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>Emitted after the <link linkend="GtkPrintOperation-begin-print"><type>“begin-print”</type></link> signal, but before

the actual rendering starts. It keeps getting emitted until a connected

signal handler returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<para>The ::paginate signal is intended to be used for paginating a document
in small chunks, to avoid blocking the user interface for a long
time. The signal handler should update the number of pages using
<link linkend="gtk-print-operation-set-n-pages"><function>gtk_print_operation_set_n_pages()</function></link>, and return <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the document
has been completely paginated.</para>
<para>If you don't need to do pagination in chunks, you can simply do
it all in the ::begin-print handler, and set the number of pages
from there.</para>
<refsect3 id="GtkPrintOperation-paginate.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>context</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> for the current operation</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GtkPrintOperation-paginate.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if pagination is complete</para>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-preview" role="signal"><title>The <literal>“preview”</literal> signal</title>
<indexterm zone="GtkPrintOperation-preview"><primary>GtkPrintOperation::preview</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link>        *operation,
               <link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link> *preview,
               <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>          *context,
               <link linkend="GtkWindow"><type>GtkWindow</type></link>                *parent,
               <link linkend="gpointer"><type>gpointer</type></link>                  user_data)</programlisting>
<para>Gets emitted when a preview is requested from the native dialog.</para>
<para>The default handler for this signal uses an external viewer

application to preview.</para>
<para>To implement a custom print preview, an application must return
<link linkend="TRUE:CAPS"><literal>TRUE</literal></link> from its handler for this signal. In order to use the
provided <parameter>context</parameter>
 for the preview implementation, it must be
given a suitable cairo context with <link linkend="gtk-print-context-set-cairo-context"><function>gtk_print_context_set_cairo_context()</function></link>.</para>
<para>The custom preview implementation can use

<link linkend="gtk-print-operation-preview-is-selected"><function>gtk_print_operation_preview_is_selected()</function></link> and

<link linkend="gtk-print-operation-preview-render-page"><function>gtk_print_operation_preview_render_page()</function></link> to find pages which
are selected for print and render them. The preview must be
finished by calling <link linkend="gtk-print-operation-preview-end-preview"><function>gtk_print_operation_preview_end_preview()</function></link>
(typically in response to the user clicking a close button).</para>
<refsect3 id="GtkPrintOperation-preview.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>preview</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link> for the current operation</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>context</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> that will be used</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>parent</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkWindow"><type>GtkWindow</type></link> to use as window parent, or <link linkend="NULL:CAPS"><literal>NULL</literal></link>. </para></entry>
<entry role="parameter_annotations"><emphasis role="annotation">[<acronym>allow-none</acronym>]</emphasis></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="GtkPrintOperation-preview.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the listener wants to take over control of the preview</para>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-request-page-setup" role="signal"><title>The <literal>“request-page-setup”</literal> signal</title>
<indexterm zone="GtkPrintOperation-request-page-setup"><primary>GtkPrintOperation::request-page-setup</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>   *context,
               <link linkend="gint"><type>gint</type></link>               page_nr,
               <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>      *setup,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>Emitted once for every page that is printed, to give
the application a chance to modify the page setup. Any changes

done to <parameter>setup</parameter>
 will be in force only for printing this page.</para>
<refsect3 id="GtkPrintOperation-request-page-setup.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>context</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link> for the current operation</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>page_nr</para></entry>
<entry role="parameter_description"><para>the number of the currently printed page (0-based)</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>setup</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link> </para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-status-changed" role="signal"><title>The <literal>“status-changed”</literal> signal</title>
<indexterm zone="GtkPrintOperation-status-changed"><primary>GtkPrintOperation::status-changed</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>Emitted at between the various phases of the print operation.
See <link linkend="GtkPrintStatus"><type>GtkPrintStatus</type></link> for the phases that are being discriminated.
Use <link linkend="gtk-print-operation-get-status"><function>gtk_print_operation_get_status()</function></link> to find out the current
status.</para>
<refsect3 id="GtkPrintOperation-status-changed.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperation-update-custom-widget" role="signal"><title>The <literal>“update-custom-widget”</literal> signal</title>
<indexterm zone="GtkPrintOperation-update-custom-widget"><primary>GtkPrintOperation::update-custom-widget</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> *operation,
               <link linkend="GtkWidget"><type>GtkWidget</type></link>         *widget,
               <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>      *setup,
               <link linkend="GtkPrintSettings"><type>GtkPrintSettings</type></link>  *settings,
               <link linkend="gpointer"><type>gpointer</type></link>           user_data)</programlisting>
<para>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.</para>
<refsect3 id="GtkPrintOperation-update-custom-widget.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>operation</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPrintOperation"><type>GtkPrintOperation</type></link> on which the signal was emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>widget</para></entry>
<entry role="parameter_description"><para>the custom widget added in create-custom-widget</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>setup</para></entry>
<entry role="parameter_description"><para>actual page setup</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>settings</para></entry>
<entry role="parameter_description"><para>actual print settings</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperationPreview-got-page-size" role="signal"><title>The <literal>“got-page-size”</literal> signal</title>
<indexterm zone="GtkPrintOperationPreview-got-page-size"><primary>GtkPrintOperationPreview::got-page-size</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link> *preview,
               <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>          *context,
               <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link>             *page_setup,
               <link linkend="gpointer"><type>gpointer</type></link>                  user_data)</programlisting>
<para>The ::got-page-size signal is emitted once for each page
that gets rendered to the preview. </para>
<para>A handler for this signal should update the <parameter>context</parameter>

according to <parameter>page_setup</parameter>
 and set up a suitable cairo
context, using <link linkend="gtk-print-context-set-cairo-context"><function>gtk_print_context_set_cairo_context()</function></link>.</para>
<refsect3 id="GtkPrintOperationPreview-got-page-size.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>preview</para></entry>
<entry role="parameter_description"><para>the object on which the signal is emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>context</para></entry>
<entry role="parameter_description"><para>the current <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>page_setup</para></entry>
<entry role="parameter_description"><para>the <link linkend="GtkPageSetup"><type>GtkPageSetup</type></link> for the current page</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2><refsect2 id="GtkPrintOperationPreview-ready" role="signal"><title>The <literal>“ready”</literal> signal</title>
<indexterm zone="GtkPrintOperationPreview-ready"><primary>GtkPrintOperationPreview::ready</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
user_function (<link linkend="GtkPrintOperationPreview"><type>GtkPrintOperationPreview</type></link> *preview,
               <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>          *context,
               <link linkend="gpointer"><type>gpointer</type></link>                  user_data)</programlisting>
<para>The ::ready signal gets emitted once per preview operation,
before the first page is rendered.</para>
<para>A handler for this signal can be used for setup tasks.</para>
<refsect3 id="GtkPrintOperationPreview-ready.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>preview</para></entry>
<entry role="parameter_description"><para>the object on which the signal is emitted</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>context</para></entry>
<entry role="parameter_description"><para>the current <link linkend="GtkPrintContext"><type>GtkPrintContext</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><simpara>user_data</simpara></entry>
<entry role="parameter_description"><simpara>user data set when the signal handler was connected.</simpara></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para>Flags: <link linkend="G-SIGNAL-RUN-LAST:CAPS">Run Last</link></para>
</refsect2>
</refsect1>
<refsect1 id="gtk4-High-level-Printing-API.see-also">
<title>See Also</title>
<para><link linkend="GtkPrintContext"><type>GtkPrintContext</type></link>, <link linkend="GtkPrintUnixDialog"><type>GtkPrintUnixDialog</type></link></para>

</refsect1>

</refentry>
