class Gtk::Printer

Overview

A Gtk::Printer object represents a printer.

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

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

Defined in:

lib/gi-crystal/src/auto/gtk-4.0/printer.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from class GObject::Object

==(other : self) ==, bind_property(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags) : GObject::Binding bind_property, bind_property_full(source_property : String, target : GObject::Object, target_property : String, flags : GObject::BindingFlags, transform_to : GObject::Closure, transform_from : GObject::Closure) : GObject::Binding bind_property_full, data(key : String) : Pointer(Void) | Nil data, finalize finalize, freeze_notify : Nil freeze_notify, getv(names : Enumerable(String), values : Enumerable(_)) : Nil getv, hash(hasher) hash, notify(property_name : String) : Nil notify, notify_by_pspec(pspec : GObject::ParamSpec) : Nil notify_by_pspec, notify_signal notify_signal, property(property_name : String, value : _) : Nil property, qdata(quark : UInt32) : Pointer(Void) | Nil qdata, ref_count : UInt32 ref_count, run_dispose : Nil run_dispose, set_data(key : String, data : Pointer(Void) | Nil) : Nil set_data, set_property(property_name : String, value : _) : Nil set_property, steal_data(key : String) : Pointer(Void) | Nil steal_data, steal_qdata(quark : UInt32) : Pointer(Void) | Nil steal_qdata, thaw_notify : Nil thaw_notify, to_unsafe : Pointer(Void) to_unsafe, watch_closure(closure : GObject::Closure) : Nil watch_closure

Constructor methods inherited from class GObject::Object

cast(obj : GObject::Object) : self cast, new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
new
new
, newv(object_type : UInt64, parameters : Enumerable(GObject::Parameter)) : self newv

Class methods inherited from class GObject::Object

cast?(obj : GObject::Object) : self | Nil cast?, compat_control(what : UInt64, data : Pointer(Void) | Nil) : UInt64 compat_control, g_type : UInt64 g_type, interface_find_property(g_iface : GObject::TypeInterface, property_name : String) : GObject::ParamSpec interface_find_property, interface_list_properties(g_iface : GObject::TypeInterface) : Enumerable(GObject::ParamSpec) interface_list_properties

Constructor Detail

def self.new(name : String, backend : Gtk::PrintBackend, virtual_ : Bool) : self #

Creates a new Gtk::Printer.


[View source]
def self.new #

Initialize a new Printer.


[View source]
def self.new(*, accepting_jobs : Bool | Nil = nil, accepts_pdf : Bool | Nil = nil, accepts_ps : Bool | Nil = nil, icon_name : String | Nil = nil, is_virtual : Bool | Nil = nil, job_count : Int32 | Nil = nil, location : String | Nil = nil, name : String | Nil = nil, paused : Bool | Nil = nil, state_message : String | Nil = nil) #

[View source]

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def accepting_jobs? : Bool #

[View source]
def accepts_pdf : Bool #

Returns whether the printer accepts input in PDF format.


[View source]
def accepts_pdf=(value : Bool) : Bool #

[View source]
def accepts_pdf? : Bool #

[View source]
def accepts_ps : Bool #

Returns whether the printer accepts input in PostScript format.


[View source]
def accepts_ps=(value : Bool) : Bool #

[View source]
def accepts_ps? : Bool #

[View source]
def backend : Gtk::PrintBackend #

Returns the backend of the printer.


[View source]
def capabilities : Gtk::PrintCapabilities #

Returns the printer’s capabilities.

This is useful when you’re using Gtk::PrintUnixDialog’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 Gtk::Printer#has_details and Gtk::Printer#request_details.


[View source]
def compare(b : Gtk::Printer) : Int32 #

Compares two printers.


[View source]
def default_page_size : Gtk::PageSetup #

Returns default page size of printer.


[View source]
def description : String #

Gets the description of the printer.


[View source]
def details_acquired_signal #

[View source]
def hard_margins(top : Float64, bottom : Float64, left : Float64, right : Float64) : Bool #

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 Gtk::Printer#has_details and Gtk::Printer#request_details.


[View source]
def hard_margins_for_paper_size(paper_size : Gtk::PaperSize, top : Float64, bottom : Float64, left : Float64, right : Float64) : Bool #

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 Gtk::Printer#has_details and Gtk::Printer#request_details.


[View source]
def has_details : Bool #

Returns whether the printer details are available.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def icon_name : String #

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


[View source]
def is_accepting_jobs : Bool #

Returns whether the printer is accepting jobs


[View source]
def is_active : Bool #

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


[View source]
def is_default : Bool #

Returns whether the printer is the default printer.


[View source]
def is_paused : Bool #

Returns whether the printer is currently paused.

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


[View source]
def is_virtual : Bool #

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


[View source]
def is_virtual=(value : Bool) : Bool #

[View source]
def is_virtual? : Bool #

[View source]
def job_count : Int32 #

Gets the number of jobs currently queued on the printer.


[View source]
def list_papers : GLib::List #

Lists all the paper sizes printer supports.

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


[View source]
def location : String #

Returns a description of the location of the printer.


[View source]
def name : String #

Returns the name of the printer.


[View source]
def name=(value : String) : String #

[View source]
def paused? : Bool #

[View source]
def request_details : Nil #

Requests the printer details.

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


[View source]
def state_message : String #

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


[View source]