Date: Thu, 22 May 2003 15:31:21 -0000 From: Malcolm Kay <malcolm.kay@internode.on.net> To: tollallenamensindbelegt@t-online.de, freebsd-questions@freebsd.org Subject: Re: can't print postscript files Message-ID: <200305230101.17038.malcolm.kay@internode.on.net> In-Reply-To: <20030522143851.GA729@lisa.home.net> References: <20030522143851.GA729@lisa.home.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 23 May 2003 00:08, tollallenamensindbelegt@t-online.de wrote: > Hi I, > had configure my /etc/printcap like the example in the freebsd handbook= but > I'm not able to print postscript files I thing I have a little misstak= e in > the gs section in this script /usr/local/libexec/hl7x0 because I can pr= int > plaintext files. > > my printer is a brother HL-730 > > could any one give me the answer where is the misstake that I'm not abl= e to > print ps file. > > thanks!!! > > best regards > > Michael Bohn > > mailto: tollallenamensindbelegt@t-online.de > > > > /etc/printcap > > # > lp|brother730:\ > > :sh:sd=3D/var/spool/lpd/brother730:\ > :lp=3D/dev/lpt0:\ > :if=3D/usr/local/libexec/hl7x0:\ > :df=3D/usr/local/libexec/psdf: > > # > > ################################################################# > > #!/bin/sh > # > # ifhp - Print Ghostscript-simulated PostScript on a DeskJet 500 > # Installed in /usr/local/libexec/hl7x0 > > # > # Treat LF as CR+LF: > # > printf "\033&k2G" || exit 2 > > # > # Read first two characters of the file > # > IFS=3D"" read -r first_line > first_two_chars=3D`expr "$first_line" : '\(..\)'` > > if [ "$first_two_chars" =3D "%!" ]; then > > # It is PostScript; use Ghostscript to scan-convert and print it. > # > # Note that PostScript files are actually interpreted programs, > # and those programs are allowed to write to stdout, which will > # mess up the printed output. So, we redirect stdout to stderr > # and then make descriptor 3 go to stdout, and have Ghostscript > # write its output there. Exercise for the clever reader: > # capture the stderr output from Ghostscript and mail it back to > # the user originating the print job. > # > exec 3>&1 1>&2 > /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=3Dhl7x0 \ > -sOutputFile=3D/dev/lpt0 - && exit 0 'lpd' expects the fifter output on STDOUT which from the exec command=20 comes from the redirected file descriptor 3. So the gs output should be=20 specified -sOutputFile=3D/dev/fd/3 which is another of addressing file=20 descriptor 3. The final destination of /dev/lpt0 comes from printcap. > else > # > # Plain text or HP/PCL, so just print it directly; print a form fe= ed > # at the end to eject the last page. > # > echo "$first_line" && cat && printf "\033&l0H" && > exit 0 > fi > > exit 2 > > #######################################################################= ####
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305230101.17038.malcolm.kay>