Hello -
I’m trying to add a metafile (EMF, WMF) to a presentation and have it maintain its full vector clarity. I know that PowerPoint natively supports metafiles. If I add the same image manually and zoom way in it is crystal clear. When I add it via the methods that I think I have to use in Aspose.Slides, it appears the image is converted to a raster format and thus zooming make it look all aliased. Our code engine can output metafile images and we’d love to have these inserted in native format in PowerPoint using Aspose.
Details:
I’m using C#
I’m using the Aspose.Slides.Pptx namespace and and working with pptx presentations.
I’m using the .Net 4.0.30319 runtime and Aspose.Slides version 8.3.0.0.
The code I’m using is very simple. Here it is:
Note:
Pres is a Aspose.Slides.PresentationEx instance
slide is a Aspose.Slides.SlideEx instance (the slide i’m working with)
shp is a Aspose.Slides.ShapeEx instance (a shape I’m using to identify where the metafile should go)
//load the metafile
var mf = new System.Drawing.Imaging.Metafile(“EMFTEST.emf”);
//create the ImageEx
Aspose.Slides.Pptx.ImageEx imgx = Pres.Images.AddImage(mf);
//add the PictureFrame
slide.Shapes.AddPictureFrame(PP.ShapeTypeEx.Rectangle, shp.X, shp.Y, shp.Width, shp.Height, imgx);
//set the image in the PictureFrame
shp.FillFormat.PictureFillFormat.Picture.Image = imgx;
That’s it! What am I doing wrong? I saw in the old PPT forum that metafiles should be added using a “Picture” object not an “Image” object - but that was a very outdated comment. Any help would be great appreciated. Thanks.
Hi,
Thank you for sharing the details.
Please share your template and generated PPTX files and EMF image file with us to get a better understanding of your issue. This will help us in investigating the issue at our end.
Thanks & Regards,
Hi - I’ve attached a zip file to the original post with 3 files in it. I’ve included a sample PPT, EMF and the program used to stitch it all together. The sample PPTX is clearly labeled and has the same EMF file inserted on the right (via PowerPoint). The program will tell Aspose to insert the EMF on the left side.
When you zoom in it is clear that a conversion is going on. The right side is perfect, the left is not. Thanks.
Hi,
Thank you for sharing the files.
I am able to reproduce your issue after an initial test using your shared files. Your issue has been registered in our issue tracking system with issue id: SLIDESNET-35006. You will be notified via this forum thread once the issue gets resolved.
Sorry for the inconvenience,
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan