VintaSoft Imaging .NET SDK 15.1: Документация для .NET разработчика
В этом разделе
    Кодеки: Как сконвертировать страницы PPTX документа в PNG файлы?
    В этом разделе
    VintaSoft Imaging .NET SDK может сконвертировать страницы PPTX документа в растровые изображения и сохранить отрендеренные изображения в файлах изображений.

    Для выполнения приведенного ниже кода необходимо:
    Вот C#/VB.NET код, который показывает, как сконвертировать страницы документа PPTX в файлы PNG:
    /// <summary>
    /// Converts pages of PPTX document to PNG files.
    /// </summary>
    public static void ConvertPptxToPng(string pptxFileName)
    {
        // specify that VintaSoft Imaging .NET SDK should use GDI+ for drawing of 2D graphics
        Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsFactory.SetAsDefault();
        // specify that VintaSoft Imaging .NET SDK should use SkiaSharp for drawing of 2D graphics
        //Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault();
    
        // create image collection
        using (Vintasoft.Imaging.ImageCollection images = new Vintasoft.Imaging.ImageCollection())
        {
            // add PPTX document to the image collection
            images.Add(pptxFileName);
    
            // create PNG encoder
            using (Vintasoft.Imaging.Codecs.Encoders.PngEncoder pngEncoder =
                new Vintasoft.Imaging.Codecs.Encoders.PngEncoder())
            {
                // for each page in PPTX document
                for (int i = 0; i < images.Count; i++)
                {
                    // save rendered image to a PNG file
                    images[i].Save(string.Format("page{0}.png", i), pngEncoder);
                }
            }
    
            // dispose images
            images.ClearAndDisposeItems();
        }
    }
    
    ''' <summary>
    ''' Converts pages of PPTX document to PNG files.
    ''' </summary>
    Public Shared Sub ConvertPptxToPng(pptxFileName As String)
        ' specify that VintaSoft Imaging .NET SDK should use GDI+ for drawing of 2D graphics
        Vintasoft.Imaging.Drawing.Gdi.GdiGraphicsFactory.SetAsDefault()
        ' specify that VintaSoft Imaging .NET SDK should use SkiaSharp for drawing of 2D graphics
        'Vintasoft.Imaging.Drawing.SkiaSharp.SkiaSharpDrawingFactory.SetAsDefault()
    
        ' create image collection
        Using images As New Vintasoft.Imaging.ImageCollection()
            ' add PPTX document to the image collection
            images.Add(pptxFileName)
    
            ' create PNG encoder
            Using pngEncoder As New Vintasoft.Imaging.Codecs.Encoders.PngEncoder()
                ' for each page in PPTX document
                For i As Integer = 0 To images.Count - 1
                    ' save rendered image to a PNG file
                    images(i).Save(String.Format("page{0}.png", i), pngEncoder)
                Next
            End Using
    
            ' dispose images
            images.ClearAndDisposeItems()
        End Using
    End Sub