We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adding a compressed emf file (emz) to a slide

Hi

I am evaluating upgrading our existing automation project where create a power point presentation from a series of images and/or text. I am using powerpoint for 2013.

I have a working version for emf files and i am happy with quality of the images in the ppt file created.

We are using a large number of fairly large images and i would like to use a compressed zip emf so they size of the presentation and any pdfs generated from it are reduced in size but not quality.

below is my code example …

protected void AddPicture(IPresentation p, ISlide s, byte[] data, float x, float y, float width, float height)
{
if (s != null)
{
if (s.Shapes != null)
{
IPPImage imgx = p.Images.AddImage(data);

                var m = s.Shapes.AddPictureFrame(ShapeType.Rectangle, x, y, width, height, imgx);
            }
        }
    }

private byte[] GetCompressedData(string fileNameZip, byte[] buffer)
    {
        byte[] bufferZip = null;

        using (FileStream f = new FileStream(fileNameZip, FileMode.Create))
        {
            using (var gz = new GZipStream(f, CompressionMode.Compress, false))
            {
                gz.Write(buffer, 0, buffer.Length);
            }
        }

        using (FileStream f = new FileStream(fileNameZip, FileMode.Open))
        {
            bufferZip = new byte[f.Length];
            f.Read(bufferZip, 0, (int)f.Length);
        }

        return bufferZip;
    }

it works fine for emf files.
emf files.zip (191.9 KB)

I would like to compress the data via std gzip compression in c# and pass in the data related to the emz file.

I have tested that power point can manually add a picture from the emz file that i generate.

Can you let me know if this is possible and/or if this can be added?

regards,
Zoran

Hi Zoran,

I have observed the sample code as well attached EMZ image files from you. I have tried adding them EMZ image to presentation ImageCollection and regret to share that at present the support for adding EMZ images is unavailable. An issue with ID SLIDESNET-39039 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be automatically notified once the support will be available.

Many Thanks,

Mudassir Fayyaz

The issues you have found earlier (filed as SLIDESNET-39039) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz