printing postscript files on Epson Stylus C64(xefitra)

Matthew Seaman m.seaman at infracaninophile.co.uk
Mon Apr 19 10:30:16 BST 2004


--dFWYt1i2NyOo1oI9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Apr 19, 2004 at 08:48:49AM -0000, Moloney, Gerard wrote:

> #!/bin/sh
> #
> #  ifhp - Print Ghostscript-simulated PostScript on a DeskJet 500
> #  Installed in /usr/local/libexec/ifhp
> #
> #  Treat LF as CR+LF:
> #
> #printf "\033&k2G" || exit 2 //removed GM
> #
> #  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

Shouldn't there be an:

      echo "$first_line" &&

here? =20

>     /usr/local/bin/gs -dSAFER -dNOPAUSE -q -sDEVICE=3Depson \
>         -sOutputFile=3D/dev/fd/3 - && exit 0
> else
>     #
>     #  Plain text or HP/PCL, so just print it directly; print a form feed
>     #  at the end to eject the last page.
>     #
>     echo "$first_line" && cat && printf "\033&l0H" &&=20
> exit 0
> fi
> exit 2


Otherwise gs won't see the '%!' line.  Failing that, you could try the
print/apsfilter port which provides quite a number of print filters of
exactly this type.

	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

--dFWYt1i2NyOo1oI9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAg5wndtESqEQa7a0RAgPfAJ9jKxlBFJXEqoAXJHAN+pVbiwiaXwCgh09D
xp3pe8RX1r+De/hXLfXZ9pY=
=2u1w
-----END PGP SIGNATURE-----

--dFWYt1i2NyOo1oI9--




More information about the Ukfreebsd mailing list