Operating System - HP-UX
1752790 Members
6213 Online
108789 Solutions
New Discussion юеВ

Re: Printing from HPUX to a PC using remote

 
SOLVED
Go to solution
Donald Whitaker
Occasional Contributor

Printing from HPUX to a PC using remote

After reading many posts, I was able to print to a Windows Queue, using Print Services for Unix in Windows, but there were posts that warned me that the options passed on a lp -oxxoption command will not work. I was wondering what kind of work around is available. I need to print landscape compressed and I'm wondering how to do this.
Should I put some escape characters on the begining of the file to achieve this, or is there a better way.
5 REPLIES 5
OldSchool
Honored Contributor

Re: Printing from HPUX to a PC using remote

you might be able set up a print queue on the windows box that have those options selected as default, then create a remote printer from unix to the new queue.

the problem is that you will need to print to different queues based on the desired output.

I haven't tried this is several years, so I don't recall if this works or not.

On the other hand, depending upon the printer and interface, you might simply be able to set it up as a regular network printer and bypass windows altogether.
Bill Hassell
Honored Contributor
Solution

Re: Printing from HPUX to a PC using remote

Correct. A remote printer in HP-UX (SysV spooler) cannot do anything with -o options as they are only followed at the remote site -- and windows does not know anything about -o.

The best way to implement this is to print through a filter made out of a model script that matches your destination printer. The lp spooler runs the file through a printer script and prepends escape codes in front of the job to carry out the -o options. Depending on how transparent you want to make this, you can just call a model script directly and supply the required options, and stdout from the script is then sent to the lp command.

Windows just sends the file to the printer as is. While you can play with customizing on the Windows side, it is always the same (always landscape or always 12cpi, etc).

If the model script is too much coding, you can simply prepend the escape sequences using cat:

cat mylandscape.txt somefile | lp

The file mylandscape.txt just has the required codes (one line).


Bill Hassell, sysadmin
Donald Whitaker
Occasional Contributor

Re: Printing from HPUX to a PC using remote

Thank you for your replies.
I couldn't get the dedicated windows queue solution to work.

I was able to build a script to pre and post append escape sequences before sending to lp.

Here is my code that is based on a model script that Bill H. had previously posted:

#!/usr/bin/sh
# Truly dumb model script
export PATH=/usr/bin
export PATH

FILES="$@"
# Print the spooled files
for LPFILE in $FILES
do
# cat "$LPFILE" 2>&1 # replaced by ux2dos command
echo "\033&k2S" # Compress print
ux2dos "$LPFILE" 2>&1
echo "\014\c"
done

This is generally working, except for after the job is finished the printer acts like data is still coming, then it goes to and alarm, then I clear the alarm and nothing else prints. I need that last sequence at the end to force a form feed or the end of my report does not print, but I suspect that it is not pefect. I have exprimented with different esc sequnces but none work any better.

My other concern with this remote printer setup is, that if the remote desktop acting like a print server is not available my lpstat seems to hang. I guess it would eventually time out but I have always cntrl-c out of it. I am running on a HPUX 11.11 and I am thinking of setting up about 20 or more of these print servers, but I am worried that if a few of these devices are not available the lpstat may hang for a significant amount of time. Is there a way to decrease the time out on these devices.

I am using remote printers because the desktops will be VPN into our private network. If I were to use traditional networked printers the remote networked printers would not be tunneled into our private network. Remote printers seemed to be an inexpensive solution, but I am concerned with what unavailabe devices will do to the overall performance, maybe there is a better way of doing this without committing to special hardware at each location?
Bill Hassell
Honored Contributor

Re: Printing from HPUX to a PC using remote

The \014\c is indeed required to force a page feed. The alarm is curious, but it may be an artifact of ux2dos -- the last character for a 'standard' DOS file is the ctrl-Z which may interfere with Windows spooling. You may want to use tr to change LF to CR/LF so the file is clean:

ux2dos /etc/issue | xd -xc
0000000 6870 6433 3730 200d 0a1a
h p d 3 7 0 \r \n 1a
000000a

(the xd -xc displays the hex and ASCII characters as well as all control characters)


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: Printing from HPUX to a PC using remote

Almost forgot:

> lpstat seems to hang

Yep. The SysV lp is archaic and desperately needs a makeover. There isn't any fix at this point because both ends need the code improvements. That's why JetDirect is better (but still not robust for printer conditions). COme to think of it, Windows has a lot of problems with printer hangs too...


Bill Hassell, sysadmin