Hi,
I´m trying to retrieve the pictures from a PPT File, and I'm having trouble
getting WMF and EMF pictures. Is there anyway to get these? Where I´m wrong?
Here´s the code:
Slide s2 = s[i];
Shape[] sh = s2.getShapes();
for (int j = 0; j < sh.length; j++)
{
if (sh[j] instanceof Picture)
{
pics++;
Picture p = (Picture)sh[j];
int type = p.getPictureData().getType();
byte[] data = p.getPictureData().getData();
if (type == Picture.JPEG)
{
FileOutputStream out = new
FileOutputStream("pict"+j+".jpg");
out.write(data);
out.close();
System.out.println("Imagem criada: "+"pict"+j+".jpg");
}
else if(type == Picture.PNG)
{
FileOutputStream out = new
FileOutputStream("pict"+j+".png");
out.write(data);
out.close();
System.out.println("Imagem criada: "+"pict"+j+".png");
}
else //In this case i will try to get the WMF and other
formats
{
FileOutputStream out = new
FileOutputStream("pict"+j+".wmf");
out.write(data);
out.close();
System.out.println("Imagem criada: "+"pict"+j+".wmf");
}
}
Thanx,
Luis.