Class: Gtk::Printer

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

A GtkPrinter object represents a printer.

You only need to deal directly with printers if you use the non-portable [classGtk.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 [classGtk.PrintJob] object, which lets you print to the printer.

Instance Method Summary collapse

Constructor Details

#initialize(name, backend, virtual_) ⇒ Gtk::Printer

Creates a new GtkPrinter.

Parameters:

  • name (String)

    the name of the printer

  • backend (Gtk::PrintBackend)

    a GtkPrintBackend

  • virtual_ (Boolean)

    whether the printer is virtual

Instance Method Details

#accepting_jobs=(accepting_jobs) ⇒ Boolean

true if the printer is accepting jobs.

Parameters:

  • accepting_jobs (Boolean)

Returns:

  • (Boolean)

    accepting-jobs

  • (Boolean)

    accepting-jobs

#accepting_jobs?Boolean

true if the printer is accepting jobs.

Returns:

  • (Boolean)

    accepting-jobs

#accepts_pdfBoolean

Returns whether the printer accepts input in PDF format.

Returns:

  • (Boolean)

    true if printer accepts PDF

#accepts_pdf=(accepts_pdf) ⇒ Boolean

true if this printer can accept PDF.

Parameters:

  • accepts_pdf (Boolean)

Returns:

  • (Boolean)

    accepts-pdf

  • (Boolean)

    accepts-pdf

#accepts_pdf?Boolean

true if this printer can accept PDF.

Returns:

  • (Boolean)

    accepts-pdf

#accepts_psBoolean

Returns whether the printer accepts input in PostScript format.

Returns:

  • (Boolean)

    true if printer accepts PostScript

#accepts_ps=(accepts_ps) ⇒ Boolean

true if this printer can accept PostScript.

Parameters:

  • accepts_ps (Boolean)

Returns:

  • (Boolean)

    accepts-ps

  • (Boolean)

    accepts-ps

#accepts_ps?Boolean

true if this printer can accept PostScript.

Returns:

  • (Boolean)

    accepts-ps

#backendGtk::

The backend for the printer.

Returns:

#backend=(backend) ⇒ Gtk::

The backend for the printer.

Parameters:

Returns:

#capabilitiesGtk::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 [methodGtk.Printer.has_details] and [methodGtk.Printer.request_details].

Returns:

#compare(b) ⇒ Integer

Compares two printers.

Parameters:

Returns:

  • (Integer)

    0 if the printer match, a negative value if a < b, or a positive value if a > b

#default_page_sizeGtk::PageSetup

Returns default page size of printer.

Returns:

  • (Gtk::PageSetup)

    a newly allocated GtkPageSetup with default page size of the printer.

#descriptionString

Gets the description of the printer.

Returns:

  • (String)

    the description of printer

#get_hard_margins(top, bottom, left, right) ⇒ Boolean

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 [methodGtk.Printer.has_details] and [methodGtk.Printer.request_details].

Parameters:

  • top (Float)

    a location to store the top margin in

  • bottom (Float)

    a location to store the bottom margin in

  • left (Float)

    a location to store the left margin in

  • right (Float)

    a location to store the right margin in

Returns:

  • (Boolean)

    true iff the hard margins were retrieved

#get_hard_margins_for_paper_size(paper_size, top, bottom, left, right) ⇒ Boolean

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 [methodGtk.Printer.has_details] and [methodGtk.Printer.request_details].

Parameters:

  • paper_size (Gtk::PaperSize)

    a GtkPaperSize

  • top (Float)

    a location to store the top margin in

  • bottom (Float)

    a location to store the bottom margin in

  • left (Float)

    a location to store the left margin in

  • right (Float)

    a location to store the right margin in

Returns:

  • (Boolean)

    true iff the hard margins were retrieved

#has_detailsBoolean

Returns whether the printer details are available.

Returns:

  • (Boolean)

    true if printer details are available

#icon_nameString

Icon name to use for the printer.

Returns:

  • (String)

    icon-name

#icon_name=(icon_name) ⇒ String

Icon name to use for the printer.

Parameters:

  • icon_name (String)

Returns:

  • (String)

    icon-name

  • (String)

    icon-name

#is_accepting_jobsBoolean

Returns whether the printer is accepting jobs

Returns:

  • (Boolean)

    true if printer is accepting jobs

#is_activeBoolean

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

Returns:

  • (Boolean)

    true if printer is active

#is_defaultBoolean

Returns whether the printer is the default printer.

Returns:

  • (Boolean)

    true if printer is the default

#is_pausedBoolean

Returns whether the printer is currently paused.

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

Returns:

  • (Boolean)

    true if printer is paused

#is_virtualBoolean

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

Returns:

  • (Boolean)

    true if printer is virtual

#is_virtual=(is_virtual) ⇒ Boolean

false if this represents a real hardware device.

Parameters:

  • is_virtual (Boolean)

Returns:

  • (Boolean)

    is-virtual

  • (Boolean)

    is-virtual

#is_virtual?Boolean

false if this represents a real hardware device.

Returns:

  • (Boolean)

    is-virtual

#job_countInteger

Number of jobs queued in the printer.

Returns:

  • (Integer)

    job-count

#job_count=(job_count) ⇒ Integer

Number of jobs queued in the printer.

Parameters:

  • job_count (Integer)

Returns:

  • (Integer)

    job-count

  • (Integer)

    job-count

#list_papersGLib::List<Gtk::PageSetup>

Lists all the paper sizes printer supports.

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

Returns:

  • (GLib::List<Gtk::PageSetup>)

    a newly allocated list of newly allocated GtkPageSetups.

#locationString

Information about the location of the printer.

Returns:

  • (String)

    location

#location=(location) ⇒ String

Information about the location of the printer.

Parameters:

  • location (String)

Returns:

  • (String)

    location

  • (String)

    location

#nameString

The name of the printer.

Returns:

  • (String)

    name

#name=(name) ⇒ String

The name of the printer.

Parameters:

  • name (String)

Returns:

  • (String)

    name

  • (String)

    name

#paused=(paused) ⇒ Boolean

true if this printer is paused.

A paused printer still accepts jobs, but it does not print them.

Parameters:

  • paused (Boolean)

Returns:

  • (Boolean)

    paused

  • (Boolean)

    paused

#paused?Boolean

true if this printer is paused.

A paused printer still accepts jobs, but it does not print them.

Returns:

  • (Boolean)

    paused

#request_detailsnil

Requests the printer details.

When the details are available, the [signalGtk.Printer::details-acquired] signal will be emitted on printer.

Returns:

  • (nil)

#state_messageString

String giving the current status of the printer.

Returns:

  • (String)

    state-message

#state_message=(state_message) ⇒ String

String giving the current status of the printer.

Parameters:

  • state_message (String)

Returns:

  • (String)

    state-message

  • (String)

    state-message