2009/12/16 Jon Bjornstad <[email protected]>
>
> Esteemed Perl-Win32 people,
>
> How do I send a plain ASCII text file to the default printer
> from a Perl program?
>
> Win32::Printer has been discontinued (or so says CPAN)
> and as far as I know it is not available from activestate.com for Perl
> 5.10.
>
> I need to do this from XP, Vista, and beyond.
>
> Failing a CPAN module is there a way to have my script invoke
> notepad.exe
> and send it the keystrokes to have it do the print for me?
>
> Thank you very much!
> Jon
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


The documentation on CPAN may be a little misleading.

I can confirm the following works for me:-

C:\Perl\Programs>ppm search Win32-Printer
Downloading ActiveState Package Repository packlist...not modified
Downloading bribes packlist...not modified
Downloading trouchelle packlist...done
Updating trouchelle database...done
Downloading uwinnipeg packlist...not modified
1: Win32-Printer
   Perl extension for Win32 printing
   Version: 0.9.1
   Repo: bribes

2: Win32-Printer
   Perl extension for Win32 printing
   Version: 0.9.1
   Released: 2008-04-28
   Repo: ActiveState Package Repository

C:\Perl\Programs>ppm install Win32-Printer
Downloading ActiveState Package Repository packlist...not modified
Downloading Win32-Printer-0.9.1...done
Unpacking Win32-Printer-0.9.1...done
Generating HTML for Win32-Printer-0.9.1...done
Updating files in site area...done
  11 files installed

C:\Perl\Programs>perl -MWin32::Printer
my $dc = new Win32::Printer(
                                papersize       => A4,
                                dialog          => NOSELECTION,
                                description     => 'Hello, Mars!',
                                unit            => 'mm'
                            );

 my $font = $dc->Font('Arial Bold', 24);
 $dc->Font($font);
 $dc->Color(0, 0, 255);
 $dc->Write("Hello, Mars!", 10, 10);

 $dc->Brush(128, 0, 0);
 $dc->Pen(4, 0, 0, 128);
 $dc->Ellipse(10, 25, 50, 50);

 $dc->Close();
^D

C:\Perl\Programs>



HTH

Just in
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to