## GtkPrintJob

GtkPrintJob — Represents a print job

## Functions

void | (*GtkPrintJobCompleteFunc) ()
GtkPrintJob * | gtk_print_job_new ()
GtkPrintSettings * | gtk_print_job_get_settings ()
GtkPrinter * | gtk_print_job_get_printer ()
const gchar * | gtk_print_job_get_title ()
GtkPrintStatus | gtk_print_job_get_status ()
gboolean | gtk_print_job_set_source_fd ()
gboolean | gtk_print_job_set_source_file ()
cairo_surface_t * | gtk_print_job_get_surface ()
void | gtk_print_job_send ()
void | gtk_print_job_set_track_print_status ()
gboolean | gtk_print_job_get_track_print_status ()
GtkPrintPages | gtk_print_job_get_pages ()
void | gtk_print_job_set_pages ()
GtkPageRange * | gtk_print_job_get_page_ranges ()
void | gtk_print_job_set_page_ranges ()
GtkPageSet | gtk_print_job_get_page_set ()
void | gtk_print_job_set_page_set ()
gint | gtk_print_job_get_num_copies ()
void | gtk_print_job_set_num_copies ()
gdouble | gtk_print_job_get_scale ()
void | gtk_print_job_set_scale ()
guint | gtk_print_job_get_n_up ()
void | gtk_print_job_set_n_up ()
GtkNumberUpLayout | gtk_print_job_get_n_up_layout ()
void | gtk_print_job_set_n_up_layout ()
gboolean | gtk_print_job_get_rotate ()
void | gtk_print_job_set_rotate ()
gboolean | gtk_print_job_get_collate ()
void | gtk_print_job_set_collate ()
gboolean | gtk_print_job_get_reverse ()
void | gtk_print_job_set_reverse ()

## Properties

GtkPageSetup * | page-setup | Read / Write / Construct Only
GtkPrinter * | printer | Read / Write / Construct Only
GtkPrintSettings * | settings | Read / Write / Construct Only
gchar * | title | Read / Write / Construct Only
gboolean | track-print-status | Read / Write

## Signals

void | status-changed | Run Last

## Types and Values

struct | GtkPrintJob

## Object Hierarchy

        GObject
        ╰── GtkPrintJob

## Includes

    #include <gtk/gtkunixprint.h>

## Description

A GtkPrintJob object represents a job that is sent to a printer. You only need to deal directly with print jobs if you use the non-portable GtkPrintUnixDialog API.

Use `gtk_print_job_get_surface()` to obtain the cairo surface onto which the pages must be drawn. Use `gtk_print_job_send()` to send the finished job to the printer. If you don’t use cairo GtkPrintJob also supports printing of manually generated postscript, via `gtk_print_job_set_source_file()`.

## Functions

### GtkPrintJobCompleteFunc ()

    void
    (*GtkPrintJobCompleteFunc) (GtkPrintJob *print_job,
                                gpointer user_data,
                                const GError *error);

The type of callback that is passed to `gtk_print_job_send()`. It is called when the print job has been completely sent.

#### Parameters

print_job | the GtkPrintJob |
user_data | user data that has been passed to `gtk_print_job_send()` |
error | a GError that contains error information if the sending of the print job failed, otherwise `NULL` |

### gtk_print_job_new ()

    GtkPrintJob *
    gtk_print_job_new (const gchar *title,
                       GtkPrinter *printer,
                       GtkPrintSettings *settings,
                       GtkPageSetup *page_setup);

Creates a new GtkPrintJob.

#### Parameters

title | the job title |
printer | a GtkPrinter |
settings | a GtkPrintSettings |
page_setup | a GtkPageSetup |

#### Returns

a new GtkPrintJob

Since: 2.10

### gtk_print_job_get_settings ()

    GtkPrintSettings *
    gtk_print_job_get_settings (GtkPrintJob *job);

Gets the GtkPrintSettings of the print job.

#### Parameters

job | a GtkPrintJob |

#### Returns

the settings of `job` .

[transfer none]

Since: 2.10

### gtk_print_job_get_printer ()

    GtkPrinter *
    gtk_print_job_get_printer (GtkPrintJob *job);

Gets the GtkPrinter of the print job.

#### Parameters

job | a GtkPrintJob |

#### Returns

the printer of `job` .

[transfer none]

Since: 2.10

### gtk_print_job_get_title ()

    const gchar *
    gtk_print_job_get_title (GtkPrintJob *job);

Gets the job title.

#### Parameters

job | a GtkPrintJob |

#### Returns

the title of `job`

Since: 2.10

### gtk_print_job_get_status ()

    GtkPrintStatus
    gtk_print_job_get_status (GtkPrintJob *job);

Gets the status of the print job.

#### Parameters

job | a GtkPrintJob |

#### Returns

the status of `job`

Since: 2.10

### gtk_print_job_set_source_fd ()

    gboolean
    gtk_print_job_set_source_fd (GtkPrintJob *job,
                                 int fd,
                                 GError **error);

