Of the many methods for printing the simplest and most genius is port 9100. At the very basic printing over port 9100 requires you to open a TCP connection to the printer’s port 9100, push some text, then close the connection.
For a presentation at Microsoft I wanted to end on a fun note and provide some printing trivia. My online searches for information related to port 9100 and printing through said port turned up sparse. The only reason I knew anything about port 9100 was from pouring over Foomatic’s driver metadata database two summers ago. I think this method might also be known as JetDirect or Direct Print. WIkipedia’s only obvious mention is the port’s official registration as “PDL Data Stream”.
As the official port registration implies that text I mentioned pushing to the printer can in fact have PDL instructions embed.
PDL stands for Page Description Language. This term is related to PCL which stands for Printer Command Language. PCL is not supposed to be a PDL since it allows for printer control. In theory this extra power should make PCL a member of the more general Printer Control Language group. Thus, in theory, when Wikipedia says “PDL Data Stream” the implication is that there is no control granted over the printer itself. In practice printers sometimes treat the PDL sent over port 9100 as commands. I think some HP printer firmware updates get sent this way. The net result has been various security bugs over the years.
The genius of port 9100 is in the pure reality that no other network printing protocol can be simpler. Even printing over UDP would complicate the process by requiring a END_OF_PRINT_JOB instruction. Instead port 9100 treats the TCP’s closure as the submit command.
You can try printing over port 9100 yourself by running from the command line:
$ netcat PRINTER_IP 9100 $ Hello World $ <Ctrl+c>
Hope that helped. I also hope I did not write anything too inaccurate.