可以使用 Aspose.Slides for .NET Core 库将 .pptx 文件转换为 pdf 文件。以下是一个示例代码:

using Aspose.Slides;
using System.IO;

namespace PPTXtoPDFConverter
{
    class Program
    {
        static void Main(string[] args)
        {
            string pptxFile = 'example.pptx';
            string pdfFile = 'example.pdf';

            using (var pptxStream = new FileStream(pptxFile, FileMode.Open))
            {
                var presentation = new Presentation(pptxStream);

                using (var pdfStream = new FileStream(pdfFile, FileMode.Create))
                {
                    presentation.Save(pdfStream, SaveFormat.Pdf);
                }
            }
        }
    }
}

请注意,为了使用 Aspose.Slides for .NET Core 库,您需要先安装它。可以使用 NuGet 包管理器或手动下载并安装该库。

使用 Aspose.Slides 将 .pptx 文件转换为 PDF 文件(.NET Core 5.0)

原文地址: https://www.cveoy.top/t/topic/omXc 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录