Showing results for 
Search instead for 
Did you mean: 

adding an IP printer to hp ux 11.0 thru sam. we want to get away from jet direct.

Occasional Visitor

adding an IP printer to hp ux 11.0 thru sam. we want to get away from jet direct.

We are trying to clean up our network and I am trying to set up a printer on the network with an ip address that HP UX can access as well as our ERP application.  I have tried using sam but see no way to set up a printer with an ip without using jet direct.  Can you please advise me how to do this?



Bill Hassell
Honored Contributor

Re: adding an IP printer to hp ux 11.0 thru sam. we want to get away from jet direct.

Printers are incredibly stupid with regards to networking. There are just two choices:


-- Connect using port 515 using the archaic remote lpd protocol (see RFC 1179) with no status and no logging. SAM calls this a "remote printer" because it expects it to be attached to a PC and made available (shared) to other computers.


--Connect using port 9100 with the JetDirect tools using HP's proprietary protocol. SAM calls this a "network-based printer" and calls the hppi script to configure the printer.


For many printers (and LAN-based printer server adapters that attach to a non-network capable printer), the only protocol is lpd. In that case, you use the printer through the lp spooler with standard HP-UX lp commands. There are no logs other than lp which simply says that a job started and stopped. There is no trace capability and the lpadmin -t command will hang for a long time for printers that are turned off.


JetDirect tools are far more useful and you can print using the standard lp command or talk directly to the printer with hpnpf. The hpnpf command bypasses the lp spooler completely and talks directly to the printer (or print server). The features of the model scripts (ie, banner pages, adding codes for landscape or portrait, etc) are not there, but you won't be tied to the primitive lp spooler rules such as stopping all printing to add or delete a printer.


Probably the most useful feature of hpnpf is the ability to trace the network interaction with the printer. This ius especially useful if the printer manufacturer can't provide documentation as to whether their network interface works with JetDirect. Simply run hpnpf like this:


# echo "Testing 123" | /opt/hpnpl/bin/hpnpf -x -N -l /tmp/hpnpf.log 

Then look at the logfile. If the printer network code doesn't understand JetDirect, it will hang and you'll have to terminate the program with ctrl-C. If it works, you'll see the handshake in the log file, something like this:


14:37:58 hpnpf[14829]
OpenLog: logging started (/tmp/hpnpf.log)
14:38:01 hpnpf[14829] Process: entered
14:38:01 hpnpf[14829] OpenSocket: entered
14:38:01 hpnpf[14829] OpenSocket: using 16K send buffer
14:38:01 hpnpf[14829] MakeConnection:, port 9100
14:38:01 hpnpf[14829] DoNonBlocking: non-blocking on
14:38:01 hpnpf[14829]   Connection has been set up
14:38:01 hpnpf[14829] connected
14:38:01 hpnpf[14829] Open Input file: stdin
14:38:01 hpnpf[14829] Process: sending file -
14:38:01 hpnpf[14829] SendFile: entered
14:38:01 hpnpf[14829]   SendFile: 13 bytes read from host
14:38:01 hpnpf[14829]   SendFile: 13 bytes written to socket
14:38:01 hpnpf[14829]   SendFile: 0 bytes read from host
14:38:01 hpnpf[14829]   SendFile: end, return succ
14:38:01 hpnpf[14829] DoNonBlocking: non-blocking off
14:38:01 hpnpf[14829] Process: read EOF on socket
14:38:01 hpnpf[14829] StopLog: logging stopped

Now, whether you see anything on the printer is a completely separate story. If the printer supports plain ASCII text then you'll get a page with the "Testing 123" text at the top.



More than 90% of low cost printers (less than $200 US) lack any formatter, the thing that turns the letter A into a series of dot codes which the ink squirter or the laser can put onto the paper. Without this formatter, the printer ignores the text and prints nothing, or perhaps shows an error message on a display. These printers cannot be used with HP-UX as there are no drivers available from HP. The only tools available from HP are scripts that can prepend and postpend characters (typically escape sequences) to control simple things like landscape/portrait or the font size for plain ASCII text.

Now most modern  printers over $200 will support not only the JetDirect protocol but often have a Postscript formatter builtin which simplfies printing as long as the application will send usable Postcript code. Or an application supports PCL (the HP printer language from 30 years ago) and the printer is supported by the application. Note that basic PCL is plain ASCII with optional escape sequences. But in the last few years, PCL 5 and PCL 6 standards have left plain ASCII in the dust of antiquity and now only Windows can actually print to these printers (with appropriate drivers).

So the questions are:

Does your ERP app work with the HP-UX spooler now?
If so, why do you want to change?
If not, can you modify the printing section of the ERP program to use hpnpf directly?
And if so, is the output from the ERP print job compatible with the printer(s) you want to use?

Bill Hassell, sysadmin