Cool article. Netcat is great. It was a God-send back in my days of supporting users on a multi-user SCO UNIX machine for a custom accounting software company. Linked LPR profiles, using netcat, to user friendly names so that they could just select a printer from the list of those available. Good stuff!
Tried it. One page, blank except "Unsupported PDF data for Direct Print:1000". This on a Brother HL-L3210CW, duplex color laser.
Printers have become overwhelmingly simpler to support in recent years (i.e. since, say, 2011), rendering much of what used to be needed in CUPS superfluous. CUPS and all its apparatus was necessary until that happened. Nowadays it suffices to tell CUPS you have a generic printer, and it will find out what it needs to know from the printer. But the old stuff still has to work, for the old printers which people still expect to be able to continue using.
For sure. This is a 10 year old hefty LaserJet. For most modern printers, it seems postscript is widely accepted. Piping through gs first on the way to netcat does the trick. I use this same trick when I want to print a massive file (100+ page pdf file), the poor little printer’s circuits sit there working away processing the pdf file for several minutes otherwise.
Proof of concept. I have tried it and it works. Unfortunately, no formatting to paper size and no .pdf printing. I assume that both are possible by piping through gs as per another comment. Unfortunately, I have no idea as to the syntax, although obviously as per the man page, -sPAPERSIZE=a4 and -sOutputFile=%pipe%nc are somewhere in the final string to print…
On my local LAN, with such bad actors as my wife and my three cats operating, I think I'll take my chances. It comes out of the printer unencrypted, as well.
This is just basically what one part of CUPS is doing to send jobs to the printer. It's basically enough to print if you are alone with the printer and don't need extra features. But it doesn't scale to systems with lots of jobs, as you don't have job priorities, logging, etc... and some printers (in enterprise networks) are either not reachable from normal PCs (you need to go through the print server) or are locally configured to accept connections only from the print server (that's the case here).
You could always do this even with Linux, but good luck trying to print anything but plain text, even on *BSD, if your printer only understands some, very specific version of PCL, HPGL, PostScript or another printer "language".
This has nothing, abosultely nothing to do with *BSD .... You will get the same result with everything which can do a netcat,... The printer "understands" the incoming formats....
LaserJet printers are usually good printers, specially the older ones! They support postscript and several had network included... they were also somewhat cheap and reliable. Sadly they were too good and with cheap toner replacement. Slowly they got replaced by worse and more lucrative printers (even calling some of them "laserjet" printers)
Any postscript printer do not really need cups if the printing program knows how to send postscript (default for most GUI unix like programs) or text
Add a network capable printer and the setup is that simple...
Now the problem is that not all programs do print as postscript (few, but there are) or use some postscript capability that your printer may not support (you will sooner or later find that error)... and you can't send files directly to the printer, you always need to open then in some program and print (usually not a huge problem)
Cups isn't required and never was, for many years lpd ruled even without any filter... but cups helped managed jobs, users, setup filters (drivers) and sharing printers (configure one cups in one server, all other can simply forward to that cups as a remote printer, without any other setup)
But sadly finding postscript printers is more difficult, unless you go high end. Most printers are the cheapest possible and scrap postscript, as it is complex and require cpu and memory.... many printers builders choose to sell "winprinters" only, where the windows driver do all the work and the printer have as few hardware as possible. Many do not even accept plain text directly to their port (usb or network), much less other complex format. Several of this printers can already work in linux , but many still fail... so yes, cups for those printers help a lot as all the filters/drivers complexity is hidden
Printers and scanner need something like USB HID (mouse, keyboards) or usb-sound, a standard protocol for everyone to follow, but builders do not really want that, as give all printers almost all the features and "steal" some high end printers sales
HP LaserJets - the good ones, anyway - have baked-in hardware support for PostScript documents. I've not personally tested if they support PDFs, but I've (ab)used the hell out of their support for printing straight PostScript documents for many years. I'm not aware of an easier way to implement a network printing solution, and it makes it pretty damn easy.
Hah I love this post. The gifs are perfect, it's not overly long with a ton of filling before getting to the point, I love it
Cool article. Netcat is great. It was a God-send back in my days of supporting users on a multi-user SCO UNIX machine for a custom accounting software company. Linked LPR profiles, using netcat, to user friendly names so that they could just select a printer from the list of those available. Good stuff!
Tried it. One page, blank except "Unsupported PDF data for Direct Print:1000". This on a Brother HL-L3210CW, duplex color laser.
Printers have become overwhelmingly simpler to support in recent years (i.e. since, say, 2011), rendering much of what used to be needed in CUPS superfluous. CUPS and all its apparatus was necessary until that happened. Nowadays it suffices to tell CUPS you have a generic printer, and it will find out what it needs to know from the printer. But the old stuff still has to work, for the old printers which people still expect to be able to continue using.
For sure. This is a 10 year old hefty LaserJet. For most modern printers, it seems postscript is widely accepted. Piping through gs first on the way to netcat does the trick. I use this same trick when I want to print a massive file (100+ page pdf file), the poor little printer’s circuits sit there working away processing the pdf file for several minutes otherwise.
Holy shit
Proof of concept. I have tried it and it works. Unfortunately, no formatting to paper size and no .pdf printing. I assume that both are possible by piping through gs as per another comment. Unfortunately, I have no idea as to the syntax, although obviously as per the man page, -sPAPERSIZE=a4 and -sOutputFile=%pipe%nc are somewhere in the final string to print…
You're like James Bond visiting his roots to Skyfall. xD
Hi! Linux user here! What about with sending some pdf document or a gif/jpg file?
Printing on RAW 9100 port is unsecure. You should use IPPS or other encrypted protocol.
On my local LAN, with such bad actors as my wife and my three cats operating, I think I'll take my chances. It comes out of the printer unencrypted, as well.
This is just basically what one part of CUPS is doing to send jobs to the printer. It's basically enough to print if you are alone with the printer and don't need extra features. But it doesn't scale to systems with lots of jobs, as you don't have job priorities, logging, etc... and some printers (in enterprise networks) are either not reachable from normal PCs (you need to go through the print server) or are locally configured to accept connections only from the print server (that's the case here).
You could always do this even with Linux, but good luck trying to print anything but plain text, even on *BSD, if your printer only understands some, very specific version of PCL, HPGL, PostScript or another printer "language".
This has nothing, abosultely nothing to do with *BSD .... You will get the same result with everything which can do a netcat,... The printer "understands" the incoming formats....
An the author does not claim that it has anything to do with *BSD. It's just that the FreeBSD Handbook suggested using netcat.
Fair enough. I read that as: FreeBSD is the solution to my problems. After re-reading the last paragraph , I admit you are right. My bad...
It seems to work with the Canon iR C5325 too \o/
LaserJet printers are usually good printers, specially the older ones! They support postscript and several had network included... they were also somewhat cheap and reliable. Sadly they were too good and with cheap toner replacement. Slowly they got replaced by worse and more lucrative printers (even calling some of them "laserjet" printers)
Any postscript printer do not really need cups if the printing program knows how to send postscript (default for most GUI unix like programs) or text
Add a network capable printer and the setup is that simple...
Now the problem is that not all programs do print as postscript (few, but there are) or use some postscript capability that your printer may not support (you will sooner or later find that error)... and you can't send files directly to the printer, you always need to open then in some program and print (usually not a huge problem)
Cups isn't required and never was, for many years lpd ruled even without any filter... but cups helped managed jobs, users, setup filters (drivers) and sharing printers (configure one cups in one server, all other can simply forward to that cups as a remote printer, without any other setup)
But sadly finding postscript printers is more difficult, unless you go high end. Most printers are the cheapest possible and scrap postscript, as it is complex and require cpu and memory.... many printers builders choose to sell "winprinters" only, where the windows driver do all the work and the printer have as few hardware as possible. Many do not even accept plain text directly to their port (usb or network), much less other complex format. Several of this printers can already work in linux , but many still fail... so yes, cups for those printers help a lot as all the filters/drivers complexity is hidden
Printers and scanner need something like USB HID (mouse, keyboards) or usb-sound, a standard protocol for everyone to follow, but builders do not really want that, as give all printers almost all the features and "steal" some high end printers sales
HP LaserJets - the good ones, anyway - have baked-in hardware support for PostScript documents. I've not personally tested if they support PDFs, but I've (ab)used the hell out of their support for printing straight PostScript documents for many years. I'm not aware of an easier way to implement a network printing solution, and it makes it pretty damn easy.
fancy!!!!!