We have 2 network attached HP LaserJet 400 M401dne, and we need them to print invoice PDFs directly from server command line.
I have added the printers to CUPS and created a printing class(invoices) that contains these two printers.
Then I have set a cron job, which checks a directory for invoice files and sends them to print when it finds any, then moves the files away.
lpr -P invoices -# 4 {list of pdf files}
It seems, however, that whenever there are more than 4-5 invoices to print at the same time, something happens -- printer becomes unresponsive to cups and the cups job stays in queue forever, not printing and not canceling the print.
The printer in the meantime still accepts printouts from windows printing system, which uses it in parallel.
What seems to work, is to cancel all print jobs in cups, hardware-cycle the printer and doing cupsdisable/cupsenable(not sure if the last is needed).
However, there should be some solution so that CUPS is not sending jobs to printer, before it is ready to accept them.
What could be the issue?
Perhaps I need to select a different printing protocol? At the moment I use what the CUPS admin webpage sggested:
dnssd://HP%20LaserJet%20400%20M401dn%20(636536)._ipp._tcp.local/?uuid=564e4835-5030-3038-3636-c8cbb8636536
But maybe I should use IPP or other protocol? If so, how can I find out the IPP queue name for the HP printer?
Or perhaps I should use different printer driver instead of: HP LaserJet 400 M401dne Postscript (recommended) ?
UPD: lpstat - v output:
device for invoices: ///dev/null
device for default: ///dev/null
device for HP_LJ_PRO_400_1: dnssd://HP%20LaserJet%20400%20M401dn%20(072E87)._ipp._tcp.local/?uuid=564e4633-4430-3134-3232-6c3be5072e87
device for HP_LJ_PRO_400_2: dnssd://HP%20LaserJet%20400%20M401dn%20(636536)._ipp._tcp.local/?uuid=564e4835-5030-3038-3636-c8cbb8636536
device for HP_HP_LaserJet_P2055dn: dnssd://HP%20LaserJet%20P2055dn%20%5B0E39EF%5D._pdl-datastream._tcp.local/
device for Ricoh_1515: lpd://192.168.100.33/lp
I recommend using socket printing on port 9100:
Easy config:
So far it seems that the best option is to use ipp://printer-ip/ for adding this particular printer.
Using a generic HP LJ PCL6 driver (PCL5 has been recommended somewhere on the net as the best driver for printing PDFs on HP printers) yielded problem of printer not accepting copy parameter (lpr -# parameter), so I switched back to CUPS recommended Postscript driver for those.
When using socket:// interface, there were still some hiccups with print jobs no more accepting jobs and them hanging in queue with "Connecting to printer" status, and cups server needed to be restarted manually for this to go away.
After switching to ipp this hasn't happened.