:right-sidebar: True Printer =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: Printer(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` A ``GtkPrinter`` object represents a printer. You only need to deal directly with printers if you use the non-portable :obj:`~gi.repository.Gtk.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 :obj:`~gi.repository.Gtk.PrintJob` object, which lets you print to the printer. Constructors ------------ .. rst-class:: interim-class .. class:: Printer :no-index: .. classmethod:: new(name: str, backend: ~gi.repository.Gtk.PrintBackend, virtual_: bool) -> ~gi.repository.Gtk.Printer Creates a new ``GtkPrinter``. :param name: the name of the printer :param backend: a ``GtkPrintBackend`` :param virtual_: whether the printer is virtual Methods ------- .. rst-class:: interim-class .. class:: Printer :no-index: .. method:: accepts_pdf() -> bool Returns whether the printer accepts input in PDF format. .. method:: accepts_ps() -> bool Returns whether the printer accepts input in PostScript format. .. method:: compare(b: ~gi.repository.Gtk.Printer) -> int Compares two printers. :param b: another ``GtkPrinter`` .. method:: get_backend() -> ~gi.repository.Gtk.PrintBackend Returns the backend of the printer. .. method:: get_capabilities() -> ~gi.repository.Gtk.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 :obj:`~gi.repository.Gtk.Printer.has_details` and :obj:`~gi.repository.Gtk.Printer.request_details`. .. method:: get_default_page_size() -> ~gi.repository.Gtk.PageSetup Returns default page size of ``printer``. .. method:: get_description() -> str Gets the description of the printer. .. method:: 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 :obj:`~gi.repository.Gtk.Printer.has_details` and :obj:`~gi.repository.Gtk.Printer.request_details`. .. method:: get_hard_margins_for_paper_size(paper_size: ~gi.repository.Gtk.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 :obj:`~gi.repository.Gtk.Printer.has_details` and :obj:`~gi.repository.Gtk.Printer.request_details`. :param paper_size: a ``GtkPaperSize`` .. method:: get_icon_name() -> str Gets the name of the icon to use for the printer. .. method:: get_job_count() -> int Gets the number of jobs currently queued on the printer. .. method:: get_location() -> str Returns a description of the location of the printer. .. method:: get_name() -> str Returns the name of the printer. .. method:: get_state_message() -> str Returns the state message describing the current state of the printer. .. method:: has_details() -> bool Returns whether the printer details are available. .. method:: is_accepting_jobs() -> bool Returns whether the printer is accepting jobs .. method:: is_active() -> bool Returns whether the printer is currently active (i.e. accepts new jobs). .. method:: is_default() -> bool Returns whether the printer is the default printer. .. method:: is_paused() -> bool Returns whether the printer is currently paused. A paused printer still accepts jobs, but it is not printing them. .. method:: is_virtual() -> bool Returns whether the printer is virtual (i.e. does not represent actual printer hardware, but something like a CUPS class). .. method:: list_papers() -> list[~gi.repository.Gtk.PageSetup] Lists all the paper sizes ``printer`` supports. This will return and empty list unless the printer’s details are available, see :obj:`~gi.repository.Gtk.Printer.has_details` and :obj:`~gi.repository.Gtk.Printer.request_details`. .. method:: request_details() -> None Requests the printer details. When the details are available, the :obj:`~gi.repository.Gtk.Printer.signals.details_acquired` signal will be emitted on ``printer``. Properties ---------- .. rst-class:: interim-class .. class:: Printer :no-index: .. attribute:: props.accepting_jobs :type: bool :const:`True` if the printer is accepting jobs. .. attribute:: props.accepts_pdf :type: bool :const:`True` if this printer can accept PDF. .. attribute:: props.accepts_ps :type: bool :const:`True` if this printer can accept PostScript. .. attribute:: props.icon_name :type: str Icon name to use for the printer. .. attribute:: props.is_virtual :type: bool :const:`False` if this represents a real hardware device. .. attribute:: props.job_count :type: int Number of jobs queued in the printer. .. attribute:: props.location :type: str Information about the location of the printer. .. attribute:: props.name :type: str The name of the printer. .. attribute:: props.paused :type: bool :const:`True` if this printer is paused. A paused printer still accepts jobs, but it does not print them. .. attribute:: props.state_message :type: str String giving the current status of the printer. Signals ------- .. rst-class:: interim-class .. class:: Printer.signals :no-index: .. method:: details_acquired(success: bool) -> None 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. :param success: :const:`True` if the details were successfully acquired