Ruby CUPS
A lightweight Ruby library for interacting with printers through CUPS.
About
Ruby CUPS provides a wrapper for the Common UNIX Printing System, allowing rubyists to perform basic tasks like printer discovery, job submission & querying.
This library is opinionated in a few respects:
- Setting up CUPS & requisite print drivers is already part of your sys-admin repertoire
- By implication you don't want another GUI to manage it all
- You’re only looking for destinations which have been set up locally
Although this, like everything else is open to change.
Get it
sudo gem install cups
Let's print something!
require 'cups'
page = Cups::PrintJob.new("/invoice.pdf")
page.print # => 127
Instantiate a PrintJob object, call print on it, and you've got yourself a job number there.
What happened to my job?
page.state # => "Processing..."
page.cancel # => true
Which printer do I want?
Cups.show_destinations # => ["office", "home"]
Cups.default_printer # => "office"