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

    Для выполнения приведенного ниже кода необходимо:
    Вот C#/VB.NET код, который показывает, как преобразовать документ PPTX в документ PDF:
    /// <summary>
    /// Converts PPTX document to a PDF document using ImageCollection and PdfEncoder classes.
    /// </summary>
    public static void ConvertPptxToPdf(string pptxFileName, string pdfFileName)
    {
        // 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 imageCollection = new Vintasoft.Imaging.ImageCollection())
        {
            // add PPTX document to collection
            imageCollection.Add(pptxFileName);
    
            // create pdfEncoder
            using (Vintasoft.Imaging.Codecs.Encoders.PdfEncoder pdfEncoder = 
                new Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(true))
            {
                // set comression for image resources
                pdfEncoder.Settings.Compression = Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Jpeg;
    
                // save images of image collection to PDF document using PdfEncoder
                imageCollection.SaveSync(pdfFileName, pdfEncoder);
            }
    
            // dispose images
            imageCollection.ClearAndDisposeItems();
        }
    }
    
    ''' <summary>
    ''' Converts PPTX document to a PDF document using ImageCollection and PdfEncoder classes.
    ''' </summary>
    Public Shared Sub ConvertPptxToPdf(pptxFileName As String, pdfFileName 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 imageCollection As New Vintasoft.Imaging.ImageCollection()
            ' add PPTX document to collection
            imageCollection.Add(pptxFileName)
    
            ' create pdfEncoder
            Using pdfEncoder As New Vintasoft.Imaging.Codecs.Encoders.PdfEncoder(True)
                ' set comression for image resources
                pdfEncoder.Settings.Compression = Vintasoft.Imaging.Codecs.Encoders.PdfImageCompression.Jpeg
    
                ' save images of image collection to PDF document using PdfEncoder
                imageCollection.SaveSync(pdfFileName, pdfEncoder)
            End Using
    
            ' dispose images
            imageCollection.ClearAndDisposeItems()
        End Using
    End Sub