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

Re: [MacPerl] Printing to a printer?



At 00.47 -0400 1999.05.02, firebug@apk.net wrote:
>I have a LaserWriter 300 connected to the printer port and I would like to
>print to it.
>
>I tried this:
>
>open( PRINTET, '>Dev:Printer');
>$str = "This is a Test...";
>print $str;
>print PRINTET $str;
>
>and it crased MacPerl with a type 10 error.
>
>Is there some other way I can print $str on my printer?

Are you new to the list?  We just discussed this last week.

First, I am not sure you can send anything but PostScript to the printer
this way.  I know for a fact you cannot send plain text.  Printers speak
languages, and plain text is not one of them.

Second, the LaserWriter 300 doesn't exist, as far as I can tell.  :)  There
is the Personal LW 300 and the LW Select 300.  Neither of these speaks
PostScript, so you cannot send PostScript to them.  I do not know if you
can send QuickDraw (the language these printers speak) directly to
Dev:Printer the way you can with PostScript.

The best way to send plain text is probably using AppleScript or Apple
events to tell another program to print the text.  The message I sent last
week follows.


> X-Authentication-Warning: cfcl.com: majordom set sender to
> owner-macperl@macperl.org using -f
> X-Sent-To: <macperl@macperl.org>
> Mime-Version: 1.0
> X-Sender: pudge@pop.ply.adelphia.net
> Date: Wed, 28 Apr 1999 09:26:39 -0400
> To: Sean Carte <SeanC@mediatek.co.za>
> From: Chris Nandor <pudge@pobox.com>
> Subject: Re: [MacPerl] Printing to a LaserWriter
> Cc: "MacPerl" <macperl@macperl.org>
> Sender: owner-macperl@macperl.org
> Precedence: bulk
> Status:
>
> 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

--
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