Skip to content

Instantly share code, notes, and snippets.

@m0wfo
Created February 16, 2009 15:31
Show Gist options
  • Save m0wfo/65205 to your computer and use it in GitHub Desktop.
Save m0wfo/65205 to your computer and use it in GitHub Desktop.
require "cups"
# Create new print job. Specify local file path and printer/class
pj = PrintJob.new("/Users/chris/Documents/hash_server.rb", "EPSON_Stylus_Pro_4800")
pj.print
# New:
pj.cancel # => true if print has been called, otherwise false
pj.job_id # => @job_id || nil
# Returns an array of available printers
PrintJob.show_destinations # => ["EPSON_Stylus_Pro_4800", "PDF_Printer", "Epson_AL_M2000_PostScript_"]
# Returns default printer string, or false if none specified
p PrintJob.default_printer # => "default" || false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment