I have trouble using perl (strawberry) and win32::ole using powerpoint (from office2010) to convert ppt(x) to pdf.
I can export to jpgs fine with Export function but the function ExportAsFixedFormat has a quite obscure syntax and alwawys gives me
Win32::OLE(0.1709) error 0x80020011: "Does not support a collection"
.
this is a sample of what I am trying
my $ppoint = Win32::OLE->new('PowerPoint.Application', 'Quit');
my $Presentation = $ppoint->Presentations->Open("$infile") || die("Una +ble to open document ", Win32::OLE->LastError()) ;
$Presentation->ExportAsFixedFormat("$outfile", 2, 2, "msoCTrue", "ppPrintHandoutHorizontalFir +st", "ppPrintOutputFourSlideHandouts", "msoFalse", "", "" , "", "Fals +e", "False", "False", "False", "False");
second parameter ppFixedFormatTypePDF should be 2
third param 'ppFixedFormatIntentPrint' should be 2
Can anyone suggest a working example?
Just to complete the answer from golemwashere:
use Win32::OLE::Const 'Microsoft PowerPoint';
...
$Presentation->SaveAs("$outfile",ppSaveAsPDF, 1);
This works using powerpoint 2007 on windows 7, but the return value has to be ignored.
I solved using
$Presentation->SaveAs("$outfile", 32);
it was tricky finding that 32 = pdf format and also $outfile needed foward slashes : / in path (with \ I got confusing errors).
User contributions licensed under CC BY-SA 3.0