Operating System - HP-UX
1752570 Members
5281 Online
108788 Solutions
New Discussion

Re: HP unix does not accept lp -olandscape option for a printer?

 
munish259272
Occasional Contributor

HP unix does not accept lp -olandscape option for a printer?

this is what the interface file looks like fro /etc/lp/interface

#!/usr/bin/sh

# /* @(#) $Revision: 72.3 $ */

#Note: These options must be preceded by "BSD" in the option argument.

#   ie.  use "-oBSDh" to suppress banner page.

 

# lp interface for remote spooling.

 

# Options Recognized:

#

#       -C class       Take  the  following  argument   as   a   job

#                      classification for use on the banner page.

#

#       -J job         Take the following argument as the  job  name

#                      to  print  on the banner page.  Normally, the

#                      first file's name is used.

#

#       -T title       Use the next argument as the  title  used  by

#                      pr(UTIL)  instead  of  the  file name.  -T is

#                      ignored unless the -p option is specified.

#

#       -i[numcols]    Cause the output to be indented.  If the next

#                      argument is numeric, it is used as the number

#                      of blanks to be  printed  before  each  line;

#                      otherwise, 8 characters are printed.

#

#       -kfont         Specify a font to be mounted on font position

#                      k, where k is from 1 to 4.

#

#       -wnum          Take the immediately following number  to  be

#                      the page width for pr(UTIL).

#

#       The following single letter options are used to  notify  the

#       line  printer  spooler  that the files are not standard text

#       files.  The spooling system uses the appropriate filters (if

#       the  option  is  supported)  to  print the data accordingly.

#       These options are mutually exclusive.

#

#       -c             The  files  are  assumed  to   contain   data

#                      produced by cifplot.

#

#       -d             The files are assumed to  contain  data  from

#                      tex (DVI format).

#

#       -f             Use  a  filter  that  interprets  the   first

#                      character  of each line as a standard FORTRAN

#                      carriage control character.

#

#       -g             The files are  assumed  to  contain  standard

#                      plot data as produced by the plot routines.

#

#       -l             Use a filter that suppresses page breaks.

#

#       -n             The files are assumed to  contain  data  from

#                      ditroff (device independent troff).

#

#       -p             Use pr(UTIL) to format the files.

#

#       -t             The files are assumed to  contain  data  from

#                      troff (cat phototypesetter commands).

#

#       -v             The files are assumed  to  contain  a  raster

#                      image for devices such as the Benson Varian.

#

#       -k             The files are assumed to contain data from

#                      Kerberized LPR clients and servers.

#

#       -o             The files are assumed to contain Postscript data

#

#       -z             The files are assumed to contain data from

#                      the Palladium print system.

#

#       Other single letter options:

#

#       -h             Suppress the printing of the banner page.

 

 

#

# Test for the filter program

 

printer=`basename $0`

 

if [ ! -x /usr/sbin/rlp ]

then

        disable -r"can't execute /usr/sbin/rlp filter" $printer

        exit 1

fi

 

requestid=$1

 

# Determine which options have been involked.

 

BSDC=""

BSDJ=""

BSDT=""

BSDi=""

BSD1=""

BSD2=""

BSD3=""

BSD4=""

BSDw=""

BSDformat=""

BSDh=""

 

for i in $5

do

 

# remove the BSD from the option.

 

