Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!spool.mu.edu!news.sol.net!newspump.sol.net!newsfeeder.sdsu.edu!chi-news.cic.net!nntp.coast.net!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!info.ucla.edu!unixg.ubc.ca!van-bc!n1van.istar!van.istar!west.istar!ott.istar!istar.net!news.nstn.ca!coranto.ucs.mun.ca!news.unb.ca!usenet From: Peter Howlett <Peter.Howlett@ASG.unb.ca> Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Printer filter file error Date: Tue, 16 Jul 1996 20:55:55 +0000 Organization: Atlantic Systems Group Lines: 382 Message-ID: <31EC01DB.41C67EA6@ASG.unb.ca> References: <4sd8g1$ruk@slowmo.techfak.uni-kiel.de> <31EB1D42.493B@www.play-hookey.com> <31EBDBEE.167EB0E7@ASG.unb.ca> NNTP-Posting-Host: 198.164.16.51 Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------446B9B3D2781E494167EB0E7" X-Mailer: Mozilla 2.02 (X11; I; FreeBSD 2.1.0-RELEASE i386) This is a multi-part message in MIME format. --------------446B9B3D2781E494167EB0E7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Peter Howlett wrote: > I have another interesting question though... I have a print file > created with ghostscript (cdj550 driver) that I can send to my > deskjet 680c from dos with no problem. When I boot FreeBSD (2.1) > the file gets queued, then sits for a while, then spits out a blank > page (with 5 or 10 random chars at the top), then sits for a while > longer (1/2 to 1 hour for a full one page of text converted from > postscript text) then proceeds to print the page _very_ slowly. Seems I have my own thread going here 8-). I found the lptcontrol program and did an lptcontrol -p to put the driver in poll mode. This fixed my time of printing problem. My second problem was the daemon trying to print a burst page without a form feed definition. I put a :sh in the printcap and fixed this problem. For those with filter questions, I have adapted a generic filter program I found from a fellow named Jeff Stern in May 1994. I hope he wont mind if I repost his original note. It was originally written for a deskjet500. You may need to change the paths for ghostscript and dvips for printing postscript and dvi files respectively. The note is attached. -------------------------------------------------------------------- Peter Howlett Atlantic Systems Group E-Mail: Peter.Howlett@ASG.unb.ca Fredericton, N.B. Canada http://www.ASG.unb.ca/personal/ph.html Phone: (506) 447-3050 PGP Key ID: 60F2EEC1 Fax: (506) 453-5004 --------------446B9B3D2781E494167EB0E7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="djfilter" From news.unb.ca!torn!howland.reston.ans.net!cs.utexas.edu!swrinde!ihnp4.ucsd.edu!news.service.uci.edu!jstern Wed May 18 20:57:28 1994 Path: news.unb.ca!torn!howland.reston.ans.net!cs.utexas.edu!swrinde!ihnp4.ucsd.edu!news.service.uci.edu!jstern From: jstern@eclectic.ss.uci.edu (Jeff Stern) Newsgroups: comp.windows.x.i386unix,comp.os.linux.help Subject: Re: Printing Postscript in Linux using HP500C Date: 17 May 1994 18:59:45 GMT Organization: University of California, Irvine Lines: 325 Message-ID: <2rb471$rcs@news.service.uci.edu> References: <1994May14.044139.832@uxmail.ust.hk> NNTP-Posting-Host: eclectic.ss.uci.edu X-Newsreader: TIN [version 1.2 PL2] Xref: news.unb.ca comp.windows.x.i386unix:2039 comp.os.linux.help:13129 In article <1994May14.044139.832@uxmail.ust.hk> Wong Yuk wrote: >Hi, >Can anyone tell me how can I print postscript file in Linux using >HP500C ?? I have read some docs. and it says 'gs -sDEVICE=cdeskjet (or >dj500 ..) -sOutputFile=lpr(or /dev/lp1 ..) *.ps' should work, but >after I key in the above command, gs stopped after initialization and >doesn't print anything. I am sure this is not a problem of hardware >since I can print using lpr or djscript without any problem. So what >should I do inorder to print .ps file ? >eric Hi, Eric.. Well, I have mine already configured into lpr, and I just lpr filename.ps (see below for more specs on this, though) The lpfilter determines what kind of file it is, and if it determines that it is postscript, it calls the gs command automatically. (If you still want to do it manually, just look at the lpfilter more carefully, and you'll see how it calls gs. Here's my /etc/printcap and /usr/lib/lpfilter that I use. By the way, the printer is connected to the parallel port. I originally got this from Andreas Klemm, and then modified it. Further, I use two lpfilters, depending on whether I know the file to be monochrome (and therefore use the black ink cartridge) or color. I did it together as one file before, and it *did* work, but sometimes it would want to print out a monochrome file (say, a simple letter) using the color cartridge, which, as you know, is much slower, and is not perfectly black anyway. So this way, I can manually force it: Most files are just letters/papers/monochrome, so I just type: lpr -Plp1 file Actually, now, the *default* is monochrome (lp1) so, I just have to type: lpr file But, if I *know* something is color, I replace the cartridge and type: lpr -Plp2 file Of course, with a 550C, this would be unnecessary. These lpfilters will print regular text, mail, postscript, dvi, and even binary files, if you want.. You can add more, too, if you like.. Good luck! =====/etc/printcap============================================================= lp|lp1|lpmono:lp=/dev/lp1:sd=/usr/spool/lp1:if=/usr/lib/lpfilter.mono:\ :mx#0:lf=/usr/adm/lpd-errs:ff=\033E\033&k2G\033&a10L:fo lp|lp2|lpcolor:lp=/dev/lp1:sd=/usr/spool/lp1:if=/usr/lib/lpfilter.color\ :mx#0:lf=/usr/adm/lpd-errs:ff=\033E\033&k2G\033&a10L:fo #serlp:lp=/dev/ttyS0:sd=/usr/spool/serlp:mx#0:of=/usr/lib/hpof:\ # lf=/usr/adm/lpd-errs:br#9600:fc#65535:cs#020000000060:\ # cc04700:pw#80 =====/usr/lib/lpfilter.mono==================================================== #!/bin/bash TmpDir=/usr/tmp TmpFile=$TmpDir/deskjetof.$$ NOTIFY=root cat - > $TmpFile set -- `file $TmpFile` shift FileType=$1 #echo $FileType | cat > /root/ft case $FileType in ascii|English|script|news|mail|c) # print normal text with # - cr/nl conversion # - letter quality # - 66 lines/page # - left margin # - 12 cpi pitch # # LINE TERMINATION \E & k # G # 0 = CR=CR ; LF=LF ; FF=FF (default) # 1 = CR=CR+LF; LF=LF ; FF=FF # ** 2 = CR=CR ; LF=CR+LF; FF=CR+FF # 3 = CR=CR+LF; LF=CR+LF; FF=CR+FF echo -ne '\033&k2G' # QUALITY \E ( s # Q # 1 = draft = 240cps # ** 2 = letter = 120cps (default) echo -ne '\033(s2Q' # Text Scale Mode \E & k # W # 5 = off (default) # 6 = on # ignored in landscape mode echo -ne '\033&k5W' # Perforation Skip Mode \E & l # L # 0 = off = 0.0 in Top Margin # 1 = on = 1/2 in Top Margin (default) echo -ne '\033&l1L' # Left Margin \E & a # L # # Valu^ = column number # default = 0 = 1/8 in left margin # used = 7 for 1" left margin echo -ne '\033&a7L' # Pitch \E ( s # H # # = cpi # default = 10 characters per inch # ** 12 cpi echo -ne '\033(s12H' # print tmp file /bin/cat $TmpFile # flush all pages echo -e -n '\033*s1F' ;; PostScript*) # # pipe ps data through ghostscript # /bin/cat $TmpFile \ | /usr/bin/gs -q \ -sDEVICE=djet500 \ -r300x300 \ -dNOPAUSE \ -dSAFER \ -sOutputFile=- \ - \ /usr/local/lib/ghostscript/quit.ps \ || echo -ne '\033&l0H' # ^ if an error occurs, then # | eject already loaded paper ;; *data*) # # print binary files # # LINE TERMINATION \E & k # G # ** 0 = CR=CR ; LF=LF ; FF=FF (default) # 1 = CR=CR+LF; LF=LF ; FF=FF # 2 = CR=CR ; LF=CR+LF; FF=CR+FF # 3 = CR=CR+LF; LF=CR+LF; FF=CR+FF echo -ne '\033&k0G' # print tmp file /bin/cat $TmpFile ;; DVI) # # TeX dvi file -> dvips -> gs # /usr/TeX/bin/dvips -f $TmpFile \ | /usr/bin/gs -q \ -sDEVICE=djet500 \ -r300x300 \ -dNOPAUSE \ -dSAFER \ -sOutputFile=- \ - \ /usr/local/lib/ghostscript/quit.ps \ || echo -ne '\033&l0H' # ^ if an error occurs, then # | eject already loaded paper ;; *) # # Rest is an unknown file type ...... sorry ;-) # echo "deskjetof: unknown filetype $FileType" > /dev/console echo "deskjetof: $TmpFile: unknown filetype $FileType" \ | mail $NOTIFY NotOk=1 ;; esac # # keep print job, that couldn't be printed because of errors.... # if [ ! "$NotOk" = "1" ] then rm -f $TmpFile fi # # reset printer to power on values after print job # echo -ne '\033E' =====/usr/lib/lpfilter.color=================================================== #!/bin/bash TmpDir=/usr/tmp TmpFile=$TmpDir/deskjetof.$$ NOTIFY=root cat - > $TmpFile set -- `file $TmpFile` shift FileType=$1 #echo $FileType | cat > /root/ft case $FileType in ascii|English|script|news|mail|c) # print normal text with # - cr/nl conversion # - letter quality # - 66 lines/page # - left margin # - 12 cpi pitch # # LINE TERMINATION \E & k # G # 0 = CR=CR ; LF=LF ; FF=FF (default) # 1 = CR=CR+LF; LF=LF ; FF=FF # ** 2 = CR=CR ; LF=CR+LF; FF=CR+FF # 3 = CR=CR+LF; LF=CR+LF; FF=CR+FF echo -ne '\033&k2G' # QUALITY \E ( s # Q # 1 = draft = 240cps # ** 2 = letter = 120cps (default) echo -ne '\033(s2Q' # Text Scale Mode \E & k # W # 5 = off (default) # 6 = on # ignored in landscape mode echo -ne '\033&k5W' # Perforation Skip Mode \E & l # L # 0 = off = 0.0 in Top Margin # 1 = on = 1/2 in Top Margin (default) echo -ne '\033&l1L' # Left Margin \E & a # L # # Valu^ = column number # default = 0 = 1/8 in left margin # used = 7 for 1" left margin echo -ne '\033&a7L' # Pitch \E ( s # H # # = cpi # default = 10 characters per inch # ** 12 cpi echo -ne '\033(s12H' # print tmp file /bin/cat $TmpFile # flush all pages echo -e -n '\033*s1F' ;; PostScript*) # # pipe ps data through ghostscript # /bin/cat $TmpFile \ | /usr/bin/gs -q \ -sDEVICE=djet500c \ -r300x300 \ -dNOPAUSE \ -dSAFER \ -sOutputFile=- \ - \ /usr/local/lib/ghostscript/quit.ps \ || echo -ne '\033&l0H' # ^ if an error occurs, then # | eject already loaded paper ;; *data*) # # print binary files # # LINE TERMINATION \E & k # G # ** 0 = CR=CR ; LF=LF ; FF=FF (default) # 1 = CR=CR+LF; LF=LF ; FF=FF # 2 = CR=CR ; LF=CR+LF; FF=CR+FF # 3 = CR=CR+LF; LF=CR+LF; FF=CR+FF echo -ne '\033&k0G' # print tmp file /bin/cat $TmpFile ;; DVI) # # TeX dvi file -> dvips -> gs # /usr/TeX/bin/dvips -f $TmpFile \ | /usr/bin/gs -q \ -sDEVICE=djet500c \ -r300x300 \ -dNOPAUSE \ -dSAFER \ -sOutputFile=- \ - \ /usr/local/lib/ghostscript/quit.ps \ || echo -ne '\033&l0H' # ^ if an error occurs, then # | eject already loaded paper ;; *) # # Rest is an unknown file type ...... sorry ;-) # echo "deskjetof: unknown filetype $FileType" > /dev/console echo "deskjetof: $TmpFile: unknown filetype $FileType" \ | mail $NOTIFY NotOk=1 ;; esac # # keep print job, that couldn't be printed because of errors.... # if [ ! "$NotOk" = "1" ] then rm -f $TmpFile fi # # reset printer to power on values after print job # echo -ne '\033E' =============================================================================== --------------446B9B3D2781E494167EB0E7--