Hello,
the following method presents, how to grab the pictures out of my presentation and save them to files:
SiPresentation.getInstance().getPictures().getPictureById(i).write(new FileOutputStream(new File("\" + SiPresentation.getInstance().getPictures().getPictureById() + “.jpg”)));
but what I want to know is how I can grab Videos out of my presentation?!
Regards
Dear fent111,
Thanks for considering Aspose.Slides for Java.
PowerPoint does not embed movie, it always embed a link to it. So you cannot get a movie, you can get only its file name/path.
The code below iterates all the shapes on first slide and print the path of the movie if there is any.
public static void getMoviePath() throws Exception {
String srcPPTFile = "c:\\srcPres.ppt";
//Create presentation from existing presentation
Presentation srcPres = new Presentation(new FileInputStream(new File(srcPPTFile)));
//Get reference to first slide
Slide srcSld = srcPres.getSlideByPosition(1);
//Get the shapes and its count on the slide
Shapes shps = srcSld.getShapes();
int shpsCount = shps.size();
//Iterate all shapes
for (int i = 0; i < shpsCount; i++) {
//Get ith shape from Shapes
com.aspose.slides.Shape shp = shps.get(i);
//if shape type is videoframe then print the file name of the video
if (shp instanceof com.aspose.slides.VideoFrame) {
VideoFrame vf = (VideoFrame) shp;
System.out.print(vf.getFileName());
}
}
}