Make the GtkPrintJob send an existing document to the printing system. The file can be in any format understood by the platforms printing system (typically PostScript, but on many platforms PDF may work too). See `gtk_printer_accepts_pdf()` and `gtk_printer_accepts_ps()`.

This is similar to `gtk_print_job_set_source_file()`, but takes expects an open file descriptor for the file, instead of a filename.

#### Parameters

job | a GtkPrintJob |
fd | a file descriptor |
error | return location for errors |

#### Returns

`FALSE` if an error occurred

Since: 3.22

### gtk_print_job_set_source_file ()

    gboolean
    gtk_print_job_set_source_file (GtkPrintJob *job,
                                   const gchar *filename,
                                   GError **error);

Make the GtkPrintJob send an existing document to the printing system. The file can be in any format understood by the platforms printing system (typically PostScript, but on many platforms PDF may work too). See `gtk_printer_accepts_pdf()` and `gtk_printer_accepts_ps()`.

#### Parameters

job | a GtkPrintJob |
filename | the file to be printed. | [type filename]
error | return location for errors |

#### Returns

`FALSE` if an error occurred

Since: 2.10

### gtk_print_job_get_surface ()

    cairo_surface_t *
    gtk_print_job_get_surface (GtkPrintJob *job,
                               GError **error);

Gets a cairo surface onto which the pages of the print job should be rendered.

#### Parameters

job | a GtkPrintJob |
error | return location for errors, or `NULL`. | [allow-none]

#### Returns

the cairo surface of `job` .

[transfer none]

Since: 2.10

### gtk_print_job_send ()

    void
    gtk_print_job_send (GtkPrintJob *job,
                        GtkPrintJobCompleteFunc callback,
                        gpointer user_data,
                        GDestroyNotify dnotify);

Sends the print job off to the printer.

#### Parameters

job | a GtkPrintJob |
callback | function to call when the job completes or an error occurs |
user_data | user data that gets passed to `callback` |
dnotify | destroy notify for `user_data` |

Since: 2.10

### gtk_print_job_set_track_print_status ()

    void
    gtk_print_job_set_track_print_status (GtkPrintJob *job,
                                          gboolean track_status);

If track_status is `TRUE`, the print job 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.

This function is often implemented using some form of polling, so it should not be enabled unless needed.

#### Parameters

job | a GtkPrintJob |
track_status | `TRUE` to track status after printing |

Since: 2.10

### gtk_print_job_get_track_print_status ()

    gboolean
    gtk_print_job_get_track_print_status (GtkPrintJob *job);

Returns wheter jobs will be tracked after printing. For details, see `gtk_print_job_set_track_print_status()`.

#### Parameters

job | a GtkPrintJob |

#### Returns

`TRUE` if print job status will be reported after printing

Since: 2.10

### gtk_print_job_get_pages ()

    GtkPrintPages
    gtk_print_job_get_pages (GtkPrintJob *job);

Gets the GtkPrintPages setting for this job.

#### Parameters

job | a GtkPrintJob |

#### Returns

the GtkPrintPages setting

Since: 3.0

### gtk_print_job_set_pages ()

    void
    gtk_print_job_set_pages (GtkPrintJob *job,
                             GtkPrintPages pages);

Sets the GtkPrintPages setting for this job.

#### Parameters

job | a GtkPrintJob |
pages | the GtkPrintPages setting |

Since: 3.0

### gtk_print_job_get_page_ranges ()

    GtkPageRange *
    gtk_print_job_get_page_ranges (GtkPrintJob *job,
                                   gint *n_ranges);

Gets the page ranges for this job.

#### Parameters

job | a GtkPrintJob |
n_ranges | return location for the number of ranges. | [out]

#### Returns

a pointer to an array of GtkPageRange structs.

[array length=n_ranges][transfer none]

Since: 3.0

### gtk_print_job_set_page_ranges ()

    void
    gtk_print_job_set_page_ranges (GtkPrintJob *job,
                                   GtkPageRange *ranges,
                                   gint n_ranges);

Sets the page ranges for this job.

#### Parameters

job | a GtkPrintJob |
ranges | pointer to an array of GtkPageRange structs. | [array length=n_ranges][transfer full]
n_ranges | the length of the `ranges` array |

Since: 3.0

### gtk_print_job_get_page_set ()

    GtkPageSet
    gtk_print_job_get_page_set (GtkPrintJob *job);

Gets the GtkPageSet setting for this job.

#### Parameters

job | a GtkPrintJob |

#### Returns

the GtkPageSet setting

Since: 3.0

### gtk_print_job_set_page_set ()

    void
    gtk_print_job_set_page_set (GtkPrintJob *job,
                                GtkPageSet page_set);

Sets the GtkPageSet setting for this job.

#### Parameters

job | a GtkPrintJob |
page_set | a GtkPageSet setting |

Since: 3.0

### gtk_print_job_get_num_copies ()

    gint
    gtk_print_job_get_num_copies (GtkPrintJob *job);

