Printer#

class Printer(**properties: Any)#

Superclasses: Object

A GtkPrinter object represents a printer.

You only need to deal directly with printers if you use the non-portable PrintUnixDialog API.

A GtkPrinter allows to get status information about the printer, such as its description, its location, the number of queued jobs, etc. Most importantly, a GtkPrinter object can be used to create a PrintJob object, which lets you print to the printer.

Constructors#

class Printer
classmethod new(name: str, backend: PrintBackend, virtual_: bool) Printer#

Creates a new GtkPrinter.

Parameters:
  • name – the name of the printer

  • backend – a GtkPrintBackend

  • virtual – whether the printer is virtual

Methods#

class Printer
accepts_pdf() bool#

Returns whether the printer accepts input in PDF format.

accepts_ps() bool#

Returns whether the printer accepts input in PostScript format.

compare(b: Printer) int#

Compares two printers.

Parameters:

b – another GtkPrinter

get_backend() PrintBackend#

Returns the backend of the printer.

get_capabilities() PrintCapabilities#

Returns the printer’s capabilities.

This is useful when you’re using GtkPrintUnixDialog’s manual-capabilities setting and need to know which settings the printer can handle and which you must handle yourself.

This will return 0 unless the printer’s details are available, see has_details and request_details.

get_default_page_size() PageSetup#

Returns default page size of printer.

get_description() str#

Gets the description of the printer.

get_hard_margins() Tuple[bool, float, float, float, float]#

Retrieve the hard margins of printer.

These are the margins that define the area at the borders of the paper that the printer cannot print to.

Note: This will not succeed unless the printer’s details are available, see has_details and request_details.

get_hard_margins_for_paper_size(paper_size: PaperSize) Tuple[bool, float, float, float, float]#

Retrieve the hard margins of printer for paper_size.

These are the margins that define the area at the borders of the paper that the printer cannot print to.

Note: This will not succeed unless the printer’s details are available, see has_details and request_details.

Parameters:

paper_size – a GtkPaperSize

get_icon_name() str#

Gets the name of the icon to use for the printer.

get_job_count() int#

Gets the number of jobs currently queued on the printer.

get_location() str#

Returns a description of the location of the printer.

get_name() str#

Returns the name of the printer.

get_state_message() str#

Returns the state message describing the current state of the printer.

has_details() bool#

Returns whether the printer details are available.

is_accepting_jobs() bool#

Returns whether the printer is accepting jobs

is_active() bool#

Returns whether the printer is currently active (i.e. accepts new jobs).

is_default() bool#

Returns whether the printer is the default printer.

is_paused() bool#

Returns whether the printer is currently paused.

A paused printer still accepts jobs, but it is not printing them.

is_virtual() bool#

Returns whether the printer is virtual (i.e. does not represent actual printer hardware, but something like a CUPS class).

list_papers() list[PageSetup]#

Lists all the paper sizes printer supports.

This will return and empty list unless the printer’s details are available, see has_details and request_details.

request_details() None#

Requests the printer details.

When the details are available, the details_acquired signal will be emitted on printer.

Properties#

class Printer
props.accepting_jobs: bool#

The type of the None singleton.

props.accepts_pdf: bool#

The type of the None singleton.

props.accepts_ps: bool#

The type of the None singleton.

props.icon_name: str#

The type of the None singleton.

props.is_virtual: bool#

The type of the None singleton.

props.job_count: int#

The type of the None singleton.

props.location: str#

The type of the None singleton.

props.name: str#

The type of the None singleton.

props.paused: bool#

The type of the None singleton.

props.state_message: str#

The type of the None singleton.

Signals#

class Printer.signals
details_acquired(success: bool) None#

The type of the None singleton.

Parameters:

successTrue if the details were successfully acquired