We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Slides.Pptx.PresentationEx very slow and intermittent errors

Hello Mudassir,

I am also facing the slowness on all my machines.
We are using Aspose 7.3.0 and Win7/Mac OS X 10.7.5 and Powerpoint 2013


Hi Mudassir,

We have incorporated Aspose in our beta.
The thing which continues to bother us is the extreme slowness in creating PPTX files.
Whether we add a video, image or whether we save,write a PPTX all operations seems
quite slow.I understand that PPTX follows OPC and behaves as a zip file.
Writing PPTX involves zipping and unzipping operations which may make it slower.
My question : Is compression the only reason the whole processing thing is slow or do you see any way it can be optimized further as the end user certainly won’t be happy with this delay no matter how much we update him with the status messages.

Hi Mohit,


I would suggest you to please try using Aspose.Slides for Java 7.4.0 on your end. If there is sill an issue then please share the sample presentation along with statistics achieved on your end in terms of performance. Please also share the hardware specifications on your end as well.

Many Thanks,

Hi Mohit,


The size of presentation, the content inside the presentation and also the number of slides used does effect the presentation saving. However, I request you to please share some sample presentation that you feel is having performance issue along with sample code use to reproduce the performance issue. Please also share the statistics achieved along with software and hardware details for comparison.

Many Thanks,

We have presentations with multiple slides, each slide with one video or at most 4 images.
Everything works fine but very very slow.Also we get heap error if video exceeds 100 MB
Sample Code we use :


VideoFrameEx vf = sld.getShapes().addVideoFrame(50, 75, 350 * AR,350, null);
videoStream=new FileInputStream(vidiLink.getAbsolutePath());
VideoEx vid = ppt.getVideos().addVideo(videoStream); // adding VideoEx from stream

vf.setEmbeddedVideo(vid);
// Set Play Mode and Volume of the Video
vf.setPlayMode(VideoPlayModePresetEx.Auto);
vf.setVolume(AudioVolumeModeEx.Loud);
// Creating a Buffered Image object to hold the image file
BufferedImage image = null;
try
{
thumbStream = new FileInputStream(thumbLink);
image = ImageIO.read(thumbStream);
}
catch (IOException e)
{
if(m_Notify != null)
m_Notify.LogInfo(LogType.error ,"PPT Creation createVideoSlide Error : " + e.getMessage());
}
if(image == null)
{
if(m_Notify != null)
m_Notify.LogInfo(LogType.error ,“PPT Creation createVideoSlide , Thumbnail " + thumbLink.getPath() + " not found for video” + vidiLink.getPath());
}
else
{
// add thumbnail for video
ImageEx imgx = ppt.getImages().addImage(image);
vf.setImage(imgx);
}
// Add an AutoShape of Rectangle type
int idx = sld.getShapes().addAutoShape(ShapeTypeEx.Rectangle, 300, 450, 50, 100);
AutoShapeEx ashp = (AutoShapeEx) sld.getShapes().get_Item(idx);

// Add TextFrame to the Rectangle
ashp.addTextFrame("Video - " + videoIndex);
ashp.setWidth(100);
ashp.setHeight(20);
return true;


Sample Presentation :
http://speedy.sh/eZyra/06-04-2013-07-28-05.pptx

Hardware Specs :
http://www.switchcontrolindia.com/HardwareSpecs.htm

Hi Mohit,


Thanks for sharing the requested information. I have observed the first part of your query regarding embedding video file more than 100 MB Size. I like to share that an issue with ID SLIDESJAVA-33948 has already been created on your request in another forum thread to resolve the issue.

I have observed the sample code and unable to use it. Can you please share in the form of working sample java file along with statistics achieved on your end. Please also share the source presentation, source video and images for investigation. I will be able to observe the issue based on availability of requested information to help you further.

Many Thanks,

Hi Mohit,


Our development team has investigated the issue on their end. Actually, the size of inserted video depends on amount of memory (RAM), because we store the video in form of a byte array (used copy operation).
Our developer used test video file = 777mb. When amount of Heap = 3GB he got an OutOfMemoryException bwhen Heap = 4GB I got the file.

For copying video we have used following code snippet:

FileInputStream fstream=new FileInputStream(“big.avi”);
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[2048];

while ((nRead = fstream.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}
buffer.flush();
buffer.close();
fstream.close();

Our development team was able to slightly reduce amount of required memory, but size of inserted video is still depends on the size of Java heap space. We recommend using the following code for adding large size video (This code is a little helping the Garbage Collector):

PresentationEx pres=new PresentationEx();
FileInputStream fstream=new FileInputStream(“big.avi”);

ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[2048];

while ((nRead = fstream.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}
buffer.flush();
byte[] vidByte = buffer.toByteArray();
buffer.close();
fstream.close();
VideoEx video=pres.getVideos().addVideo(vidByte);

SlideEx slide=pres.getSlides().get_Item(0);

VideoFrameEx vid=slide.getShapes().addVideoFrame(20f, 20f, 300f, 300f, null);

vid.setEmbeddedVideo(video);

pres.write(“presWithVideo.pptx”);

Please share, if I may help you further in this regard.

Many Thanks,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.