Gets the number of copies of this job.

#### Parameters

job | a GtkPrintJob |

#### Returns

the number of copies

Since: 3.0

### gtk_print_job_set_num_copies ()

    void
    gtk_print_job_set_num_copies (GtkPrintJob *job,
                                  gint num_copies);

Sets the number of copies for this job.

#### Parameters

job | a GtkPrintJob |
num_copies | the number of copies |

Since: 3.0

### gtk_print_job_get_scale ()

    gdouble
    gtk_print_job_get_scale (GtkPrintJob *job);

Gets the scale for this job (where 1.0 means unscaled).

#### Parameters

job | a GtkPrintJob |

#### Returns

the scale

Since: 3.0

### gtk_print_job_set_scale ()

    void
    gtk_print_job_set_scale (GtkPrintJob *job,
                             gdouble scale);

Sets the scale for this job (where 1.0 means unscaled).

#### Parameters

job | a GtkPrintJob |
scale | the scale |

Since: 3.0

### gtk_print_job_get_n_up ()

    guint
    gtk_print_job_get_n_up (GtkPrintJob *job);

Gets the n-up setting for this job.

#### Parameters

job | a GtkPrintJob |

#### Returns

the n-up setting

Since: 3.0

### gtk_print_job_set_n_up ()

    void
    gtk_print_job_set_n_up (GtkPrintJob *job,
                            guint n_up);

Sets the n-up setting for this job.

#### Parameters

job | a GtkPrintJob |
n_up | the n-up value |

Since: 3.0

### gtk_print_job_get_n_up_layout ()

    GtkNumberUpLayout
    gtk_print_job_get_n_up_layout (GtkPrintJob *job);

Gets the n-up layout setting for this job.

#### Parameters

job | a GtkPrintJob |

#### Returns

the n-up layout

Since: 3.0

### gtk_print_job_set_n_up_layout ()

    void
    gtk_print_job_set_n_up_layout (GtkPrintJob *job,
                                   GtkNumberUpLayout layout);

Sets the n-up layout setting for this job.

#### Parameters

job | a GtkPrintJob |
layout | the n-up layout setting |

Since: 3.0

### gtk_print_job_get_rotate ()

    gboolean
    gtk_print_job_get_rotate (GtkPrintJob *job);

Gets whether the job is printed rotated.

#### Parameters

job | a GtkPrintJob |

#### Returns

whether the job is printed rotated

Since: 3.0

### gtk_print_job_set_rotate ()

    void
    gtk_print_job_set_rotate (GtkPrintJob *job,
                              gboolean rotate);

Sets whether this job is printed rotated.

#### Parameters

job | a GtkPrintJob |
rotate | whether to print rotated |

Since: 3.0

### gtk_print_job_get_collate ()

    gboolean
    gtk_print_job_get_collate (GtkPrintJob *job);

Gets whether this job is printed collated.

#### Parameters

job | a GtkPrintJob |

#### Returns

whether the job is printed collated

Since: 3.0

### gtk_print_job_set_collate ()

    void
    gtk_print_job_set_collate (GtkPrintJob *job,
                               gboolean collate);

Sets whether this job is printed collated.

#### Parameters

job | a GtkPrintJob |
collate | whether the job is printed collated |

Since: 3.0

### gtk_print_job_get_reverse ()

    gboolean
    gtk_print_job_get_reverse (GtkPrintJob *job);

Gets whether this job is printed reversed.

#### Parameters

job | a GtkPrintJob |

#### Returns

whether the job is printed reversed.

Since: 3.0

### gtk_print_job_set_reverse ()

    void
    gtk_print_job_set_reverse (GtkPrintJob *job,
                               gboolean reverse);

Sets whether this job is printed reversed.

#### Parameters

job | a GtkPrintJob |
reverse | whether the job is printed reversed |

Since: 3.0

## Types and Values

### struct GtkPrintJob

    struct GtkPrintJob;

## Property Details

### The `“page-setup”` property

      “page-setup”               GtkPageSetup *

Page Setup.

Flags: Read / Write / Construct Only

### The `“printer”` property

      “printer”                  GtkPrinter *

Printer to print the job to.

Flags: Read / Write / Construct Only

### The `“settings”` property

      “settings”                 GtkPrintSettings *

Printer settings.

Flags: Read / Write / Construct Only

### The `“title”` property

      “title”                    gchar *

Title of the print job.

Flags: Read / Write / Construct Only

Default value: NULL

### The `“track-print-status”` property

      “track-print-status”       gboolean

TRUE if the print job will continue to emit status-changed signals after the print data has been sent to the printer or print server.

Flags: Read / Write

Default value: FALSE

## Signal Details

### The `“status-changed”` signal

    void
    user_function (GtkPrintJob *job,
                   gpointer     user_data)

Gets emitted when the status of a job changes. The signal handler can use `gtk_print_job_get_status()` to obtain the new status.

#### Parameters

job | the GtkPrintJob object on which the signal was emitted |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 2.10