gtkmm 3.24.7
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::PrintJob Class Reference

A PrintJob object represents a job that is sent to a printer. More...

#include <gtkmm/printjob.h>

Inherits Glib::Object.

Public Types

typedef sigc::slot< void, const Glib::RefPtr< PrintJob > & > SlotPrintJobComplete
 For example, void on_print_job_complete(const Glib::RefPtr<PrintJob>& job);. More...
 

Public Member Functions

 PrintJob (PrintJob && src) noexcept
 
PrintJoboperator= (PrintJob && src) noexcept
 
 ~PrintJob () noexcept override
 
GtkPrintJob * gobj ()
 Provides access to the underlying C GObject. More...
 
const GtkPrintJob * gobj () const
 Provides access to the underlying C GObject. More...
 
GtkPrintJob * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::RefPtr< PrintSettingsget_settings ()
 Gets the Gtk::PrintSettings of the print job. More...
 
Glib::RefPtr< const PrintSettingsget_settings () const
 Gets the Gtk::PrintSettings of the print job. More...
 
Glib::RefPtr< Printerget_printer ()
 Gets the Gtk::Printer of the print job. More...
 
Glib::RefPtr< const Printerget_printer () const
 Gets the Gtk::Printer of the print job. More...
 
Glib::ustring get_title () const
 Gets the job title. More...
 
PrintStatus get_status () const
 Gets the status of the print job. More...
 
void set_source_file (const std::string & filename)
 Make the Gtk::PrintJob send an existing document to the printing system. More...
 
Cairo::RefPtr< Cairo::Surface > get_surface ()
 Gets a cairo surface onto which the pages of the print job should be rendered. More...
 
Cairo::RefPtr< const Cairo::Surface > get_surface () const
 Gets a cairo surface onto which the pages of the print job should be rendered. More...
 
void set_track_print_status (bool track_status=true)
 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. More...
 
bool get_track_print_status () const
 Returns wheter jobs will be tracked after printing. More...
 
void send (const SlotPrintJobComplete & slot)
 Sends the print job off to the printer. More...
 
PrintPages get_pages () const
 Gets the Gtk::PrintPages setting for this job. More...
 
void set_pages (PrintPages pages)
 Sets the Gtk::PrintPages setting for this job. More...
 
std::vector< PrintSettings::PageRangeget_page_ranges () const
 
void set_page_ranges (const std::vector< PrintSettings::PageRange > & ranges)
 
PageSet get_page_set () const
 Gets the Gtk::PageSet setting for this job. More...
 
void set_page_set (PageSet page_set)
 Sets the Gtk::PageSet setting for this job. More...
 
int get_num_copies () const
 Gets the number of copies of this job. More...
 
void set_num_copies (int num_copies)
 Sets the number of copies for this job. More...
 
double get_scale () const
 Gets the scale for this job (where 1.0 means unscaled). More...
 
void set_scale (double scale)
 Sets the scale for this job (where 1.0 means unscaled). More...
 
guint get_n_up () const
 Gets the n-up setting for this job. More...
 
void set_n_up (guint n_up)
 Sets the n-up setting for this job. More...
 
NumberUpLayout get_n_up_layout () const
 Gets the n-up layout setting for this job. More...
 
void set_n_up_layout (NumberUpLayout layout)
 Sets the n-up layout setting for this job. More...
 
bool get_rotate () const
 Gets whether the job is printed rotated. More...
 
void set_rotate (bool rotate=true)
 Sets whether this job is printed rotated. More...
 
bool get_collate () const
 Gets whether this job is printed collated. More...
 
void set_collate (bool collate=true)
 Sets whether this job is printed collated. More...
 
bool get_reverse () const
 Gets whether this job is printed reversed. More...
 
void set_reverse (bool reverse=true)
 Sets whether this job is printed reversed. More...
 
Glib::SignalProxy< void > signal_status_changed ()
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_title () const
 Title of the print job. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Printer > > property_printer () const
 Printer to print the job to. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PrintSettings > > property_settings () const
 Printer settings. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PageSetup > > property_page_setup () const
 Page Setup. More...
 
Glib::PropertyProxy< bool > property_track_print_status ()
 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. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_track_print_status () const
 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. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Glib::RefPtr< PrintJobcreate (const Glib::ustring & title, const Glib::RefPtr< Printer > & printer, const Glib::RefPtr< PrintSettings > & settings, const Glib::RefPtr< PageSetup > & page_setup)
 

Protected Member Functions

 PrintJob (const Glib::ustring & title, const Glib::RefPtr< Printer > & printer, const Glib::RefPtr< PrintSettings > & settings, const Glib::RefPtr< PageSetup > & page_setup)
 
