Free Support Forum - aspose.com

Converting PowerPoint Presentation to Slide Images

Hi

I was wondering if it was possible to convert a presentation slides into images using Java, it is possible could you please give me pointers.

Many thanks,

JediJide.

Dear Jedi,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.Slides for JAVA

Yes, it is possible to take images of the slides using Aspose.Slides JAVA. Here is a complete code that takes a source presentation name and output the images of all slides in an output directory.

Just change the input/output directory name and source presentation name and run the code.

For general help, see Programmer’s Guide here.

http://www.aspose.com/Wiki/Default.aspx/Aspose.Slides/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

CODE

public static void getThumbnails() throws Exception

{

//Input and output directory

String strPath="D:\\downloads\\test3oct\\";

//Source presentation name

String strFile="Jensen_v1.3-Test.ppt";

//Create a source presentation object

Presentation srcPres=new Presentation(new FileInputStream(new File(strPath + strFile)));

//Get the collection(array) of slides

Slides slds=srcPres.getSlides();

//Get the count of normal slides (excluding master slides)

int sldsCnt=slds.getLastSlidePosition();

//Iterate all normal slides

for(int i=1; i<=sldsCnt; i++)

{

//Get ith slide

Slide sld=srcPres.getSlideByPosition(i);

//Get the thumbnail image, 1.0f, 1.0f is the scaling factor

BufferedImage img=sld.getThumbnail(1.0f, 1.0f);

//Create a file for the image

File imgFile=new File(strPath + "slide" + i + ".jpg");

//Write the image into the file

ImageIO.write(img, "JPEG", imgFile);

}

}

Thanks for your response, I’ll give that a go, my ultimate aim is to convert the Java code into ColdFusion, is there any example anywhere of using the above code in ColdFusion?