eval ii='`echo $i | sed -e "s/\BSD//g"`'

        case "$i" in

                BSDC*)  # Specify the job classification.

                        BSDC=-$ii

                        ;;

                BSDJ*)  # Specify the job name.

                        BSDJ=-$ii

                        ;;

                BSDT*)  # Specify the title for pr(UTIL) to use.

                        BSDT=-$ii

                        ;;

                BSDi*)  # Cause the output to be indented.

                        BSDi=-$ii

                        ;;

                BSD1*)  # Specify a font for font position 1.

                        BSD1=-$ii

                        ;;

                BSD2*)  # Specify a font for font position 2.

                        BSD2=-$ii

                        ;;

                BSD3*)  # Specify a font for font position 3.

                        BSD3=-$ii

                        ;;

                BSD4*)  # Specify a font for font position 4.

                        BSD4=-$ii

                        ;;

                BSDw*)  # The page width for pr(UTIL).

                        BSDw=-$ii

                        ;;

                BSDc)   # Files contain data produced by cifplot.

                        BSDformat=-$ii

                        ;;

                BSDd)   # Files contain data from tex (DVI format).

                        BSDformat=-$ii

                        ;;

                BSDf)   # Files contain FORTRAN carriage control.

                        BSDformat=-$ii

                        ;;

                BSDg)   # Files contain plot data from plot routines.

                        BSDformat=-$ii

                        ;;

                BSDl)   # Files assume no page breaks.

                        BSDformat=-$ii

                        ;;

                BSDn)   # Files contain data from ditroff.

                        BSDformat=-$ii

                        ;;

                BSDp)   # Use pr(UTIL) to format the files.

                        BSDformat=-$ii

                        ;;

                BSDt)   # Files contain data from troff.

                        BSDformat=-$ii

                        ;;

                BSDv)   # Files contain a raster image.

                        BSDformat=-$ii

                        ;;

                BSDk)   # Files contain Kerberized data.

                        BSDformat=-$ii

                        ;;

                BSDo)   # Files contain Postscript data.

                        BSDformat=-$ii

                        ;;

                BSDz)   # Files contain Palladium print system data.

                        BSDformat=-$ii

                        ;;

nb)     # Suppress the printing of the banner page.
                        BSDh="-h"

                        ;;

                BSDh)   # Suppress the printing of the banner page.

                        BSDh=-$ii

                        ;;

        esac

done

 

shift; shift; shift; shift; shift

 

        /usr/sbin/rlp -I$requestid $BSDC $BSDJ $BSDT $BSDi $BSD1 $BSD2 $BSD3 $BSD4 $BSDw $BSDformat $BSDh $1

ret=$?

case $ret in

0)

        exit 0

        ;;

*)

        reason="error $ret returned"

        ;;

esac

disable -r"$reason" $printer

exit 1

I think this a a BSD interface file  and i dont see an -o option which supports landscape mode.How do i get around this.

Instead -o option according to this interface looks like  

 -o             The files are assumed to contain Postscript data

Please clarify ...or is it possible to add the printer in a differnt way so that it uses system V interface files which could have -olandscape option.

 

4 REPLIES 4
Bill Hassell
Honored Contributor

Re: HP unix does not accept lp -olandscape option for a printer?

Welcome to the Tower of Babel known as printer languages.
In HP-UX, there are two methods for printing: dumb and JetDirect.

The dumb method uses the standard port 515 and is for plain ASCII printers (which are very unusual today).
No font control, no pages-per-page, nothing that can translate plain text into a different format. Think of the dumb printer interface as suitable for a line printer (as in green bar, tractor-fed...). 

In order to rotate the text, the font to be used for the printer must be rotated and scaled in a manner that the printer understands. The printer might understand Epson printer codes or HP's PCL or maybe Postscript but there is no code in the printer script to figure out what to do.  Applications may have printer formatting code and that is sent unmodified to the printer with this primitive script. 

The other printing method uses port 9100, aka the HP JetDirect protocol. If (and only if) your printer understands PCL1,2,3 or 4) will the interface script be able to insert PCL escape sequences into the stream of data that tells the printer how to format the text (landscape, 2 pages per page, etc). Many modern printers including non-HP models understand PCL but in the last several years, inexpensive printers require that the data stream be coverted to a dot image first. In other words, the formatting must take place in the host system. In a PC or Mac, a printer manufacturer's driver will perform this formatting but native HP-UX has nothing for this task.

Another choice is to install the Common Unix Printing System (CUPS) and see if it will work for your printer. You can download the latest HP-UX version here:

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/cups-1.7.1/



Bill Hassell, sysadmin
munish259272
Occasional Contributor

Re: HP unix does not accept lp -olandscape option for a printer?

i am finding HP unix really uncomfortable ...linux  is really easy to work with as far as adding the printers

yes the printer (HP LaserJet Enterprise 700 color MFP M775dn ) supports the pcl,pjl languages.

Whiile searching for the same problem on google and hp forum like  here it says that the interface file should have lines like this

case "$orientation" in
portrait | def)
orientation="portrait"
case "$dividing" in
-h);;
-q) fontdl /usr/lib/lp/fonts/lp4p;;
esac;;
landscape)
case "$dividing" in
-h) fontdl /usr/lib/lp/fonts/lp2l;;
-q) fontdl -l /usr/lib/lp/fonts/lp4l;;
esac;;
esac

unfortunately  i dont find that but instead i find the BSD script options as i mentioned above..

