[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Printing to a LaserWriter



At 06.51 -0400 1999.04.28, Sean Carte wrote:
>How would I go about printing to a LaserWriter?
>
>Following the example in _MPPE_, pp108-9, I can print an isosceles
>triangle, but that's it.
>
>Can I only send postscript to the printer using:
>  open(STDOUT, '>Dev:Printer');
>or is there some way I can send ascii text as well?

I don't think the LaserWriter doesn't understand ASCII text.  It needs to
be talked to in some sort of printer language.  I don't know if you can
send something other than PostScript using that method, but it needs to be
a language the printer understands, at least.

However, you can do something like:

#!perl -w
$temp = 'Bourque:Desktop Folder:tempfile';
open(F, "> $temp") or die $!;
print F "my text to print";
close(F);

MacPerl::DoAppleScript <<EOS;
tell app "BBEdit 5.0"
  print alias "$temp"
end
EOS

unlink($temp) or die $!;
__END__


I would prefer, of course:

#!perl -w
use Mac::AppleEvents::Simple;
use Mac::Files;

$temp = 'Bourque:Desktop Folder:tempfile';
open(F, "> $temp") or die $!;
print F "my text to print";
close(F);

do_event(qw(aevt pdoc R*ch), "'----':alis(\@\@)", NewAliasMinimal($temp));

unlink($temp) or die $!;
__END__

In both cases, the point being to write to a temp file, tell another app to
print it, and then unlink the temp file.  BBEdit is an app that seems to do
this well, but many other apps could do it, too.  The only thing that would
change for these apps would be the name in the AppleScript version or the
ID in the perl version, since the aevt/pdoc event is pretty standard.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org