PrintJob#

class PrintJob(**properties: Any)#

Superclasses: Object

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 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 GtkPrintJob also supports printing of manually generated PostScript, via set_source_file.

Constructors#

class PrintJob
classmethod new(title: str, printer: Printer, settings: PrintSettings, page_setup: PageSetup) PrintJob#

Creates a new GtkPrintJob.

Parameters:
  • title – the job title

  • printer – a GtkPrinter

  • settings – a GtkPrintSettings

  • page_setup – a GtkPageSetup

Methods#

class PrintJob
get_collate() bool#

Gets whether this job is printed collated.

get_n_up() int#

Gets the n-up setting for this job.

get_n_up_layout() NumberUpLayout#

Gets the n-up layout setting for this job.

get_num_copies() int#

Gets the number of copies of this job.

get_page_ranges() list[PageRange]#

Gets the page ranges for this job.

get_page_set() PageSet#

Gets the GtkPageSet setting for this job.

get_pages() PrintPages#

Gets the GtkPrintPages setting for this job.

get_printer() Printer#

Gets the GtkPrinter of the print job.

get_reverse() bool#

Gets whether this job is printed reversed.

get_rotate() bool#

Gets whether the job is printed rotated.

get_scale() float#

Gets the scale for this job.

get_settings() PrintSettings#

Gets the GtkPrintSettings of the print job.

get_status() PrintStatus#

Gets the status of the print job.

get_surface() Surface#

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

get_title() str#

Gets the job title.

get_track_print_status() bool#

Returns whether jobs will be tracked after printing.

For details, see set_track_print_status.

send(callback: Callable[[...], None], *user_data: Any) None#

Sends the print job off to the printer.

Parameters:
  • callback – function to call when the job completes or an error occurs

  • user_data – user data that gets passed to callback

set_collate(collate: bool) None#

Sets whether this job is printed collated.

Parameters:

collate – whether the job is printed collated

set_n_up(n_up: int) None#

Sets the n-up setting for this job.

Parameters:

n_up – the n-up value

set_n_up_layout(layout: NumberUpLayout) None#

Sets the n-up layout setting for this job.

Parameters:

layout – the n-up layout setting

set_num_copies(num_copies: int) None#

Sets the number of copies for this job.

Parameters:

num_copies – the number of copies

set_page_ranges(ranges: Sequence[PageRange]) None#

Sets the page ranges for this job.

Parameters:

ranges – pointer to an array of GtkPageRange structs

set_page_set(page_set: PageSet) None#

Sets the GtkPageSet setting for this job.

Parameters:

page_set – a GtkPageSet setting

set_pages(pages: PrintPages) None#

Sets the GtkPrintPages setting for this job.

Parameters:

pages – the GtkPrintPages setting

set_reverse(reverse: bool) None#

Sets whether this job is printed reversed.

Parameters:

reverse – whether the job is printed reversed

set_rotate(rotate: bool) None#

Sets whether this job is printed rotated.

Parameters:

rotate – whether to print rotated

set_scale(scale: float) None#

Sets the scale for this job.

1.0 means unscaled.

Parameters:

scale – the scale

set_source_fd(fd: int) bool#

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 accepts_pdf and accepts_ps.

This is similar to set_source_file, but takes expects an open file descriptor for the file, instead of a filename.

Parameters:

fd – a file descriptor

set_source_file(filename: str) bool#

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 accepts_pdf and accepts_ps.

Parameters:

filename – the file to be printed

set_track_print_status(track_status: bool) None#

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:

track_statusTrue to track status after printing

Properties#

class PrintJob
props.page_setup: PageSetup#

The type of the None singleton.

props.printer: Printer#

The type of the None singleton.

props.settings: PrintSettings#

The type of the None singleton.

props.title: str#

The type of the None singleton.

props.track_print_status: bool#

The type of the None singleton.

Signals#

class PrintJob.signals
status_changed() None#

The type of the None singleton.