.NET에서 PDF 또는 HTML에서 프레젠테이션 가져오기

소개

Aspose.Slides를 사용하면 다른 형식의 파일에서 프레젠테이션을 가져올 수 있습니다. Aspose.Slides는 PDF 및 HTML 문서에서 프레젠테이션을 가져올 수 있는 SlideCollection 클래스를 제공합니다.

PDF에서 PowerPoint 가져오기

이 경우 PDF를 PowerPoint 프레젠테이션으로 변환합니다.

pdf-to-powerpoint

  1. Presentation 클래스의 인스턴스를 생성합니다.
  2. AddFromPdf 메서드를 호출하고 PDF 파일을 전달합니다.
  3. Save 메서드를 사용하여 파일을 PowerPoint 형식으로 저장합니다.

다음 C# 코드는 PDF를 PowerPoint로 변환하는 작업을 보여줍니다:

using (Presentation pres = new Presentation())
{
    pres.Slides.AddFromPdf("InputPDF.pdf");
    pres.Save("OutputPresentation.pptx", SaveFormat.Pptx);
}

HTML에서 PowerPoint 가져오기

이 경우 HTML 문서를 PowerPoint 프레젠테이션으로 변환합니다.

  1. Presentation 클래스의 인스턴스를 생성합니다.
  2. AddFromHtml 메서드를 호출하고 HTML 파일을 전달합니다.
  3. Save 메서드를 사용하여 파일을 PowerPoint 문서로 저장합니다.

다음 C# 코드는 HTML을 PowerPoint로 변환하는 작업을 보여줍니다:

using (var presentation = new Presentation())
{
    using (var htmlStream = File.OpenRead("page.html"))
    {
        presentation.Slides.AddFromHtml(htmlStream);
    }

    presentation.Save("MyPresentation.pptx", SaveFormat.Pptx);
}

FAQ

PDF를 가져올 때 표가 유지되며, 표 감지를 개선할 수 있나요?

가져오는 동안 표를 감지할 수 있습니다; PdfImportOptions에는 표 인식을 활성화하는 DetectTables 매개변수가 포함되어 있습니다. 효과는 PDF의 구조에 따라 달라집니다.