Subject: Re: [netatalk-admins] Here is a lpd filter for landscape printing via Ghostscript

From: Ortwin Gentz <[email-masked]>
Date: Fri, 4 Sep 1998 22:54:01 -0000

On 29.11.1997 14:58 Uhr Marc Liyanage <[email-masked]> wrote:

>I wrote a short Perl script that can be used as a filter for lpd
>in order to reliably rotate pages that need to printed in landscape mode.
>
>It seems to work with PostScript files generated by the Adobe PSPrint
>and Apple LaserWriter 8 printer drivers, received via papd.
>I am using it with a Stylus Color 600 printer.
>
>
>It can be found at
>
>http://www.access.ch/ml/unix/macpsfilter.pl
>
>
>
>Email me if you have problems using it or if you'd like
>to send me comments.

Your script is fine! However it didn't work with MacOS 8.1's
TCP/IP printing. The problem is that papd automatically converts
Mac-CR into UNIX-LF but the direct TCP/IP printing not.

It's not a problem for Perl because we can set the line delimiter
via the builtin variable $/. The only problem is to determine
from where the script was started. Since papd normally runs as
root the -n switch is set to root when the request came from papd.
Otherwise -n is the Mac username.

So this code pasted in at the beginning of the script does the job:

if ($ARGV[4] ne "root") {
        $/="\r";
}

Have fun,

Ortwin

__________________________________
Ortwin Gentz      [email-masked]
              http://www.gentz.com
Public-Key:
http://keys.pgp.com:11371/pks/lookup?op=get&search=[email-masked]