Automating PowerPoint Presentations with Open XML SDK 2.0

Automating updates of headers/footers in PowerPoint presentations with Open XML SDK 2.0 reduced task time from an hour to 15 seconds for Critical Path Training.

In a previous post I mentioned that when we ( Critical Path Training) make changes to a course we have to update a lot of PowerPoint presentations. We then print these out as PDF’s to generate our course manual. This can be a tedious process. The previous post discussed how I was able to use the Open XML SDK 2.0 to automate the process of updating the headers and footers in each slide in each presentation, reducing a task that would typically take an hour or more down to about 15 seconds.

The next step is to generate PDF files from the presentation. This too is a tedious task… one that’s just a pain. After digging around in the TechNet Windows PowerShell forums, I was able to figure out how to automate this process with Windows PowerShell!

The following script looks at all *.PPTX files in a folder, and for each one it opens it up, sets the printer to use (in this case I prefer to use the Adobe PDF Writer that you get with Acrobat) set a few properties and then tell PowerPoint to print the file.

In the script, the OutputType property signifies what print mode you want. I generally use two values:

  • OutputType = 2: Prints out two slides per page without the presenter’s notes.
  • OutputType = 5: Prints out one slide with the presenter notes at the bottom.
Andrew Connell
Developer & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a full stack developer who focuses on Microsoft Azure & Microsoft 365. He’s a 20+ year recipient of Microsoft’s MVP award and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s mission is to help web developers become experts in the Microsoft 365 ecosystem, so they can become irreplaceable in their organization.

Share & Comment