From owner-freebsd-questions@FreeBSD.ORG Thu May 22 08:31:21 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 898C937B40F for ; Thu, 22 May 2003 08:31:21 -0700 (PDT) Received: from smtp0.adl1.internode.on.net (smtp0.adl1.internode.on.net [203.16.214.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5BF8043F3F for ; Thu, 22 May 2003 08:31:20 -0700 (PDT) (envelope-from malcolm.kay@internode.on.net) Received: from beta.home (ppp1969.sa.padsl.internode.on.net [150.101.26.176]) h4MFVHMO051087; Fri, 23 May 2003 01:01:18 +0930 (CST) Content-Type: text/plain; charset="iso-8859-1" From: Malcolm Kay Organization: At home To: tollallenamensindbelegt@t-online.de, freebsd-questions@freebsd.org User-Agent: KMail/1.4.3 References: <20030522143851.GA729@lisa.home.net> In-Reply-To: <20030522143851.GA729@lisa.home.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305230101.17038.malcolm.kay@internode.on.net> Subject: Re: can't print postscript files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Thu, 22 May 2003 15:31:21 -0000 X-Original-Date: Fri, 23 May 2003 01:01:17 +0930 X-List-Received-Date: Thu, 22 May 2003 15:31:21 -0000 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 > > #######################################################################= ####