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

Is it possible to convert the ".doc file" to ".prn file" through perl. Kindly advise me.

Thanks

Replies are listed 'Best First'.
Re: DOC TO PRN
by Corion (Patriarch) on Mar 17, 2010 at 09:39 UTC

    What is a "PRN" file?

    I recommend you use Win32::OLE to automate Microsoft Word to do the conversion.

    Alternatively, you could try to automate OpenOffice to do the conversion, but I haven't had much success (or need) to do such automated conversions with OOo.

      A PRN file is a file produced in a Microsoft DOS or Windows application when the option "Print to File" is used. Note that this isn't the same thing as using the normal print functionality with a "fake printer" like Adobe Acrobat or PDF Creator define. It's meant to be a printer ready dump that can be copied to a printer:
      COPY myfile.prn LPT1

      As you might guess from this syntax, this idea has been around for quite a long time (and only works on directly connected devices). One alternative I saw was to try in MS Windows to drag and drop a PRN file onto the printer icon. A quick Googling showed me a free tool that will let you print various kinds of files: PrintFile

      None of this background information helps the OP, but you've already pointed to the use of Win32::OLE to automate the application needed to produce the PRN file. Even in Office 2007, you can use the Print to File option, it's just a matter of picking the right OLE print setting to specify it.

      Oooh, another quick look gave me this: source file of Docserver which has a doc_convert function that looks just like what the doctor ordered.

      Final Answer: get Docserver

        I've seen other files named with the .prn extension, but even if it were as you described, the OP didn't mention for what printer the .prn file should be created, which makes the question even less answerable :)

Re: DOC TO PRN
by marto (Cardinal) on Mar 17, 2010 at 09:41 UTC

    You could use Win32::OLE to automate Microsoft Word to do this.