• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1208
  • Last Modified:

Staircase Printing

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
Gtrist
Asked:
Gtrist
1 Solution
 
festiveCommented:
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
 
GtristAuthor Commented:
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
 
kinseyCommented:
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
[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

 
GtristAuthor Commented:
Adjusted points from 100 to 200
0
 
GtristAuthor Commented:
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
 
tfewsterCommented:
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
 
GtristAuthor Commented:
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
 
tfewsterCommented:
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
 
hpmanCommented:
You can also use the ux2dos command.  It does essentially the same as the awk command does, but requires less typing.
0
 
GtristAuthor Commented:
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
 
tfewsterCommented:
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
 
GtristAuthor Commented:
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
 
tfewsterCommented:
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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now