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

소개

Using Aspose.Slides for C++, you can import presentations from files in other formats. Aspose.Slides provides the SlideCollection class to allow you to import presentations from PDF, HTML documents, etc.

PDF에서 PowerPoint 가져오기

In this case, you get to convert a PDF to a PowerPoint presentation.

pdf-to-powerpoint

  1. 프레젠테이션 클래스의 객체를 인스턴스화합니다.
  2. PDF 파일을 전달하여 AddFromPdf() 메서드를 호출합니다.
  3. PowerPoint 형식으로 파일을 저장하기 위해 Save() 메서드를 사용합니다.

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

auto pres = System::MakeObject<Presentation>();
    
pres->get_Slides()->AddFromPdf(u"InputPDF.pdf");
pres->Save(u"OutputPresentation.pptx", SaveFormat::Pptx);

HTML에서 PowerPoint 가져오기

In this case, you get to convert a HTML document to a PowerPoint presentation.

  1. Presentation 클래스의 인스턴스를 생성합니다.
  2. HTML 파일을 전달하여 AddFromHtml() 메서드를 호출합니다.
  3. PowerPoint 형식으로 파일을 저장하기 위해 Save() 메서드를 사용합니다.

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

auto presentation = System::MakeObject<Presentation>();

{
    auto htmlStream = System::IO::File::OpenRead(u"page.html");
    presentation->get_Slides()->AddFromHtml(htmlStream);
}

presentation->Save(u"MyPresentation.pptx", SaveFormat::Pptx);

FAQ

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

표는 가져오는 동안 감지될 수 있습니다. PdfImportOptions에는 표 인식을 활성화하는 set_DetectTables 메서드가 포함되어 있습니다. 효과는 PDF의 구조에 따라 달라집니다.