views:

844

answers:

4

I'm wondering if it is possible to convert a slideshow from PowerPoint (ppt/pptx) to a series of images (jpeg/png) (one for each slide)?

Are there any libraries that do this out there (C#, C/C++, Ruby)?

A: 

I'd look into PowerPoint COM interface. With C# this is as easy as adding a reference in Visual Studio. The necessary functions should be there.

Vilx-
+3  A: 

I found the following article useful when doing something similar:

Tips for Exporting slides from Powerpoint in C#

dommer
+2  A: 

As mentioned, you want the com interface and more specifically, the Export method of the Presentation object.

Example in Python (it's what I'm using at the moment, should be trivial to convert):

import os
import comtypes.client

def export_presentation(path_to_ppt, path_to_folder):
    if not (os.path.isfile(path_to_ppt) and os.path.isdir(path_to_folder)):
        raise "Please give valid paths!"

    powerpoint = comtypes.client.CreateObject("Powerpoint.Application")

    # Needed for script to work, though I don't see any reason why...
    powerpoint.Visible = True

    powerpoint.Open(path_to_ppt)

    # Or some other image types
    powerpoint.ActivePresentation.Export(path_to_folder, "JPG")

    powerpoint.Presentations[1].Close()
    powerpoint.Quit()

This exports each slide in the specified powerpoint presentation to the specified directory, with the files named Slide1.jpg, Slide2.jpg, etc.

mavnn
A: 

Maybe you like this one too...it is not free but matches your needs:

You can use "CZ-ppt2jpg", it can convert ppt files to jpg files, and this tool supports command line interface, so you can call it from your application.

you can get demo version and more information from http://www.convertzone.com/ppt2jpg/help.htm

regards

flyaga

flyaga