Closed adas172002 closed 5 years ago
The docs are a bit out of date per issue #11. But you are correct, right now the #print
on Zebra::PrintJob
does take 2 arguments: the label
to be printed and the ip
/host of the printer queue.
The error lp: No such file or directory
comes from the lp
command. This usually means that either the ip/host cannot be reached, the name of the print queue does not exist at the specified host, or the file itself does not exist.
In your case, I think the issue is with the ip
you are providing when calling #print
. When the -h
flag is omitted on the lp
command I believe it defaults to localhost. So you would need to provide either localhost
, 127.0.0.1
, or 0.0.0.0
as the ip
if your cups queues are on your local machine.
e.g.
print_job.print label, '127.0.0.1'
Both the #print
and private #send_to_printer
methods could probably use some work. Some ideas we have been throwing around are:
ip
an argument that defaults to localhost
when omitted.lp
or to print to a Windows LPD using rlpr
instead of always trying both.Keep an eye on #11 for those docs to be updated. We hope to tackle that soon.
While on macOS issuing #print on Zebra::PrintJob instance with one argument (like stated in documentation) is throwing wrong argument number error, #print is expecting 2 arguments. Quickly checking method's code revealed that ip of printers queue should be a second argument. However, #print with 2 arguments is also generating an error
lp: No such file or directory
, which in fact refers to code in private #method send_to_printer. Executing lp command without option-h #{@remote_ip}
is sending temp file to the printer, executing with option-h #{@remote_ip}
is returning errorlp: No such file or directory
. Is it just me or this private method#method send_to_printer
needs a fix?