Gtk.Printer¶
class — extends GObject.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¶
new¶
Creates a new GtkPrinter.
Parameters:
name— the name of the printerbackend— aGtkPrintBackendvirtual_— whether the printer is virtual
Methods¶
accepts_pdf¶
Returns whether the printer accepts input in PDF format.
accepts_ps¶
Returns whether the printer accepts input in PostScript format.
compare¶
Compares two printers.
Parameters:
b— anotherGtkPrinter
get_backend¶
Returns the backend of the printer.
get_capabilities¶
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 Printer.has_details and
Printer.request_details.
get_default_page_size¶
Returns default page size of printer.
get_description¶
Gets the description of the printer.
get_hard_margins¶
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 Printer.has_details and
Printer.request_details.
get_hard_margins_for_paper_size¶
def get_hard_margins_for_paper_size(self, 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 Printer.has_details and
Printer.request_details.
Parameters:
paper_size— aGtkPaperSize
get_icon_name¶
Gets the name of the icon to use for the printer.
get_job_count¶
Gets the number of jobs currently queued on the printer.
get_location¶
Returns a description of the location of the printer.
get_name¶
Returns the name of the printer.
get_state_message¶
Returns the state message describing the current state of the printer.
has_details¶
Returns whether the printer details are available.
is_accepting_jobs¶
Returns whether the printer is accepting jobs
is_active¶
Returns whether the printer is currently active (i.e. accepts new jobs).
is_default¶
Returns whether the printer is the default printer.
is_paused¶
Returns whether the printer is currently paused.
A paused printer still accepts jobs, but it is not printing them.
is_virtual¶
Returns whether the printer is virtual (i.e. does not represent actual printer hardware, but something like a CUPS class).
list_papers¶
Lists all the paper sizes printer supports.
This will return and empty list unless the printer’s details
are available, see Printer.has_details and
Printer.request_details.
request_details¶
Requests the printer details.
When the details are available, the
Printer.details-acquired signal
will be emitted on printer.
Properties¶
accepting_jobs¶
True if the printer is accepting jobs.
accepts_pdf¶
True if this printer can accept PDF.
accepts_ps¶
True if this printer can accept PostScript.
icon_name¶
Icon name to use for the printer.
is_virtual¶
False if this represents a real hardware device.
job_count¶
Number of jobs queued in the printer.
location¶
Information about the location of the printer.
name¶
The name of the printer.
paused¶
True if this printer is paused.
A paused printer still accepts jobs, but it does not print them.
state_message¶
String giving the current status of the printer.
Signals¶
details-acquired¶
Emitted in response to a request for detailed information about a printer from the print backend.
The success parameter indicates if the information was
actually obtained.