ConvertPPTXtoPDF.ps1
<#PSScriptInfo .VERSION 1.1 .GUID b8b1c87a-4624-49d8-8aec-a00e6c331ee7 .AUTHOR Thierry.BT .COMPANYNAME .COPYRIGHT .TAGS Office Powerpoint Pdf Convert .LICENSEURI .PROJECTURI .ICONURI .EXTERNALMODULEDEPENDENCIES MicrosoftOffice .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES First version #> <# .DESCRIPTION You can convert PPTX doc in PDF with a simple function #> Function Convert-PPTXtoPDF { Param ([Parameter(Position=0, Mandatory=$true)] [String]$Filepath) $OfficeFile = New-Object -ComObject Word.Application Write-host "In progress ..." -BackgroundColor DarkRed try { Add-type -AssemblyName office -ErrorAction SilentlyContinue Add-Type -AssemblyName microsoft.office.interop.powerpoint -ErrorAction SilentlyContinue $Fichierppt = new-object -com powerpoint.application $Fichierppt.Presentations.Open($Filepath).SaveAs($Filepath.ToString().Split(".PPTX")[0],[Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType]::ppSaveAsPDF) $Fichierppt.ActiveWindow.close() Write-host "Completed, file "$Filepath.ToString().Split(".PPTX")[0]" available" -BackgroundColor DarkBlue } catch { Write-Warning $error[0] } } |