can you show me the steps to add the printer in hp unix so that i get interface script like above so that i can make -olandscape option work.

or are you sugessting that the only way to have such an interface script to install cups to make -olandscape option work.

 

Also you mean if i have the BSD script then it uses port 515 by default..

Bill Hassell
Honored Contributor

Re: HP unix does not accept lp -olandscape option for a printer?

>> linux  is really easy to work with as far as adding the printers

Yep, hasn't changed much in 30+ years.

>> HP LaserJet Enterprise 700 color MFP M775dn

Excellent. This is a midrange multifunction printer and uses a JetDirect interface (port 9100) for communication. (it aso uses port 515 but this is useless for anything except primitive print tasks). Check to see that your system has the directory /opt/hpnpl directory that supports port 9100 printing. If not, download the depot from:

http://h20564.www2.hp.com/hpsc/swd/public/detail?swItemId=ja_6671_1

and use swinstall to add it to your system.

The sysadmin tool SAM (and it's newer replacement SMH) will add the printer, but there are three choices that are very non-intuitive as to which is appropriate. The choices are: local (meaning hardwire serial or Centronics interfaces), Remote (which means port 515 dumb printing), and Network (which is port 9100 using JetDirect-style communication). While SAM/SMH will eventually get things setup, it is cumbersome and prone to unsolvable errors. You can also use the text-based menu script /opt/hpnpl//admin/hppi (which SAM/SMH calls) but as with many easy-admin tools, there are hidden problems that can make the task painful.

So the easiest way to add HP printers is to use /opt/hpnpl/bin/addqueue command line tool. Here's the syntax:

addqueue -h <IP or hostname> -q <queue-name> -r off -t off -b off -i 1000

The -h can be either an IP address or hostname for the printer's network address. NOTE: disable DHCP in the printer! Otherwise, you'll constantly be deleting and adding the printer as the address changes, The other options are in the man page. The -i option needs a bit of background: The command:

addqueue -l

will show all the printers that addqueue can set up. Unfortunately, all of them have been obsolete for more than 10 years. The good news is that the model scripts are generic enough to support anything that supports PCL 4 and lower. NOTE: PCL was 'enhanced' starting with PCL5e such that previous plain ASCII with enhancements no longer works. This was several years ago and renders the term "PCL-compatible" almost useless. So if the printer can print a plain ASCII file with port 515, then it will work with the generic printer PCL model script net_lj4x

 This 1-liner gets your printer added. Test with something like:

lp -dqueue_name -olandscape /etc/profile

And to see all the options for printing, you can add the -ooptions to the lp command:

lp -dqueue_name -ooptions /etc/profile

Lots of choices.

NOTE: Running addqueue requires that the spooling system be stopped and then restarted. This is only an issue where there are many printers, some actively printing. The stop/start task will restart any active print jobs from the beginning.

One last note: The hpnp setup places a generic network script in /usr/spool/lp/interface (or the linked directory /etc/lp/interface for newer versions of HP-UX). This script calls the formatting script in the JetDirect subdirectory model.orig. The script will be a copy of net_lj4x renamed with the print-queue name.

And for detailed troubleshooting, you can use hpnpf, the port 9100 network program that communicates with the printer. There is a man page for hpnpf and you can print (without any format controls) a test file:

hpnpf -x <IP or hostname> -N /etc/profile

But really useful is to trace the protocol with a logfile:

hpnpf -x <IP or hostname> -N -l /tmp/hpnpf.log /etc/profile

While the above works with your printer, there are dozens of HP printer models that will never work with HP-UX. These are essentially dot printers, meaning that the printer cannot print plain ASCII at all. The data stream must be a stream of dots formatted in the host system (often called host-based printers) and is why PC drivers for these printers are massive in size. Even Linux tools like CUPS struggle with the endless incompatible formats for these cheap inkjet and laser printers. The reason is simple: The non-PC printer market (ie, *nix flavors) is microscopic. The latest version of hpnp software for HP-UX was released in 2002. 

 

 



Bill Hassell, sysadmin
Steven Schweda
Honored Contributor

Re: HP unix does not accept lp -olandscape option for a printer?

> [...] NOTE: disable DHCP in the printer! Otherwise, you'll constantly
> be deleting and adding the printer as the address changes, [...]

   Or else configure your DHCP server to provide a particular (fixed)
address to the printer (according to the printer's MAC address).