Sha256: face460a861ef0027dd22f83d5ea58761d1e6f99bef1c9ddab8cead7958ae42b
Contents?: true
Size: 803 Bytes
Versions: 2
Compression:
Stored size: 803 Bytes
Contents
module Zebra class PrintJob attr_reader :printer def initialize(printer) @printer = printer end def print(label, ip) @remote_ip = ip if label.is_a? String tempfile = Tempfile.new "zebra_label" tempfile.write label tempfile.close else tempfile = label.persist end send_to_printer tempfile.path end private def send_to_printer(path) puts "* * * * * * * * * * * * Sending file to printer #{@printer} at #{@remote_ip} * * * * * * * * * * " result = system("rlpr -H #{@remote_ip} -P #{@printer} -o #{path} 2>&1") # try printing to LPD on windows machine first system("lp -h #{@remote_ip} -d #{@printer} -o raw #{path}") if !result # print to unix (CUPS) if rlpr failed end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zebra-zpl-1.1.1 | lib/zebra/print_job.rb |
zebra-zpl-1.1.0 | lib/zebra/print_job.rb |