perl Win32::OLE ExportAsFixedFormat syntax for powerpoint

1

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?

perl
powerpoint
win32ole
asked on Stack Overflow Sep 30, 2011 by golemwashere • edited Sep 30, 2011 by Mouna Cheikhna

2 Answers

1

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.

answered on Stack Overflow Jan 23, 2012 by Karl Forner
-1

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).

answered on Stack Overflow Sep 30, 2011 by golemwashere

User contributions licensed under CC BY-SA 3.0