Skip to content
cmowforth edited this page Sep 13, 2010 · 8 revisions

Basic Usage

What printers can we use?

A few singleton methods:

require "cups"

Cups.default_printer
Cups.show_destinations
Cups.jobs_on(printer)
Cups.options_for(printer)

Printing

To actually print things, we have a PrintJob class:

pj = Cups::PrintJob.new("/path/to/file")

pj.print

The PrintJob object will choose the default printer if you don’t supply a second argument on creation.

Jobs

You can access the filename, job_id and printer attributes:

pj.filename
pj.job_id
pj.printer

Or to see how it went:

pj.state
pj.completed?

And to cancel:

pj.cancel

RTFM

Check out the RDoc.

Clone this wiki locally