NAME
Net::Printer - Perl extension for direct-to-lpd printing.
SYNOPSIS
use Net::Printer;
# Create new Printer Object
$lineprinter = new Net::Printer(
filename => "/home/jdoe/myfile.txt",
printer => "lp",
server => "printserver",
port => 515,
lineconvert => "YES"
);
# Print the file
$result = $lineprinter->printfile();
# Print a string
$result =
$lineprinter->printstring("Smoke me a kipper, I'll be back for breakfast.");
# Get Queue Status
$result = $lineprinter->queuestatus();
DESCRIPTION
Perl module for directly printing to a print server/printer without
having to create a pipe to either lpr or lp. This essentially
mimics what the BSD LPR program does by connecting directly to the
line printer printer port (almost always 515), and transmitting
the data and control information to the print server.
Please note that this module only talks to print servers that
speak BSD. It will not talk to printers using SMB or SysV unless
they are set up as BSD printers.
Parameters
filename - [optional] absolute path to the file you wish to print.
printer - [optional] Name of the printer you wish to print to.
Default "lp".
server - [optional] Name of the server that is running
lpd/lpsched. Default "localhost".
port - [optional] The port you wish to connect to.
Default "515".
lineconvert - [optional] Perform LF -> LF/CR translation.
Default "NO"
Functions
I<printfile> prints a specified file to the printer. Returns a 1 on
success, otherwise returns a string containing the error.
I<printstring> prints a specified string to the printer as if it
were a complete file Returns a 1 on success, otherwise returns a
string containing the error.
I<queuestatus> returns the current status of the print queue. I
recommend waiting a short period of time between printing and
issueing a queuestatus to give your spooler a chance to do it's
thing. 5 seconds tends to work for me.
NOTES
When printing text, if you have the infamous "stair-stepping"
problem, try setting lineconvert to "YES". This should, in most
cases, rectify the problem.
Running with the -w option will cause the interpreter to complain
about a couple of sprintf statements. These can be safely ignored.
AUTHOR
C. M. Fuhrman, cfuhrman@tfcci.com
SEE ALSO
Socket, lpr(1), lp(1), perl(1).