Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Staircase Printing

Posted on 2000-03-27
13
Medium Priority
?
1,201 Views
Last Modified: 2013-12-05
I have a SCO OpenServer 5.0.5 server connected as a member server in a Windows NT4 domain. When I print from the Unix server to a printer on the NT network, I get a staircase output. I can eliminate the staircase output by forcing an add CR to LF at the HP laserjet control panel. However, I also deal with printers that don't have that option and I would like a fix that will work for any/all printers. I have printers that only exist on the Unix server, and I don't have the problem on those printers... only the NT laser printer.
0
Comment
Question by:Gtrist
13 Comments
 
LVL 2

Expert Comment

by:festive
ID: 2663126
you can manually alter/edit the printer interface file for the printer in question on the sco system, adding a sed, tr command (or alike) to translate cr to cr/lf.

hope this helps.
0
 
LVL 4

Author Comment

by:Gtrist
ID: 2664825
I need a little more information than that. The printer in my network is a hp4000tn, and I have tried to edit the file
/usr/spool/lp/admins/lp/interfaces/hp4000tn
to add a -N to the line
"if $REALMODEL "$@" | $HPNPF -x $PERIPH 2> $LOG > /dev/null
as indicated in an article at aplawrence.com, but that didn't help. So far the only thing I have been able to do it the add CR to LF option on the printer itself. But, as I said, I need something that will work for all printer models.
0
 
LVL 3

Expert Comment

by:kinsey
ID: 2664973
The cleanest thing for HP printers is to connect the hp4000tn directly to the network and use HP's jetdirect software.
Software is avalable free for all versions of windows and included with SCO.
Other options are using Samba on the SCO box to print to NT/Windows shared printers or installing print filters if using lpd printing.

If you are already using jetdirect (as your second post implies) do NOT use the -oraw option on lp.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Author Comment

by:Gtrist
ID: 2667589
Adjusted points from 100 to 200
0
 
LVL 4

Author Comment

by:Gtrist
ID: 2667590
I have one printer set up on the Unix network that is using the HP software for configuration, and it is working just fine. It's the HP laserjet on the NT network that I need to get working reliably.
I am using LPD for the NT printer, and it is using the same interface file as the printer on the Unix server. That printer works great. I am open to a filter, but I am not sure how to create one that will do the job.
One last note, the application we use doesn't give you any option to redirect the print. You tell it you want to print to a specified printer and thats the last control you have.
0
 
LVL 21

Expert Comment

by:tfewster
ID: 2670355
Apologies if this is a double post - EE is a bit weird today :)

As festive said, you can modify the file "on the fly" to change LF to CR/LF

awk '{print $0,"\r"}' < inputfile > newfile will add the CR; The awk
construct can be used in pipe, rather than with i/o redirection, e.g.
echo ${file} | awk '{print $0,"\r"}' | ${printer}

The problem is how to insert this in a printer interface; This is highly
OS and printer dependent :(

In the line you showed from the hp4000tn interface script, the filename(s)
are passed to the REALMODEL  (which will be a standard script for most HP
LJ models), with all parameters "$@";

We need to extract the filenames & use the names to find & convert the
files themselves;

[You'll need to test this, by echoing $@, but assuming $@ expands to
jobno user title no_copies options file1 file2...]

 .
 .
 allparameters="$@"
 shift; shift; shift; shift; shift
 filenames="$*"

 for f in $filenames
 do
  awk '{print $0,"\r"}' < $f > /tmp/file_with_cr
  mv /tmp/file_with_cr $f
  # It would be better to test that the files aren't PostScript
  # before converting them!
 done
 .
 .
 $REALMODEL $allparameters | $HPNPF -x $PERIPH 2> $LOG > /dev/null
 .

If "$@" is used anywhere else in that script, it will need to be changed
to $allparameters.


You'll need a similar technique for other printer types - Unless kinsey has a better way, with filters :)



0
 
LVL 4

Author Comment

by:Gtrist
ID: 2680815
Can you explain more about your script. I don't have any scripting experience so I'm not sure about what you are suggesting.
0
 
LVL 21

Accepted Solution

by:
tfewster earned 600 total points
ID: 2681593
Ouch! Trying to rewrite a complex script I can't see, on an OS I don't have access to - kinsey, festive, ANYONE -  feel free to jump in here!

1st thing is to check what parameters are being passed to the printer interface script; "$@" is the whole parameter list, so if you put a line
echo "$@" > /tmp/all_parameters
in the interface script just before the $REALMODEL line, it will save the list to a temporary file when you send something to that printer; Hopefully the contents of that temporary file will be recognisable as a job request, username etc, ending up with one or more filenames to be printed.

 .
 .
 # Save the original parameter list
 allparameters="$@"
 # Discard the first 5 parameters passed
 # to the script with the 5 x  
 # the "shift" command
 shift; shift; shift; shift; shift
 # Set variable "filenames" to = whats
 # left of the parameter list
 filenames="$*"

 # For each filename in the list
 for f in ${filenames}
 do
  # convert each file
  awk '{print $0,"\r"}' < $f > /tmp/file_with_cr
  mv /tmp/file_with_cr $f
  # It would be better to test that the files aren't PostScript
  # before converting them!
 done
 .
 .
 # Pass the ORIGINAL parameter list to
 # HPNPF
 if $REALMODEL ${allparameters} | $HPNPF -x $PERIPH 2> $LOG > /dev/null
 .

If "$@" is used anywhere else in that script, it will need to be changed
to ${allparameters}. Note the {} I've added - good practice with weird variables.

I hope this helps, but if you're really not comfortable with hacking shell scripts, I suggest you try kinseys ideas.

STOP PRESS: Reading the tips at http://www.aplawrence.com/Unixart/printing.html#stairs 
I suspect you may have to modify the script in /usr/spool/lp/admins/lp/interfaces/model.orig/ (see the first section of the aplawrence article) and add the -n option there.

In the script you've been looking at, check what REALMODEL gets set to, to find the name of the script in model.orig you need to modify.

You could also try changing "/dev/null" to "/tmp/junk", and see if anything gets written to /tmp/junk, as proof that that line of the script IS actually getting used.

Good luck, Tim


0
 

Expert Comment

by:hpman
ID: 2701940
You can also use the ux2dos command.  It does essentially the same as the awk command does, but requires less typing.
0
 
LVL 4

Author Comment

by:Gtrist
ID: 2735509
I'm sorry that I haven't been keeping up with this question. I have been on the road for a couple of weeks, and I probably won't have time to work with this for a couple more weeks.
0
 
LVL 21

Expert Comment

by:tfewster
ID: 2827724
Hi Gtrist - I'm not being pushy, just keeping the question alive so it doesn't get autodeleted :)

Have you had a chance to look at changing the model.orig file according to the tip at aplawrence yet? IMO that would be the most elegant solution.
0
 
LVL 4

Author Comment

by:Gtrist
ID: 2834129
I have decided to accept your answer to clear this question. I haven't actually had much time to deal with this issue so I haven't thoroughly tested your answer. At the moment, this issue has become a low priority. If it becomes a high priority again, I may post another question on this topic.
Thanks one and all for your comments.

Norm
0
 
LVL 21

Expert Comment

by:tfewster
ID: 2943078
Gtrist, kinsey, festive: weeph needs your help on setting up networked lasers on SCO in:
http://www.experts-exchange.com/bin/Show.10382156

I'm sure you can help ;)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question