Function Reference

_PPT_PresentationExport

Export one/multiple/all slides of a presentation as PDF or XPS.

#Include <PowerPoint.au3>
_PPT_PresentationExport($oPresentation, $sPath[, $sSlide = Default[, $iFixedFormatType = $ppFixedFormatTypePDF[, $iOutputType = $ppFixedFormatTypePDF[, $bUseISO19005 = True)]]]])

 

Parameters

$oPresentation Presentation object.
$sPath Path/name of the exported file.
$sSlide [optional] A string with the index number of the starting (and ending) slide to be exported (separated by a hyphen) (default = Keyword Default = export all slides in the presentation).
$iFixedFormatType [optional] The format to which the slides should be exported. Can be any value of the PpFixedFormatType enumeration (default = $ppFixedFormatTypePDF).
$iOutputType [optional] The type of output. Can be any value of the PpPrintOutputType enumeration (default = $ppPrintOutputSlides).
$bUseISO19005 [optional] Whether the resulting document is compliant with ISO 19005-1 (PDF/A) (default = True).

 

Return Value

Success: 1.
Failure: 0 and sets @error.
    1 - $oPresentation is not an object or not a presentation object
    2 - $sSlide is an object but not a SlideRange object
    3 - $sPath is empty
    4 - Error occurred when exporting the presentation. @extended is set to the COM error code returned by the ExportAsFixedFormat method
    5 - $sSlide is invalid. Has to be "StartingSlide-EndingSlide"

 

Remarks

Method ExportAsFixedFormat only supports a single range of consecutive slides.
To export a single slide simply pass the slide number as $sSlide.

 

Related

 

Example


#AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_AU3Check_Stop_OnWarning=N
#include <PowerPoint.au3>
#include <MsgBoxConstants.au3>

; **********************************************************
; Create application object and open an example presentation
; **********************************************************
Global $sPresentation = @ScriptDir & "\Presentation1.pptx"
Global $oPPT = _PPT_Open()
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationExport Example", "Error creating the PowerPoint application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Global $oPresentation = _PPT_PresentationOpen($oPPT, $sPresentation)
If @error Then
    MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationExport Example", "Error opening presentation '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _PPT_Close($oPPT)
    Exit
EndIf

; *********************************************************************
; Export slides 2 and 3 of the presentation, format: PDF, output: Notes
; *********************************************************************
Global $sExportFile = @ScriptDir & "\Presentation1.pdf"
_PPT_PresentationExport($oPresentation, $sExportFile , "2-3", $ppFixedFormatTypePDF, $ppPrintOutputNotesPages)
If @error Then Exit MsgBox($MB_ICONERROR, "PowerPoint UDF: _PPT_PresentationExport Example 1", "Error exporting '" & $sPresentation & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
MsgBox($MB_ICONINFORMATION, "PowerPoint UDF: _PPT_PresentationExport Example 1", "Presentation '" & $sPresentation & "' successfully exported as " & $sExportFile & ".")
ShellExecute(@ScriptDir & "\Presentation1.pdf")