How to print via GhostScript (was: SUBSCRIBE)


Subject: How to print via GhostScript (was: SUBSCRIBE)
From: Patrik Schindler (poc@pocnet.net)
Date: Thu May 25 2000 - 08:11:17 EDT


At 17:40 Uhr +0000 24.05.2000, Bill Richards wrote:

>My question is printing. We have a few non-PS HP Appletalk printers
>I need to access. I can papstatus them and aecho works fine, so
>we're connected OK.

HP drivers are quite dumb. They try to talk to the printer (or spooler, if set up right with gs), won't get a response and bomb. So you'll have to use a driver which likes Spoolers more: LaserWriter. It generates PostScript, which you must RIP to a bitmap, the printer will understand.

Will someone add this to a FAQ, please?

> I'm having filter problems, though and don't
>quite have my printcap set up right. I've seen several examples
>from the web pages and mail archive, but they all looked like
>PS LaserWriters and such.

It's quite easy.

Step 1: Make PS-Printing from unix work.
Setup: AppleTalk connected printer, unix box with PS-Files.

- Set up printcap (example follows):
dw|HP DeskWriter:\
    :sd=/var/spool/lpd/hpdw:\
    :lp=/dev/null:\
    :of=/usr/local/printerfilter/ps2dj500:\
    :mx#0:sh:

sd is the spooldir, lp is a dummy, because the data will be delivered via the outfilter of and may be discarded afterwards.
For details see printcap(5).

- create the directory as mentioned with the sd tag:
drwxr-xr-x 2 lp lp 1024 May 11 21:36 /var/spool/lpd/hpdw/

Important: chown(1), chgrp(1) the directory to lp!

- create the neccessary information so pap can forward the job to the destination:
cat > /var/spool/lpd/hpdw/.paprc
DWPatrik:DeskWriter@*
^D

Indeed, you need to fill in your own printer. See nbplkup(1) how to acces the exact information of your printer name as well as nbp_name(3) for conventions to nbp-naming. nbp (name binding protocol) is the equivalent to DNS you know from IP.

- create the outfilter as mentioned with the of tag:
#!/bin/sh
trap '' SIGINT
#
DDICT="-dSAFER -dNOPAUSE -dBATCH -dSHORTERRORS -dQUIET"
SDICT="-sPAPERSIZE=a4 -sDEVICE=cdjmono -sOutputFile=-"
OPTS="-q"
#
/usr/bin/gs $OPTS $DDICT $SDICT - |/usr/local/bin/pap -E -e -sstatus
#

See gs(1) for more information about GhostScript options.
Use gs --help to get a list of supported devices (printer driver modules in gs).
See pap(1) for what pap does. -E has been an undocumented parameter in pap:

       -E Close the pap-connection immediately after the job
              has been sent. Don't wait for EOF from the printer.
              (Works around some buggy HP pap implementations).
              WARNING this may break your printer accounting.

- re-start your spooler now:
lpc restart dw

See lpc(8) for details.

Step 2: add spooling from the mac via /usr/local/etc/papd.conf:

DW-Spool:\
    :pr=| lpr -Pdw -h:\
    :op=poc:

- re-start papd to show up the new spooler in your chooser:
kill `ps auxw |fgrep papd |fgrep fgrep | awk '{print $2}'`
/usr/local/sbin/papd

See papd(8) for details.

Voila, there you are with a self-made PS-RIP for your printer. Don't expect good quality results as with the HP-made drivers: They use diffusion dither which gives better results in many cases. GhostScript doesn't support diffusion dither at all (to my knowledge, correct me if I'm wrong).

Perhaps you'll have to fiddle with PPD files for best results. Unfortunately, PPDs are only available for PostScript printers (as *P*ostScript *P*rinter *D*escription states) and it's hard to find somthing appropriate. If I have little spare time, I'll fiddle with a generic PPD...

Hope, that helped.

:wq! PoC



This archive was generated by hypermail 2b28 : Wed Jan 17 2001 - 14:30:48 EST