Free Support Forum -

Resizing picture on a slide

I downloaded your PowerPoint appl and tried to create a ppt slide using images and xml files. But I can’t resize the image, is it because it’s a trial version?

sorry, I should say the image on the slide is very small but re-sizable. Is there a way to make the image fit to the page?

You can set size of picture equal to size of the parent slide.
Please check Presentation.SlideSize property.

I only have one slide in the presentation and try to generate it on the fly in Java. Any suggestion please. Thanks.

Generate slides or pictures?

Generate new slide:

Presentation pres = …;
Slide slide = pres.addEmptySlide();

Add new picture:

String fname = “image.jpg”;
InputStream is = new BufferedInputStream(new FileInputStream(fname));
pic1 = new com.aspose.powerpoint.Picture(pres, is);
int picid1 = pres.getPictures().add(pic1);

Add new PictureFrame and resize it:

int slideWidth = pres.getSlideSize().x;
int slideHeight = pres.getSlideSize().y;
PictureFrame pf = slide.getShapes().addPictureFrame(picid1, 0, 0, slideWidth, slideHeight);

Could you give me an example how to set the size of the picture? I didn’t find the set method in your Java API. Also I only have one slide in the presentation and try to generate it on the fly, I end up with an extra empty slide. Any suggestion please. Thanks.

PictureFrame pf = …;

whoa… you are fast…
do you know how to get rid of the extra empty slide in my one slide presentation? since I have to generate it on the fly, I created an empty presentation as a template but it did not work so I have to add an empty slide for code to run. Thanks.

Store your empty slide in temp variable.

Slide empty_slide = pres.getSlideByPosition(1);

And delete it after you finished work with your presentation.


perfect solution… thank you.
Also do you have an update for converting xml to ppt?
I am trying to convert title, subtitle, notes etc from an xml file to ppt’s title/notes, any suggestion?

No any updates yet and unfortunately can’t tell about estimated time.
I think the most quick solution is parse xml by yourself.