Printing in Linux

I have installed RetHat v5.1, I am attempting to configure a local printer.  I believe that I have managed to do so because I can 'cat' text files to /dev/lp1 and 'lpr -PBenFranklin' files (BenFranklin is the printer name) and they print on the printer.  Now, I want to be able to be in Netscape, StarOffice, or some other word processing software (WYSIWYG type) and print to the printer.  I am aware that I most likely will need GhostScript, and it is installed, but I can't seem to get it to print to the printer...
jhaszAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
marcelofrCommented:
lp command will try to print to printer "lp" by default. If you want to change it, just set PRINTER environment variable to the desired printer. Add the following lines to you /etc/profile (for a global definition) or your ~/.bash_profile (it could be your startx script or whereever you think is better):

PRINTER=BenFranklin
export PRINTER

This should do the trick. Anyway most applications support configuring what printer you want ie.: netscape ask you for a "printer command" where you can put "lpr -PBenFranklin"...

Good luck
0
 
jhaszAuthor Commented:
This fails to address the actual question.  Simply setting the PRINTER environment variable will not allow printing a PS based output to my BJC printer.  All the helps do is say, "you need GhostScript" and here are the switches to pass it.  But how does GhostScript get invoked?  What causes the program producing the output to redirect that output to GhostScript? or how does GhostScript grab the output from that program and route it through itself before allowing the job to continue on to the output?  I need to be able to print a presentation quality document on the printer, not just a plain text doc.  Any other ideas?
0
 
marcelofrCommented:
Aren't you using printtool to create the printer? aren't you using the redhat print filter to handle printings?
Ghostcript comes with RH51 and all the funny scripts you need...
0
 
talwynCommented:
Yes you need Ghostscript.  It is invoked via a print filter in your /etc/printcap file.  Below are the files I use to invoke it. Your script will differ in that you will be using an actual printer instead of a samba printer.

  here is an excerpt of mine:
/etc/printcap
qms|lp2:lp=:rm=dewey.texmicro.com:rp=lp:sd=/usr/spool/lpd/qms:sh:if=/usr/spool/lpd/qms/input_file:lf=/usr/spool/lpd/qms/errs
#
smbp|lp:lp=/dev/null:sd=/usr/spool/lpd/smb:mx#0:sh:if=/usr/spool/lpd/smb/input_filter
#
smbw|lp4:lp=/dev/null:sd=/usr/spool/lpd/smb:mx#0:sh:if=/usr/spool/lpd/smb/input_filter4
#
smbps|lp3:lp=/dev/null:sd=/usr/spool/lpd/smb:mx#0:sh:if=/usr/spool/lpd/smb/input_filter2


Note Smbps ... this is my postscript driver for an smbprinter.

here is the script of  /usr/spool/lpd/smb/input_filter2

#!/bin/bash
# NOTE You may wish to add the line `echo translate' if you want automatic
# CR/LF translation when printing.
#echo  Running Lp filter now
#echo --------------------------------------------- >> /tmp/testlp.out
#date                                               >> /tmp/testlp.out
#echo --------------------------------------------- >> /tmp/testlp.out
#cat                                                >>/tmp/testlp.out
cat |/usr/bin/gs -q -sDEVICE=laserjet -r300 -sPAPERSIZE=letter  -sOutputFile=- - |/usr/spool/lpd/smb/input_filter  
#(echo translate
# echo print -
# cat )| /usr/bin/smbclient \\\\tech_serv2\\laserjet_4v  " "  -N -USteven@Mirage -P >> /tmp/printlog


and for completeness here is the filter /usr/spool/lpd/smb/input_filter  which is invoked after ghostscript:

#!/bin/sh
# NOTE You may wish to add the line `echo translate' if you want automatic
# CR/LF translation when printing.
#echo  Running Lp filter now
#echo --------------------------------------------- >> /tmp/testlp.out
#date                                               >> /tmp/testlp.out
#echo --------------------------------------------- >> /tmp/testlp.out
#cat                                                >>/tmp/testlp.out
(echo translate
 echo print -
 cat   )| /usr/bin/smbclient \\\\tech_serv2\\laserjet_4v  " " -UMirage -N -P >> /tmp/printlog

0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
jhaszAuthor Commented:
Answer appears to give me the information which I seek, I'll give it a try.  which lines I needed to pay attention to in the scripts tho, are a little hazy, so this may take me some time to figure out.  I am assuming (and we all know what that does) that it's the ones with gs in them!  and maybe the ones right before and right after.

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.