Solved

Staircase Printing

Posted on 2000-03-27
13
1,162 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
 
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 20

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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
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 20

Accepted Solution

by:
tfewster earned 200 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 20

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 20

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now