Extracting images from pptx file using Aspose for Java

Hi – I’m doing an evaluation of Aspose for Java for possible use at my company. I’m stuck now trying to extract the images from a pptx file using the api. I can navigate to the shapes, but I’m unable to tell if the shape contains an image firstly, and how to extract it secondly. I’m using instanceof at the moment, but this couldnt be right?

On that topic – is there a good example code showing all the features of the Java api wrt pptx parsing? All the examples I’ve seen seem to be for ppt.

Here is my code so far, btw:

PresentationEx pres = new PresentationEx(“c:/aspose/corpus/pptx/preso.pptx”);
for (int slideNum=0; slideNum<pres.getSlides().size(); slideNum++) {
System.out.println("Slide " + slideNum);

SlideEx slide = pres.getSlides().get(slideNum);

for (int shapeNum=0; shapeNum<slide.getShapes().size(); shapeNum++) {
System.out.println("Shape " + shapeNum);
ShapeEx shape = slide.getShapes().get(shapeNum);
TextFrameEx textFrame = shape.getTextFrame();
if (shape instanceof AutoShapeEx) {
System.out.println(textFrame.getText());
} else if (shape instanceof PictureFrameEx){
System.out.println(“Not Text”);
((PictureFrameEx) shape).getPictureFormat().
}
}
}
}

thanks!
mikej

Dear Mike,

I think, this feature is not available and you cannot extract images at present. I have requested the technical team to confirm it and add this feature soon if possible.

Thank you – yeah that would be a showstopper for us. We definitely need to be able to extract text and images (and their relative positions) from the pptx. We are attempting to transform the pptx into html, for what its worth.