virtual void on_status_changed ()
 This is a default handler for the signal signal_status_changed(). More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::PrintJobwrap (GtkPrintJob * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

A PrintJob 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 PrintUnixDialog API.

Use get_surface() to obtain the cairo surface onto which the pages must be drawn. Use send() to send the finished job to the printer.If you don't use cairo then PrintJob also supports printing of manually generated postscript, via set_source_file().

Since gtkmm 2.10:

Member Typedef Documentation

◆ SlotPrintJobComplete

typedef sigc::slot< void, const Glib::RefPtr<PrintJob>& > Gtk::PrintJob::SlotPrintJobComplete

For example, void on_print_job_complete(const Glib::RefPtr<PrintJob>& job);.

Exceptions
exception

Constructor & Destructor Documentation

◆ PrintJob() [1/2]

Gtk::PrintJob::PrintJob ( PrintJob &&  src)
noexcept

◆ ~PrintJob()

Gtk::PrintJob::~PrintJob ( )
overridenoexcept

◆ PrintJob() [2/2]

Gtk::PrintJob::PrintJob ( const Glib::ustring &  title,
const Glib::RefPtr< Printer > &  printer,
const Glib::RefPtr< PrintSettings > &  settings,
const Glib::RefPtr< PageSetup > &  page_setup 
)
explicitprotected

Member Function Documentation

◆ create()

static Glib::RefPtr< PrintJob > Gtk::PrintJob::create ( const Glib::ustring &  title,
const Glib::RefPtr< Printer > &  printer,
const Glib::RefPtr< PrintSettings > &  settings,
const Glib::RefPtr< PageSetup > &  page_setup 
)
static

◆ get_collate()

bool Gtk::PrintJob::get_collate ( ) const

Gets whether this job is printed collated.

Since gtkmm 3.0:
Returns
Whether the job is printed collated.

◆ get_n_up()

guint Gtk::PrintJob::get_n_up ( ) const

Gets the n-up setting for this job.

Since gtkmm 3.0:
Returns
The n-up setting.

◆ get_n_up_layout()

NumberUpLayout Gtk::PrintJob::get_n_up_layout ( ) const

Gets the n-up layout setting for this job.

Since gtkmm 3.0:
Returns
The n-up layout.

◆ get_num_copies()

int Gtk::PrintJob::get_num_copies ( ) const

Gets the number of copies of this job.

Since gtkmm 3.0:
Returns
The number of copies.

◆ get_page_ranges()

std::vector< PrintSettings::PageRange > Gtk::PrintJob::get_page_ranges ( ) const

◆ get_page_set()

PageSet Gtk::PrintJob::get_page_set ( ) const

Gets the Gtk::PageSet setting for this job.

Since gtkmm 3.0:
Returns
The Gtk::PageSet setting.

◆ get_pages()

PrintPages Gtk::PrintJob::get_pages ( ) const

Gets the Gtk::PrintPages setting for this job.

Since gtkmm 3.0:
Returns
The Gtk::PrintPages setting.

◆ get_printer() [1/2]

Glib::RefPtr< Printer > Gtk::PrintJob::get_printer ( )

Gets the Gtk::Printer of the print job.

Since gtkmm 2.10:
Returns
The printer of job.

◆ get_printer() [2/2]

Glib::RefPtr< const Printer > Gtk::PrintJob::get_printer ( ) const

Gets the Gtk::Printer of the print job.

Since gtkmm 2.10:
Returns
The printer of job.

◆ get_reverse()

bool Gtk::PrintJob::get_reverse ( ) const

Gets whether this job is printed reversed.

Since gtkmm 3.0:
Returns
Whether the job is printed reversed.

◆ get_rotate()

bool Gtk::PrintJob::get_rotate ( ) const

Gets whether the job is printed rotated.

Since gtkmm 3.0:
Returns
Whether the job is printed rotated.

◆ get_scale()

double Gtk::PrintJob::get_scale ( ) const

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

Since gtkmm 3.0:
Returns
The scale.

◆ get_settings() [1/2]

Glib::RefPtr< PrintSettings > Gtk::PrintJob::get_settings ( )

Gets the Gtk::PrintSettings of the print job.

Since gtkmm 2.10:
Returns
The settings of job.

◆ get_settings() [2/2]

Glib::RefPtr< const PrintSettings > Gtk::PrintJob::get_settings ( ) const

Gets the Gtk::PrintSettings of the print job.

Since gtkmm 2.10:
Returns
The settings of job.

◆ get_status()

PrintStatus Gtk::PrintJob::get_status ( ) const

Gets the status of the print job.

Since gtkmm 2.10:
Returns
The status of job.

◆ get_surface() [1/2]

Cairo::RefPtr< Cairo::Surface > Gtk::PrintJob::get_surface ( )

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

Since gtkmm 2.10:
Returns
The cairo surface of job.
Exceptions
Glib::Error

◆ get_surface() [2/2]

Cairo::RefPtr< const Cairo::Surface > Gtk::PrintJob::get_surface ( ) const

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

Since gtkmm 2.10:
Returns
The cairo surface of job.
Exceptions
Glib::Error

◆ get_title()

Glib::ustring Gtk::PrintJob::get_title ( ) const

Gets the job title.

Since gtkmm 2.10:
Returns
The title of job.

◆ get_track_print_status()

bool Gtk::PrintJob::get_track_print_status ( ) const

Returns wheter jobs will be tracked after printing.

For details, see set_track_print_status().

Since gtkmm 2.10:
Returns
true if print job status will be reported after printing.

◆ get_type()

static GType Gtk::PrintJob::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GtkPrintJob * Gtk::PrintJob::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkPrintJob * Gtk::PrintJob::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ gobj_copy()

GtkPrintJob * Gtk::PrintJob::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

◆ on_status_changed()

virtual void Gtk::PrintJob::on_status_changed ( )
protectedvirtual

This is a default handler for the signal signal_status_changed().

◆ operator=()

PrintJob & Gtk::PrintJob::operator= ( PrintJob &&  src)
noexcept

◆ property_page_setup()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PageSetup > > Gtk::PrintJob::property_page_setup ( ) const

Page Setup.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_printer()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Printer > > Gtk::PrintJob::property_printer ( ) const

Printer to print the job to.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_settings()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< PrintSettings > > Gtk::PrintJob::property_settings ( ) const

Printer settings.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_title()

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::PrintJob::property_title ( ) const

Title of the print job.

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_track_print_status() [1/2]

Glib::PropertyProxy< bool > Gtk::PrintJob::property_track_print_status ( )

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.

Default value: false

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_track_print_status() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::PrintJob::property_track_print_status ( ) const

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.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ send()

void Gtk::PrintJob::send ( const SlotPrintJobComplete slot)

Sends the print job off to the printer.

Parameters
slotA function to call when the job completes or an error occurs.

◆ set_collate()

void Gtk::PrintJob::set_collate ( bool  collate = true)

Sets whether this job is printed collated.

Since gtkmm 3.0:
Parameters
collateWhether the job is printed collated.

◆ set_n_up()

void Gtk::PrintJob::set_n_up ( guint  n_up)

Sets the n-up setting for this job.

Since gtkmm 3.0:
Parameters
n_upThe n-up value.

◆ set_n_up_layout()

void Gtk::PrintJob::set_n_up_layout ( NumberUpLayout  layout)

Sets the n-up layout setting for this job.

Since gtkmm 3.0:
Parameters
layoutThe n-up layout setting.

◆ set_num_copies()

void Gtk::PrintJob::set_num_copies ( int  num_copies)

Sets the number of copies for this job.

Since gtkmm 3.0:
Parameters
num_copiesThe number of copies.

◆ set_page_ranges()

void Gtk::PrintJob::set_page_ranges ( const std::vector< PrintSettings::PageRange > &  ranges)

◆ set_page_set()

void Gtk::PrintJob::set_page_set ( PageSet  page_set)

Sets the Gtk::PageSet setting for this job.

Since gtkmm 3.0:
Parameters
page_setA Gtk::PageSet setting.

◆ set_pages()

void Gtk::PrintJob::set_pages ( PrintPages  pages)

Sets the Gtk::PrintPages setting for this job.

Since gtkmm 3.0:
Parameters
pagesThe Gtk::PrintPages setting.

◆ set_reverse()

void Gtk::PrintJob::set_reverse ( bool  reverse = true)

Sets whether this job is printed reversed.

Since gtkmm 3.0:
Parameters
reverseWhether the job is printed reversed.

◆ set_rotate()

void Gtk::PrintJob::set_rotate ( bool  rotate = true)

Sets whether this job is printed rotated.

Since gtkmm 3.0:
Parameters
rotateWhether to print rotated.

◆ set_scale()

void Gtk::PrintJob::set_scale ( double  scale)

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

Since gtkmm 3.0:
Parameters
scaleThe scale.

◆ set_source_file()

void Gtk::PrintJob::set_source_file ( const std::string filename)

Make the Gtk::PrintJob 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().

Since gtkmm 2.10:
Parameters
filenameThe file to be printed.
Exceptions
Glib::Error

◆ set_track_print_status()

void Gtk::PrintJob::set_track_print_status ( bool  track_status = true)

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.

Since gtkmm 2.10:
Parameters
track_statustrue to track status after printing.

◆ signal_status_changed()

Glib::SignalProxy< void > Gtk::PrintJob::signal_status_changed ( )
Slot Prototype:
void on_my_status_changed()

Flags: Run Last

Gets emitted when the status of a job changes. The signal handler can use Gtk::PrintJob::get_status() to obtain the new status.

Since gtkmm 2.10:

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gtk::PrintJob > wrap ( GtkPrintJob *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.