Embed Picture in a Slide

Hi,

I'm using Aspose.Slides in Java. I'm trying to add a picture in a slide. I'm using the following code:

OleObjectFrame oof = null;
oof = slide.getShapes().addOleObjectFrame(0, 0, pres.getSlideSize().x, pres.getSlideSize().y,"Excel.Sheet.8", theBytes);

oof.setPictureFileName(fileName);

But when I open the powerpoint slide I get a "Object Changed" slide and when I double-click on the slide I get followin error.

"The server application, source file or item cannot be found or returned an unknown error."

Can you please tell me what is causing this error? And how to resolve this issue?

Thanks in advance,

Mani

Dear Mani,

Thank you for considering Aspose.Slides

You are actually adding an OLE object. Whenever OLE object is added, Aspose.Slides adds “Object Changed” image. Please read this link about this issue.

http://www.aspose.com/wiki/default.aspx/Aspose.Slides/ObjectChanged.html

To insert your image, you need to know how to add a Picture Frame. Please see this link for a code example.

http://www.aspose.com/Wiki/default.aspx/Aspose.Slides/AddingPictureFrame.html

Hi Shakeel,

Thanks for your reply.

I tried the code provided in the link in your response. The constructor

Picture pic = new Picture(presentation, fileName);

is giving compilation error (cannnot resolve symbol) here. The documentation of Picture class available at Aspose.Slides for Java|Aspose.Slides Documentation does not say anything about any existing constructors for class Picture .

I tried the constructor

Picture pic = new Picture(presentation, InputStream);

It doesn’t give any compilation errors. But, it gives IOException

“IOException occurs when search for propriate codecs.”

Can you suggest any solution to this problem?

I don’t have JAI installed on my system. Do I need to install JAI?

Regards,
Mani

Did you use C# code or JAVA code from the link provided by me?

Actually, you don't need JAI.create method in the code there, it is only used for getting the image width and height, you can use any value for width and height for PictureFrame.

But if the problem persists, then install JAI, because it is in system requirement of Aspose.Slides and also let me know.

Hi,

We are using aspose.slides for Java for generating ppt slides. But we have a license for aspose.powerpoint which is the earlier version of aspose.slides if I am not wrong. We have learnt that aspose.slides (version 1.6.15.0) contains the hot fix for license issue. I have already tried using the above aspose.slides.jar and everythings working fine. All I want to know is how we can remove the background text which comes as a default for aspose license in every slide using the license. A piece of code would help us a lot.

Regards,

Mani

Hello,

We are using aspose.slides to render bitmaps of slides for a web presentation. The slides are created by our clients and have to be take as-is. Our client uses office metafiles, for which we had to purchase aspose.metafiles which does what we want. Now our client also wants to use ole elements in his presentations which when rendered, don’t appear on the rendered bitmaps. We don’t even get a ‘changed object’ placeholder, the element is just not on the rendered bitmap. What we need is a static image of the ole object to be rendered on the bitmap. What would be our options?

Furthermore, we have seen some quality loss on some slide elements created directly from within powerpoint (especially with gradients). Would there be some sort of quality factor that we can set to raise the precision of rendered images?

Thank you for your support!

I have created the slide thumbnail image after inserting the dummy OLE object and as you can see in the outOLE.jpg generated by the code below and attached with this post, shows the Object Changed Image.

I am using Aspose.Slides 1.7.4.0 for JAVA.

Code

**************************************************************

public static void CheckObjectChangedImage() throws Exception

{

Presentation srcPres=new Presentation();

Slide srcSld=srcPres.getSlideByPosition(1);

byte[] obj_data=new byte[1];

srcSld.getShapes().addOleObjectFrame(10, 10, 5000, 2000, "classname", obj_data);

BufferedImage img= srcSld.getThumbnail(new Dimension(300,200));

ImageIO.write(img, "jpeg", new File("c:\\outOLE.jpg"));

}

Dear Mani,

By background image, do you mean a Evaluation Watermark on the slides.

This watermark will not appear if you set the license before using any other Aspose.Slides API and your license has not expired.

Please see Licensing at this link

http://www.aspose.com/Wiki/default.aspx/Aspose.Slides/Licensing.html

I join to this mail a zip containing the original ppt file and an example of 3 rendered jpg. The ppt file was created with Office 2003. Different elements don’t show up on the rendered jpg files. Some objects directly drawn in Powerpoint (especially those with gradients, see 17_384_big.jpg and the box labeled ‘adipose’). Some elements not showing off were pasted from an EPS (Illustrator) file and do not show at all. Having a rendered jpg with a label of the kind ‘Object changed’ is not acceptable for our client as he needs to see the resulting slide ‘as is’ on the jpg snapshots.

We are waiting for the aprobation to buy the metafiles license to make the watermark dissapear on some other slides and now is the time to know how we can get as close as we can to the ideal situation where the client can use his usual tools (MS Office, Adobe Illustrator …) to build ppt files and have them rendered as is. We need to know if there is a need to purchase some other product from Aspose or if Aspose.slides / Aspose.metafiles can handle the current problems and if so, by what mean.

Thank you for the support!


hi
these links seem to have moved.

http://www.aspose.com/wiki/default.aspx/Aspose.Slides/ObjectChanged.html

http://www.aspose.com/Wiki/default.aspx/Aspose.Slides/AddingPictureFrame.html

do you have an updated link for the information?

thanks

Hi,

The urls have been fixed, feel free to try again.