Slide with large number of objects consumes too much of memory

Hi,
I have observed a slide with large number of objects consumes large amount of memory while generating thumbnail thus causing GC limit.
Is there a way to count number of objects in a slide so that I can skip that specific slide for thumbnail generation.
I have attached an example slide.
Version used : 17.1

Hi Monis,


I have observed your comments. I have shared a piece of code in a text file with you. I hope this will help you to achieve requirements. Please share feedback with us if there is still an issue.

Best Regards,

Thanks for your reply.
I would like to know number of all objects/shapes before I call thumbnail generation code. Is there a way to do so?

Hi Monis,


I have observed your comments. I like to inform that size() returns the total number of shapes on the slide.

ISlide slide;

slide.getShapes().size();

Please share feedback with us if there is still an issue.

Best Regards,

Thanks. This will only give me top level count. Is there a way to count all objects recursively?

Hi Monis,


I have observed your comments. I have shared a piece of code with you.

<span class=“kwrd” style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>public<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”> <span class=“kwrd” style=“font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”>void<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”, Consolas, Courier, monospace; font-size: small; white-space: pre;”> shapeTest()

{

Presentation pres = new Presentation(path);

ISlideCollection slides = pres.getSlides();

for(ISlide slide : slides)

{

IShapeCollection shapes = slide.getShapes();

System.out.println(shapes.size());

for(IShape shape : shapes)

{

groupShapeCheck(shape);

}

}

}


public void groupShapeCheck(IShape shape)

{

if(shape instanceof GroupShape){

System.out.println(((GroupShape)shape).getShapes().size());

IShapeCollection shapes = ((GroupShape)shape).getShapes();

for(IShape gShape : shapes)

groupShapeCheck(gShape);

}

}

This will help you to achieve requirements. I like to share that you must check shape type like in this string
if(shape instanceof GroupShape) and if this shape is GroupShape, use System.out.println(((GroupShape)shape).getShapes().size());
Please share feedback with us if there is still an issue.

Best Regards,