lib/zebra/print_job.rb in zebra-epl-0.0.2 vs lib/zebra/print_job.rb in zebra-epl-0.0.5

- old
+ new

@@ -16,20 +16,27 @@ def print(label) tempfile = label.persist begin - `lpr -P #{@printer} -o raw #{tempfile.path}` + send_to_printer tempfile.path ensure tempfile.close - tempfile.unlink end end private def check_existent_printers(printer) existent_printers = Cups.show_destinations raise UnknownPrinter.new(printer) unless existent_printers.include?(printer) + end + + def send_to_printer(path) + if RUBY_PLATFORM =~ /darwin/ + `lpr -P #{@printer} -o raw #{path}` + else + `lp -d #{@printer} -o raw #{path}` + end end end end