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

Hi, I need to write a test script that sends a bunch of print requests to a printer that is hooked up with Win2k3. I looked at the CPAN modules, but couldn't find 1 that might work (the only module that might be useful is Win32::Printer) Has anyone done a similar thing before? Thanks in advance

Replies are listed 'Best First'.
Re: Printing to Win2K3 server
by NetWallah (Canon) on Jul 21, 2004 at 00:19 UTC
    You can use command-line printing/redirecting.

    Network printers behave exactly like a Share.
    This works on my PC to send to a network printer:

    copy con: \\WWPRINT01\BPR-5000
    Then type in a bunch of text terminate with CTRL-Z.

    In perl, just open an output file to that file name.

        Earth first! (We'll rob the other planets later)

Re: Printing to Win2K3 server
by orcaloverbri9 (Novice) on Jul 21, 2004 at 02:13 UTC
    You could store them in a file and execute the 'print' Win32 command. Assuming that @text contains the text to be printed:
    foreach (@text){ open(FILE,">file.txt"); print FILE $_; close(FILE); print `print file.txt`; };
    There you go. This might open security holes, but that may or may not matter much considering that it's a test script. You may also want to put a sleep() in there to avoid problems. 10 seconds or so would probably be enough.
      I don't quite understand this. So, do I use the Win32::Printer module for this task? I can do a loop to print, but just not sure what command to use for printing. Thanks