byte[] bytes = FileUtils.readFileToByteArray(new File(“E:/Documents/your_logo.gif”));
Picture pic = new Picture(presentation, new ByteArrayInputStream(bytes));
int picId = presentation.getPictures().add(pic);
SEVERE: Servlet.service() for servlet ArcAjaxRequestHandler threw exception
java.lang.NoClassDefFoundError: com/sun/media/jai/codec/ByteArraySeekableStream
at com.aspose.slides.PPImage.(SourceFile:104)
at com.aspose.slides.Picture.(SourceFile:33)
at com.manthan.arc.aspose.impl.AbstractAsposePPTExporter.createPresentaion(AbstractAsposePPTExporter.java:157)
the above error takes me to this line
Picture pic = new Picture(presentation, new ByteArrayInputStream(bytes));
why ppt is not getting generated.
Hi Sandeep,
Thanks for using Aspose.Slides,
While using the attached code you can replace image from a template presentation. If you require any further information, please feel free to contact us.
Many Thanks
Thanks,
Above mentioned code, i get error not able to replace image from a template presentation, give me futher information what method i can use for replace the image.
Hi Sandeep,
You can use the following code snippet for replacing picture in already created PictureFrame of a template presentation.
{
try{
InputStream iStream = new BufferedInputStream(new FileInputStream(".\\Template.gif"));
Picture pic = new Picture(pres,iStream);
int picId = pres.getPictures().add(pic);
PictureFrame pf = (PictureFrame)pres.getMainMaster().findShape("Unknown.gif");
pres.getMainMaster().getShapes().addPictureFrame(picId, pf.getX(), pf.getY(), pf.getWidth(), pf.getHeight());
}
catch(Exception e){
e.printStackTrace();
}
}
I hope this info will help you in this regard. If you require any further information, please feel free to contact us.