Here's some old code which I had lying around. It might do exactly what you're looking for.
use strict; use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Word'; use Getopt::Std; my %opts; getopts('o:i:', \%opts); my $infile = $opts{i} || die "No input File specified - use -i file\n +"; my $outfile = $opts{o} || die "No output File specified - use -o file\ +n"; my $Word = Win32::OLE->new('Word.Application', 'Quit'); # $Word->{'Visible'} = 1; # if you want to see what's going on $Word->Documents->Open($infile) || die("Unable to open document ", Win32::OLE->LastError()); $Word->{DisplayAlerts}=-1; $Word->ActiveDocument->PrintOut({ Background => 0, Append => 0, Range => wdPrintAllDocument, Item => wdPrintDocumentContent, Copies => 1, PageType => wdPrintAllPages, OutputFileName => $outfile, PrintToFile => 1, }); $Word->ActiveDocument->Close(0); unlink $outfile; #The pdf creation appends ".pdf" to $outfile, but c +reates an empty $outfile as well
Then again, it might not. I've given up using Adobe Acrobat, and I'm now using Samba and ghostscript to do the same thing for free. See here if you're interested.
In reply to Re: Manipulating MSWord with Win32::OLE to convert a word document to pdf
by davis
in thread Manipulating MSWord with Win32::OLE to convert a word document to pdf
by ruhk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |