Is it possible to generate thumbnails for a pptx file using Syncfusion as oppose to using Aspose?
Here in my generate preview method, I've calculated what the size for each thumbnail should be but it doesn't seem like you can generate thumbnails from the slides like Aspose does.
public override void GeneratePreview(Stream docStream, IPreviewGenerationContext context)
{
docStream.Seek(0, SeekOrigin.Begin);
var pres = Presentation.Open(docStream);
if (context.StartIndex == 0)
context.SetPageCount(pres.Slides.Count);
int firstIndex;
int lastIndex;
var loggedPageError = false;
context.SetIndexes(pres.Slides.Count, out firstIndex, out lastIndex);
// calculate size based on the original aspect ratio and the expected image size.
var sizeF = pres.Slides[0].SlideSize;
var ratio = Math.Min((float)Common.PREVIEW_WIDTH / sizeF.Width,
(float)Common.PREVIEW_HEIGHT / sizeF.Height);
var size = new Size((int)Math.Round(sizeF.Width * ratio),
(int)Math.Round(sizeF.Height * ratio));
for (var i = firstIndex; i <= lastIndex; i++)
{
try
{
var slide = pres.Slides[i];
// generate image
using (var image = slide.GetThumbnail(size)) // Need to be able to generate a thumbnail for each slide.
{
context.SaveImage(image, i + 1);
}
}
catch (Exception ex)
{
if (Tools.HandlePageError(ex, i + 1, context, !loggedPageError))
return;
loggedPageError = true;
}
}
}
}