I am looking for some help from anyone expereienced with Win32::OLE
I have been trying to automate the task of converting a .doc file to postscript by using Perl and Win32::OLE to drive MS-Word.
I have learned how to print a file and how to call up the PrintToFile dialog box by using Win32::OLE.
My problem is that when I set "PrToFileName" to automate the process of printing to a file, nothing happens.
Here is my test code
If I remove the "PrToFileName", I get the "Print To File" dialog box.#!/usr/bin/perl use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; #Where the temp file sent from the client is my $file = 'c:\temp\final.doc'; #Open MS Word my $Word = Win32::OLE->new('Word.Application', 'Quit'); $Word->{'Visible'} = 1; # if you want to see what's going on #Open the file $Word->Documents->Open($file); $Word->ActiveDocument->PrintOut({ Background => 0, Append => 0, Range => wdPrintAllDocument, Item => wdPrintDocumentContent, Copies => 1, PageType => wdPrintAllPages, PrintToFile => 1, PrToFileName => "c:\temp\out.ps" });
In reply to Using Win32::OLE Printing to a file from MS-Word by kirk_patton
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |