Couple of problems with Aspose.Slides for Java

Hi,


We’re using Aspose.Slides for Java version 2.7.0 in one of our applications and we’re experiencing a couple of different errors when that application is hosted on different platforms.

When hosted on a debian server, text in images extracted from PPTX files is coming out distorted or in completely the wrong location on the slide. See the attached example slideImage.png which was extracted from the attached 2479_1.pptx file using the following code:


FileInputStream fis = new FileInputStream(presentationFile);
PresentationEx presentation = new PresentationEx(fis);
SlideEx slide = presentation.getSlides().get(slideNumber);
BufferedImage bimage = this.getScaledJpgFromSlideEx(slide, height, width, maintainAspectRatio);
fis.close();
return bimage;

private BufferedImage getScaledJpgFromSlideEx(SlideEx slide, int height, int width,
boolean maintainAspectRatio)
{
// Get the image at the original size
BufferedImage image = slide.getThumbnail(1f, 1f);

if (maintainAspectRatio)
{
Dimension slideSize = slide.getParent().getSlideSize().getSize();
// -1 is how the aspect ratio is maintained
if (slideSize.getWidth() > slideSize.getHeight())
{
height = -1;
}
else
{
width = -1;
}
}
Image resizedImage = image.getScaledInstance(width, height, Image.SCALE_SMOOTH);

BufferedImage bufferedThumbnail = new BufferedImage(
resizedImage.getWidth(null),
resizedImage.getHeight(null),
BufferedImage.TYPE_INT_RGB);
bufferedThumbnail.getGraphics().drawImage(resizedImage, 0, 0, null);
bufferedThumbnail.flush();

return bufferedThumbnail;
}

Weirdly on a windows server the images extracted from the same PPTX file are correct with no problem in the text size or placement.

However, when we merge more than one presentation together on the windows server then open the result in PowerPoint 2010 we get the following message after enabling editing:

"PowerPoint found content in merge.pptx that it did not understand. This content has been removed and cannot be recovered. You should review this presentation to determine whether any content was unexpectedly changed or removed"

The file merge.pptx is attached to this message and was generated with the following code:

private void mergePPTXs(List pptxFiles, File resultFile) throws FileNotFoundException,
IOException
{
PresentationEx presentation = new PresentationEx();
SlidesEx destSlides = presentation.getSlides();
for (File file : pptxFiles)
{
if (checkPPTX(file))
{
// This file to be included in the download is a PPTX file itself.
// So, add all the slides from this to the end of the download PPTX we are creating:
PresentationEx srcPres = new PresentationEx(new FileInputStream(file));
SlidesEx slides = srcPres.getSlides();
for (int i = 0; i < slides.size(); i++)
{
// Clone the desired slide from the source PPTX to the end of the collection
// of slides in the destination PPTX
destSlides.addClone(slides.get(i));
}
}
}

// Remove empty slide
presentation.getSlides().remove(0);
// Creating a file output stream to write the output file
FileOutputStream fostream = new FileOutputStream(resultFile);

// Writing the presentation as a PPTX file
presentation.write(fostream);

// Closing the streams
fostream.close();
}


If anyone has any suggestions about how to get round either of these two problems it would be a great help.

Thanks,
Matt


Hi Matt,


Thanks for inquiring Aspose.Slides.

I have observed the issues shared by you and like to suggest you try using Aspose.Slides for Java 2.9.6 on your end please. If there is still issues on your end then kindly share your feedback along with generated output with us. Please also share the source presentations involved in presentation merging so that I may work on them on my end if the issue still persist with Aspose.Slides for Java 2.9.6.

Many Thanks,

Mudassir:
Hi Matt,

Thanks for inquiring Aspose.Slides.

I have observed the issues shared by you and like to suggest you try using Aspose.Slides for Java 2.9.6 on your end please. If there is still issues on your end then kindly share your feedback along with generated output with us. Please also share the source presentations involved in presentation merging so that I may work on them on my end if the issue still persist with Aspose.Slides for Java 2.9.6.

Many Thanks,

Hi Mudassir,

Thanks for the help - we'll try the new version internally and see if that solves the first issue.

I've attached the three pptx files that were used to create merge.pptx (246.pptx, 243.pptx and 244.pptx - in that order).

Thanks,
Matt

Hi Matt,


I have worked with the presentation files shared by you and generated the cloned presentation by using them in order you specified. I have used the following code snippet and have not been able to observe the issue specified. For your convenience, I have also shared the generated presentation as well. I have used Aspose.Slides for Java 2.9.6 on my end.

public static void CombineSlidePPTX(int las)
{

PresentationEx newPresentation = new PresentationEx();
Slide masterTemplate=null;
java.util.TreeMap tMap=new java.util.TreeMap();
SlideEx srcSlide = null;
try{
PresentationEx pr = new PresentationEx();
for (int i = 1; i <= las; i++)
{

//Accessing a slide using its slide position
pr = new PresentationEx(path+“modified_Java”+i+“.pptx”);
for(int j=0;j<pr.getSlides().size();j++)
{
srcSlide= pr.getSlides().get(j);
newPresentation.getSlides().addClone(srcSlide);
srcSlide=null;
}
}


newPresentation.getSlides().remove(0);
newPresentation.getMasters().removeUnused(true);

newPresentation.write(path+“Newmodified_Java_Mudassir2.pptx”);
}
catch(Exception e)
{
e.printStackTrace ();
}

}

Many Thanks,

Hi Mudassir,


Thanks for this - I’ve have upgraded as suggested and it has resolved the problem of the error message appearing when opening the merged file in PowerPoint.

Unfortunately it hasn’t resolved the problem of the text being misaligned / malformed in the image extraction from the slides when hosted on Debian.

Do you have any other suggestions to get round that problem?

Thanks,
Matt

Hi Matt,


Can you please share that you have used the exact code shared by me. Please also share the generated presentation output with us. Please also share the information related to Debian environment you have along with version of JDK used on your end.

Many Thanks,

Hi Mudassir,


The code we used to extract images and the presentation we used is shown in the first post (there’s also an attachment of the results of the extraction).

The version of Debian is 6.0.5

Calling ‘java -version’ on the command line gives:

java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.13) (6b18-1.8.13-0+squeeze2)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)

Thanks,
Matt

Hi Matt,


Thanks for sharing the requested details. I have created an issue with ID SLIDESJAVA-33551 in our issue tracking system so that our development team may further investigate and resolve the issue on their end. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

Hi Mudassir,


Has the been any progress on this issue at all? We’re waiting for a resolution to it for one of our clients.

Thanks,
Matt

Hi Matt,


I have verified the issu status from our issue tracking system and regret to share that the issue shared has not yer been resolved. However, I have requested our development team to schedule the issue for investigation. I will share the further information with you as soon as it will be shared by them

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESJAVA-33551) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.