Hacker News new | ask | show | jobs
by EnigmaCurry 1204 days ago
> You also can't just netcat an ebook to your printer and get useful output.

Can you 'just netcat' a PDF to a printer? Which port number? How could I control features such as printing to both sides of the page? I imagined there would be some wrapping protocol (or conversion to postscript?) Does the printer that receives just a PDF binary, and no other control signal, just decide to use a default mode (like always printing single sided only)?

2 comments

Yes, it works on most printers. My Brother laser printer has a menu option to print out it's network settings, which gives ~20 different protocols with ports which can be used. I don't think you can control the print settings with netcat, but I'm probably wrong. Mostly I use lpr, but the netcat trick is very useful sometimes.
Fascinating, I printed a network report from an HP printer and it listed several services, one of which was:

    9100 Printing = Enabled
So I guessed that I could netcat to port 9100

    cat something.pdf | nc 192.168.1.2 9100
It worked! The printer sat waiting for more content, so I had to press Ctrl-C to kill netcat, but then it immediately printed what it had sent. The margins were off (not like if I had printed through a print driver).
You can if it supports PDF, which lots of modern networked printers do.