天天看點

C# PDF操作之-PDF轉PPT

特别說明:需引用Aspose.PDF.dll

代碼案例:

using System;
using System.IO;
using Aspose.Pdf;

namespace Aspose.Pdf.Examples.CSharp.AsposePDF.DocumentConversion
{
    public class PDFToPPT
    {
        public static void Run()
        {
            // ExStart:PDFToPPT
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
            // Load PDF document
            Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "input.pdf");
            // Instantiate PptxSaveOptions instance
            Aspose.Pdf.PptxSaveOptions pptx_save = new Aspose.Pdf.PptxSaveOptions();
            // Save the output in PPTX format
            doc.Save(dataDir + "PDFToPPT_out.pptx", pptx_save);
            // ExEnd:PDFToPPT
        }

        public static void PDFtoPPTXWithSlidesAsImages()
        {
            //ExStart: PDFtoPPTXWithSlidesAsImages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_DocumentConversion();
            // Load PDF document
            Aspose.Pdf.Document doc = new Aspose.Pdf.Document(dataDir + "input.pdf");
            // Instantiate PptxSaveOptions instance
            Aspose.Pdf.PptxSaveOptions pptx_save = new Aspose.Pdf.PptxSaveOptions();
            // Save the output in PPTX format
            pptx_save.SlidesAsImages = true;
            doc.Save(dataDir + "PDFToPPT_out_.pptx", pptx_save);
            //ExEnd: PDFtoPPTXWithSlidesAsImages
        }
    }
}