Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing in Linux

Posted on 1998-10-11
5
Medium Priority
?
232 Views
Last Modified: 2010-03-18
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...
0
Comment
Question by:jhasz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:marcelofr
ID: 1587157
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
 

Author Comment

by:jhasz
ID: 1587158
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
 
LVL 3

Expert Comment

by:marcelofr
ID: 1587159
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
 
LVL 1

Accepted Solution

by:
talwyn earned 150 total points
ID: 1587160
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
 

Author Comment

by:jhasz
ID: 1587161
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

Featured Post

Google Certified Professional - Cloud Architect

This course (1 of 3) is designed to help students who are interested in Google Cloud Platform (GCP) to become familiar with the platform, navigate the console and learn its capabilities. It will also prepare students for the Google Cloud Architect certification exam.

Question has a verified solution.

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

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

722 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