gopalr has asked for the wisdom of the Perl Monks concerning the following question:

I try to get printout by using perl script. I write the coding. But its getting an error

use Net::Printer; # Create new Printer Object $lineprinter = new Net::Printer( filename => 'c:\temp\test.txt', printer => 'Apple LaserWriter II + NTX v51.8', server => '172.16.8.9', port => 'IP_172.16.8.9', lineconvert => 'YES' ); # # Print the file $result = $lineprinter->printfile();

Error

ERROR:Net::Printer[145]: Could not connect to printer: Unknown error
Could u pls guide me

Replies are listed 'Best First'.
Re: Net::Printer Error
by jbrugger (Parson) on Feb 24, 2005 at 06:44 UTC
    Could be a load og things.
    Is the printer shared properly, or do you have to be logged in into the network to be able to print to the printserver?

    You write port => 'IP_172.16.8.9', I've never heard of such a printerport. i expect to see there something like port => '515',

    Can you print to the printer using the computer you're on?

    etc.etc.

    Update: You should find out the proper port the server is listening on, 515 was just an example

      Hi jbrugger

      I can able to print the file in any application, but problem only occur in script.

      when I changed the port to 515 the following erros is showing:

      Use of uninitialized value in sprintf at e:/Perl/site/lib/Net/Printer. +pm line 742.