Free Support Forum - aspose.com

Strange rendering of ODP slide to BMP

We use Apose.Slides for .Net 20.10 and observe the following strange behavior (on Windows). The attached ODP document when rendered to BMP has black regions - Regression.zip (31.5 KB). Earlier, when we used Aspose.Slides version 20.4 the same setup worked as expected (so, this is more like a regression). The code for rendering is the same for a long period of time.

public unsafe void render(System.IO.Stream inputStream, void* buffer, int bufferSize)
{
    var doc = (new Aspose.Slides.PresentationFactory()).ReadPresentation(inputStream);

    var slide = doc.Slides[0];
    var size = new System.Drawing.Size(doc.SlideSize.Size.Width, doc.SlideSize.Size.Height);

    var bitmap = slide.GetThumbnail(size);
    var lockRect = new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height);
    var bitmapData = bitmap.LockBits(lockRect, System.Drawing.Imaging.ImageLockMode.ReadOnly, bitmap.PixelFormat);
    try
    {
        IntPtr bmpPtr = bitmapData.Scan0;
        var bytesToCopy = bitmapData.Stride * bitmap.Height;
        if (bytesToCopy > bufferSize)
        {
            throw new Exception("Error");
        }

        for (int i = 0; i < bytesToCopy; ++i)
        {
            ((byte*)buffer)[i] = ((byte*)bmpPtr.ToPointer())[i];
        }
    }
    finally
    {
        bitmap.UnlockBits(bitmapData);
    }
}

@volozyko

I have created a ticket with ID SLIDESNET-42282 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 notified once the issue will be fixed.