Problem regarding processing Presentations


Hey…

I am trying to process presentations while uploading them.While processing i am extracting the slide notes,all slide text in placeholders, and creating a slide png image or can say a thumbnail.
I am able to process most of the presentations. But for a few presentations the processing fails. I mean i am not able to extract the notes, text in the placeholders, and even the png image/thumbnail created is not exactly like the slide, say most of the colours in the slide are lost.

I have attached some presentations, which i am finding difficult to process.
The first two presentations prob1.ppt and prob2.ppt, colors are lost when processed to create a thumbnail of the slide. I have also attached a screenshot of the original slide and the png image generated after processing the slide.

When i am applying a new template to the prob2.ppt , and then processing it, i am able to generate good png images for slides, i mean the colors are not lost but i am not able to extract the text from the placeholders while beore applying the template this text was being extracted.

Please find all the files attached.

I have the aspose.slides license. Can someone please tell me if there is a solution to such a problem.

Thanks in advance.

I will investigate these problems; can you please also provide your source code?

Hey…

Thanks for the reply…
this is my function where i am trying to process the uploaded presentation and get all slide details:

public void setSlidesDetails(long assetsId, InputStream is, Hashtable videofile)
throws PptException, IOException, AsposeLicenseException {

com.aspose.slides.Presentation ppt1 = new com.aspose.slides.Presentation(is);
License license = new License();
license.setLicense(AssetsService.class.getResourceAsStream("/Aspose.Slides.lic"));


String notestr = “”, desc = “”;
Notes notes;
long slideid;
for (int i = 0; i < ppt1.getSlides().size(); i++) {
// Slide slide = ppt1.getSlides().get(i);
Slide slide = ppt1.getSlideByPosition(i + 1);
Slides assetSlide = new Slides();

slideid = slide.getSlideId();
assetSlide.setSlide_id(slideid);

assetSlide.setAssets_id(assetsId);
if ( videofile != null )
{
VideoFrame videoFrame = getVideoFrame(slide);
if ( videoFrame!= null)
{
String [] sp = videoFrame.getFileName().split("\\");
String videoFileName = sp[sp.length-1];
if ( videofile.keySet().contains(videoFileName) )
{
assetSlide.setVideoData((InputStream)videofile.get(videoFileName));
// slide.getShapes().addVideoFrame(1900,1100, 2000, 2000,videoFileName);
}
}
}


notes = slide.getNotes();
if (notes != null)
notestr = slide.getNotes().getText();
assetSlide.setSlide_notes(notestr);

for (int j = 0; j < slide.getPlaceholders().size(); j++) {
Placeholder holder = slide.getPlaceholders().get(j);
if (holder instanceof TextHolder) {
desc += ((TextHolder) holder).getText();
desc += " ";
}

}
assetSlide.setSlide_description(desc);

desc = “”;
// Now converting the slide into png image and storing into the
// database in the binary format
// Trying to convert the Buffered Image into InputStream
BufferedImage imge = slide.getThumbnail(new Dimension(1024, 768));

ByteArrayOutputStream baos = new ByteArrayOutputStream();
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(baos);
encoder.encode(imge);

byte[] fileData = baos.toByteArray();
InputStream newis = new ByteArrayInputStream(fileData);
assetSlide.setDataStream(newis);

getHibernateTemplate().save(assetSlide);
}

}

Hi…
Is anything wrong with my code, any amends that i should make in the code specified above to process the presentations/slides more effectively?

I am also facing problems in extracting underlined text from a textholder, say if a textholder has some text underlined, and i try extracting this text, i am only getting the text which is not underlined. Is there some function that should be used to extract the underlined text?

Thanks in advance.

Did you change the template in MS-PowerPoint 2007? Because if you had done that and got the correct ok then doing so changes the placeholders (textholders) into textframes, so your code will not work in that case.

Please see

PP 2007 converts the placeholders into textframes

Prob1.ppt is actually broken means its inner structure is collapsed, when I opened it and save it back with different name, thumbnails were correct except in some of them, text was not appearing, we will fix it.

Your code is ok. You should also get the latest version of Aspose.Slides for JAVA 1.8.7.0 which has fixed various formatting problems.

Hi.
Thanks for the reply.
We already have the Aspose.Slides License.
Therefore to get the latest version of Aspose.Slides for JAVA 1.8.7.0, do we need to buy the license again?Can you please tell us the way to switch to the latest version of Aspose.Slides?
And where can we get the information about the version of aspose.slides that we are currently using?

Thanks

No, you don’t need to buy a license again unless your license is one year old in that case you cannot use newer versions of Aspose.Slides.

As far I know, you cannot know it, but you can keep track of it in future when you download the latest version, right click the jar file of Aspose.Slides for JAVA and write a version number inside a Summary tab for future reference.

Or you can simply create a folder name which contains version number and unzip Aspose.Slides for JAVA inside it.