Changing background image size in Presentation using aspose-slides-2.4.0.jar

Hi


I have a requirement to set the slide size to different sizes and apply background to that slide completely using aspose-slides-2.4. jar only.

With the below code I am able to increase the slide size to new size but as bytearray is provided while creating presentation object the background is getting applied to only default PPT size. Could you please help me in increasing background size so that it can be applied to complete slide.

Below is the sample code am using:

Presentation pres = new Presentation();
byte[] imageByte == //code to get the byte array of the image that has to be applied as background.
ByteArrayInputStream imagestream = new ByteArrayInputStream(imageByte);
pres = new Presentation(imagestream);

//slide_width,slide_height are corresponding slide width and height values to which slide needs to be set.
pres.setSlideSize(new Point(slide_width, slide_height));

PFA sample slide generated with above code with increased slide size but background applied to only default slide size.(i.e.PPT size)

Thanks in advance.

Hi Geetha,

Thank you for considering Aspose.

I am afraid, you are using a very old version of Aspose.Slides for Java for which the support has been discontinued. I would suggest you to download and try the latest version at your end and see if it fullfils your requirements. If you still face any issue or need any assistance, please feel free to contact support.

Thanks & Regards,

Hi Ahmad,


We need to make changes using existing api only(2.4.0). I just want to know whether there is any possibility to increase the background size of a slide after applying background to it.

I tried with below code but it dint work.

Presenatation pres;
byte[] imageByte = //code to get bytearray of image to be applied as background.
ByteArrayInputStream imagestream = new ByteArrayInputStream(imageByte);
pres = new Presentation(imagestream);

//Code to increase the slide height and width
pres.setSlideSize(new Point(slide_width, slide_height));
Slide slide=pres.getSlideByPosition(1);

//I have written below two lines to increase the background size to match slide height and width.But it dint work.
slide.getBackground().setHeight(slide_height);
slide.getBackground().setWidth(slide_width);

So tell me whether there are any options available to increase the size of background which is already applied.

Hi Geetha,

Well, as mentioned in my earlier post, you are using a very old version of the API and there has been major structural changes in the API since v2.4.0. We don’t have any way at our end to check your issue on that older version. You can refer to the following documentation link if you are interested in using the latest version to set the background image using Aspose.Slides for Java v14.9.0.

Setting Image as Background of Slide

Thanks & Regards,