in reply to Printing from Perl in Windows

Further to my HTML suggestion (above), I've poked around in the windows explorer 'File Types' dialog and discovered that you can print an HTML document from the command line using this command:

"C:\Program Files\Microsoft Office\Office\msohtmed.exe" /p filename.html

When you run that, an MS Word window appears, opens the file, prints it and exits. So obviously this option assumes you have Word.

On a machine without MS Office installed, I found this command associated with the HTML Print action:

rundll32.exe C:\WINNT\System32\mshtml.dll,PrintHTML filename.html

I found that this command only worked if the filename was an absolute pathname (perhaps a URL would work too). It had the advantage of using the fonts defined in the HTML/CSS, which the Word command did not. It had the disadvantage of popping up a print dialog which you have to click OK on - there may be some way to automate that.

Replies are listed 'Best First'.
Re: Re: Printing from Perl in Windows
by John M. Dlugosz (Monsignor) on Feb 18, 2003 at 22:27 UTC
    Hmm, very nice. HTML is easy to generate, but I'd need to figure out enough style stuff to get the sizes right.