module

Bon::Cups

Constants

CONNECTION_FAILURE_TOKENS = ["looking for printer", "unable to locate", "offline", "not connected", "connection failed"]
STANDARD_JOB_OPTIONS = ["media", "PageSize", "PageRegion", "ppi", "fit-to-page", "fitplot", "scaling", "copies", "number-up", "orientation-requested", "landscape", "page-ranges", "outputorder", "collate", "job-sheets", "job-priority", "job-hold-until", "print-quality", "print-color-mode", "Resolution"]

Standard CUPS job options that are always valid and never appear in the printer's PPD/lpoptions -l listing.

THERMAL_TOKENS = ["tm-", "tm_", "epson_tm", "receipt", "thermal", "pos", "star", "bixolon", "citizen", "xprinter", "zebra"]

Class methods

build_options(config : Config, pdf : PDF::PageSize, cli_options : Hash(String, String)) : Hash(String, String)
Source
discover(config : Config, available_queues : Array(Queue) = queues) : Queue
Source
driver_options(printer : String, verbose : Verbose | Nil = nil) : Hash(String, Array(String)) | Nil

Reads the driver-supported option keys and their allowed values from the printer's PPD via lpoptions -l. Returns nil if the listing is unavailable (so validation is skipped rather than blocking printing).

Source
lp_command(printer : String, copies : Int32, options : Hash(String, String), document : String) : Array(String)
Source
parse_driver_options(text : String) : Hash(String, Array(String))
Source
parse_queues(devices_text : String, statuses_text : String) : Array(Queue)
Source
queues
Source
usable_thermal_queues(available_queues : Array(Queue) = queues) : Array(Queue)
Source
valid_init_printer?(name : String | Nil, available_queues : Array(Queue) = queues) : Bool
Source
validate_against!(printer : String, options : Hash(String, String), supported : Hash(String, Array(String))) : Nil
Source
validate_options!(printer : String, options : Hash(String, String)) : Nil

Verifies that every configured option is either a standard CUPS job option or a real driver option with an allowed value. Invalid options are silently dropped by lp, so failing loudly here prevents settings that never reach the printer (for example a non-existent quality option).

Source

Nested types