![]() |
![]() |
![]() |
GTK+ Reference Manual | ![]() |
---|---|---|---|---|
#include <gtk/gtk.h> GtkPrintJob;void (*GtkPrintJobCompleteFunc) (GtkPrintJob *print_job,gpointer user_data,GError *error); GtkPrintJob* gtk_print_job_new (constgchar *title, GtkPrinter *printer, GtkPrintSettings *settings, GtkPageSetup *page_setup); GtkPrintSettings* gtk_print_job_get_settings (GtkPrintJob *job); GtkPrinter* gtk_print_job_get_printer (GtkPrintJob *job); constgchar * gtk_print_job_get_title (GtkPrintJob *job); GtkPrintStatus gtk_print_job_get_status (GtkPrintJob *job);gboolean gtk_print_job_set_source_file (GtkPrintJob *job, constgchar *filename,GError **error);cairo_surface_t * gtk_print_job_get_surface (GtkPrintJob *job,GError **error);void gtk_print_job_send (GtkPrintJob *job, GtkPrintJobCompleteFunc callback,gpointer user_data,GDestroyNotify dnotify);void gtk_print_job_set_track_print_status (GtkPrintJob *job,gboolean track_status);gboolean gtk_print_job_get_track_print_status (GtkPrintJob *job);
page-setup GtkPageSetup : Read / Write / Construct Only printer GtkPrinter : Read / Write / Construct Only settings GtkPrintSettings : Read / Write / Construct Only titlegchararray : Read / Write / Construct Only track-print-statusgboolean : Read / Write
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()
.
Printing support was added in GTK+ 2.10.
typedef struct _GtkPrintJob GtkPrintJob;
The GtkPrintJob struct contains only private members and should not be directly accessed.
void (*GtkPrintJobCompleteFunc) (GtkPrintJob *print_job,gpointer user_data,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.
print_job : |
the GtkPrintJob |
user_data : |
user data that has been passed to gtk_print_job_send()
|
error : |
a NULL |
GtkPrintJob* gtk_print_job_new (constgchar *title, GtkPrinter *printer, GtkPrintSettings *settings, GtkPageSetup *page_setup);
Creates a new GtkPrintJob.
title : |
the job title |
printer : |
a GtkPrinter |
settings : |
a GtkPrintSettings |
page_setup : |
a GtkPageSetup |
Returns : | a new GtkPrintJob |
Since 2.10
GtkPrintSettings* gtk_print_job_get_settings (GtkPrintJob *job);
Gets the GtkPrintSettings of the print job.
job : |
a GtkPrintJob |
Returns : | the settings of job
|
Since 2.10
GtkPrinter* gtk_print_job_get_printer (GtkPrintJob *job);
Gets the GtkPrinter of the print job.
job : |
a GtkPrintJob |
Returns : | the printer of job
|
Since 2.10
constgchar * gtk_print_job_get_title (GtkPrintJob *job);
Gets the job title.
job : |
a GtkPrintJob |
Returns : | the title of job
|
Since 2.10
GtkPrintStatus gtk_print_job_get_status (GtkPrintJob *job);
Gets the status of the print job.
job : |
a GtkPrintJob |
Returns : | the status of job
|
Since 2.10
gboolean gtk_print_job_set_source_file (GtkPrintJob *job, constgchar *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()
.
job : |
a GtkPrintJob |
filename : |
the file to be printed |
error : |
return location for errors |
Returns : | FALSE |
Since 2.10
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.
job : |
a GtkPrintJob |
error : |
return location for errors, or NULL |
Returns : | the cairo surface of job
|
Since 2.10
void gtk_print_job_send (GtkPrintJob *job, GtkPrintJobCompleteFunc callback,gpointer user_data,GDestroyNotify dnotify);
Sends the print job off to the printer.
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
void gtk_print_job_set_track_print_status (GtkPrintJob *job,gboolean track_status);
If track_status is TRUE
This function is often implemented using some form of polling, so it should not be enabled unless needed.
job : |
a GtkPrintJob |
track_status : |
TRUE |
Since 2.10
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()
.
job : |
a GtkPrintJob |
Returns : | TRUE |
Since 2.10
printer
propertyprinter GtkPrinter : Read / Write / Construct Only
Printer to print the job to.
title
propertytitlegchararray : Read / Write / Construct Only
Title of the print job.
Default value: NULL
::status-changed
signalvoid user_function (GtkPrintJob *job,gpointer user_data) : Run Last
Gets emitted when the status of a job changes. The signal handler
can use gtk_print_job_get_status()
to obtain the new status.
job : |
the GtkPrintJob object on which the signal was emitted |
user_data : |
user data set when the signal handler was connected. |
Since 2.10