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

Hello All, I am need of help to develop a very simple virtual printer. 1. Control as a service via Win32::Daemon 2. When I print to the virtual printer, it dumps text only to a folder I specify. I have seen the documentation to use Win32::Daemon however I cannot find anything about a virtual printer created in Perl. Can you point me in the right direction?

Replies are listed 'Best First'.
Re: Virtual Printer
by Erez (Priest) on Feb 06, 2008 at 15:54 UTC

    Can you point me in the right direction?

    More context is needed for that.
    If you only need to save the text to a specific folder/file, then it can be as simple as open/flock/print/rename/close.
    If the text needs to be formatted for printing, or an actual printer needs to be emulated, try one of these results of a CPAN printer search.
    Give us what you exactly need, and what you already wrote, and an answer might be found.

    Software speaks in tongues of man; I debug, therefore I code.
    Stop saying 'script'. Stop saying 'line-noise'.

      This needs to run on a windows server. My intent is to add a virtual printer as an actual printer to the server and share it on the network. When I print to the printer, it takes the text and dumps it to a text file on a network share.
        a quirk answer would be that you can add a new printer with the Generic/Text Only properties.
        Everything printed is dumped to a text file.
        but i think what you look for is your service to monitor the printer queue on the server and intercept the raw data.
        then redirect it to anywhere
Re: Virtual Printer
by pc88mxer (Vicar) on Feb 06, 2008 at 17:46 UTC
    This is more of a Windows driver development question, and this freeware (found using google) might help you do what you want to do:

    http://www.programurl.com/miraplacid-publisher-sdk.htm

    Another solution which you could implement entirely is perl is to find a Windows print driver which communicates to the printer via the serial port. Then use the com0com driver to create a serial port bridge. The flow of data would be:

    1. User's PC
    2. connects to your printer via Windows Printer Sharing
    3. talks to the printer driver
    4. sends data through one end of the com-com bridge
    5. arrives at your perl program which has opened up the other end of the bridge
    6. which dumps the data to a file

    (Rube Goldberg, EYHO.)

    The com0com driver is pretty cool. You can also create com to tcp bridges which allows you to communicate with serial devices over the network.

    Link to the com0com project: http://com0com.sourceforge.net/

      I will have to try the com-com bridge. The freeware program is great but only creates images. It doesn't dump to text which is neccessary for another program to slurp in the data. I will check the com0com project.