Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Printing with a Win32 printer

by mdog (Pilgrim)
on Nov 27, 2001 at 05:06 UTC ( [id://127684]=perlquestion: print w/replies, xml ) Need Help??

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

OK...So I need to be able send a print request from a Win32 box to a printer hooked up to Win32 network.

I need to be able to do this via perl or even a utility that I could call via a system call. A quick scan of the available Win32 modules has yielded nothing so far and the same goes for perl monks.

It looks like someone else had this question:
but never got a workable answer.

Anybody know of a way?


I'm off to scour the Internet to see if there is any pertinent info.

Replies are listed 'Best First'.
Re: Printing with a Win32 printer
by traveler (Parson) on Nov 27, 2001 at 05:43 UTC
    I just used this code:
    open PRINTER, ">//SERVER/PRINTER"; while(<>){ print PRINTER $_; }
    where SERVER is the name of the computer with the printer and PRINTER is the name of the printer (s/k/a "sharename"). The program above is the "poor person's lpr" :-).

    HTH, --traveler

Re: Printing with a Win32 printer
by osfameron (Hermit) on Nov 27, 2001 at 05:10 UTC
    I think print /d:\\server\printer filename from the Win32 command line should do for text documents.


      Just found an alternative answer as well:

      From the command line:
      lpr -S -P JD_WEB_HP5SI test.txt:


Re: Printing with a Win32 printer
by Anonymous Monk on Apr 24, 2004 at 15:59 UTC
    Hi, Coul some one help me on how I can install network printers using perl script? I need to be able to install many printers on win2k printer server. HAdam

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://127684]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-07-16 01:11 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.