Live data from Hacker News

Bye CUPS: Printing with Netcat

retrohacker.substack.com

21–30 of 183 posts

Re: Bye CUPS: Printing with Netcat

#21
FWIW, the Internet Printing Protocol (and IPP Everywhere in particular) make printer setup in CUPS far, far easier, but distributors seem reluctant to encourage it. I wrote about my experiences with IPP back in June (https://lwn.net/Articles/857502/). I expect to never have to hassle with printer drivers again...

Re: Bye CUPS: Printing with Netcat

#22
CUPS exist because not all printers are HP.

Magic in printing is still an arcanum. PPD files. Windows 10 as a print server. (some print devices are not networked)

Prelude files. in-printing logic like line reversal, density adjustments for photos. Double sided printing meta-signalling, n-up..

"oh, I don't need that stuff" fine, fine, nc is going to work for you, at the end of a bumpy road to a printer which supports it. And, right up until its 2am, you want to colour print that late birthday card for your favourite aunt, and the printer is stuck on nc...

Re: Bye CUPS: Printing with Netcat

#23

If you have a single host, and a single printer, or your printer itself is both network-enabled and can manage its own print spool, direct TCP/IP printing may indeed work for you. The value of CUPS is that it enables the CUPS-serving computer to run as a print server . This means not only print drivers (document format support --- typically plain text, Postscript, and one or more PDL (printer definition languages) &…

The CUPS web front-end also has rough edges; Apple maintains CUPS these days and OS X now ships with the web interface on :631 disabled.

If you still need a print server, it can be well worth the extra $100 or so to buy a business-class printer with an IPP server in it, so that CUPS runs on a chip inside the printer instead of on a separate computer. (Generally anything that supports "Airprint" will do this, and also at the mid range you avoid the "printers whose ink cartridges are more expensive than the printer" zone.)

Re: Bye CUPS: Printing with Netcat

#24
I used to do this at home all the time (from Linux though): networked printer with its own IP address and then good old netcat. I'd do it with PostScript files and send them to HP LaserJet 4M+: not only do these beauties speak PostScript natively, they can also be made to display the infamous "PC LOAD LETTER" message.

I'd try to find these printers used then I'd upgrade them: more RAM, more fonts, adding a network card inside the printer etc.

I still have several of these printers in a garage, some of them have printed more than 300 000 pages. They probably still work: some things were that good back then.

And, yup, there's something feeling magical when netcat'ing a .ps file (or another format) directly to the printer.

Re: Bye CUPS: Printing with Netcat

#26

This is how this Hackernews printed several pages worth of the plaintext representation of a PDF on an office printer a few years ago before figuring out how to cancel the job.

So how did you cancel it? I assume killing the nc process wasn't enough because it had buffered the whole file, so you had to do it at the printer?

Happens all the time when something goes wrong, like malformed files, wrong driver loaded, etc. All printers have an internal buffer, so when one goes crazy printing pages of gibberish, the only solution is to kill the job directly on the printer, or turn it off asap, then go to the computer and empty the print queue should something exist there as well, then do the same at the print server, if there is one. The point is that once a print is started, all buffer will eventually end up to the printer, so it's the 1st device we must stop and the last one to restart once we're sure no data to print is left between the application and the paper, that is, not before all spoolers have been emptied.

Re: Bye CUPS: Printing with Netcat

#27

Hah. I had a similar moment of enlightenment with FreeBSD when somebody explained that you can just cat a wav file into /dev/audio (or /dev/dsp? forget the exact name). And that you can produce white noise by catting /dev/random to the same destination. With no barrier to the sound card like that, I was free to experiment with programming dfferent noise algorithms and figuring out how digital audio works. I eventuall…

The secret of *nix that people don't like accepting is the file approach is often the right approach.

Consider lowly embedded linux. You COULD dig down deep into the documentation of which register, which interrupt, which special memory address needs to be written to interact with the right ports on a embedded linux board. All while adding a bunch of safeguards and checks to make sure "Only you are doing this".

Or, as if often the case, you can simply find the right /dev/xxxx device and read from it or write to it.

9 times out of 10, you'd not suffer any negative consequences from using the /dev/xxx system as intended and you get the bonus ability of being able to interact with the outside world using programming languages other than C.

Re: Bye CUPS: Printing with Netcat

#29

I used to do this at home all the time (from Linux though): networked printer with its own IP address and then good old netcat. I'd do it with PostScript files and send them to HP LaserJet 4M+: not only do these beauties speak PostScript natively, they can also be made to display the infamous "PC LOAD LETTER" message. I'd try to find these printers used then I'd upgrade them: more RAM, more fonts, adding a network ca…

How did you add network cards? Do some printers have PCI expansion slots?

Re: Bye CUPS: Printing with Netcat

#30
post #6

How would you get an application, such as Firefox or Chrome, to know to use netcat to print?

Choose Jetdirect/Appsocket in the printer add menu and it will do the same thing. There is nothing magic about netcat. You are just dumping Postscript/PDF data on a TCP port the printer is listening on.

Back in the day I opened telnet on that port. Typed some stuff and was fascinated that it got print.
Post reply on HN