Import Presentation

Using Aspose.Slides for Python via .NET, you can import presentations from files in other formats. Aspose.Slides provides the SlideCollection class to allow you to import presentations from PDFs, HTML documents, etc.

Import PowerPoint from PDF

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

pdf-to-powerpoint

  1. Instantiate an object of the presentation class.
  2. Call the add_from_pdf method and pass the PDF file.
  3. Use the save method to save the file in the PowerPoint format.

This Python code demonstrates the PDF to PowerPoint operation:

import aspose.slides as slides

with slides.Presentation() as pres:
    pres.slides.remove_at(0)
    pres.slides.add_from_pdf("welcome-to-powerpoint.pdf")
    pres.save("OutputPresentation.pptx", slides.export.SaveFormat.PPTX)

Import PowerPoint from HTML

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

  1. Create an instance of the Presentation class.
  2. Call the add_from_html method and pass the HTML file.
  3. Use the save method to save the file as a PowerPoint document.

This Python code demonstrates the HTML to PowerPoint operation:

import aspose.slides as slides

with slides.Presentation() as pres:
    with open("page.html", "rb") as htmlStream:
        pres.slides.add_from_html(htmlStream)

    pres.save("MyPresentation.pptx", slides.export.SaveFormat.PPTX)