Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing to a Printer through perl

Status
Not open for further replies.

thendal

Programmer
Joined
Aug 23, 2000
Messages
284
Hi all!

Could some one help me in finding a good module for printing to a printer. I tried printer module from cpan. It doesn't have a good documentation. I would like to write a code in such a way irrespective of the OS it should pick up default printer and print the document. i tried the following code in MS .

use Printer;
$prn = new Printer('linux' => 'lp',
'MSWin32' => 'LPT1',
$OSNAME => 'Printer');

$prn->print_command('linux' => {'type' => 'pipe',
'command' => 'lpr -P lp'},
'MSWin32' => {'type' => 'command',
'command' => 'gswin32c -sDEVICE=mswinpr2
-dNOPAUSE -dBATCH $spoolfile'}
);

%available_printers = $prn->list_printers;

$prn->use_default;

$data="this is a Test";

$prn->print($data);


The above code gave me an error

Spool: C:\WINDOWS\TEMP\printer-28880.ps
'gswin32c' not recoginzed as external or internal command

Regards,
T
 
gswin32c is a version of Ghostscript's PS file converter. It looks as though you might not have that program installed.
 
Thanks Rieekan for your response.

Regards,
Thendal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top