Convert PDF to HTML in Python

Import PDF pages and publish them as an HTML document with Aspose.Slides for Python via Java.

Convert PDF to HTML in Python

Aspose.Slides for Python via Java can import PDF pages as slides and export their visual content to an HTML document that can be opened in a web browser. The conversion does not require Microsoft PowerPoint or a PDF viewer.

Convert PDF to HTML using Python

Create an empty Presentation, remove its default slide, and call addFromPdf to import the PDF pages. Then call save with SaveFormat.Html to generate an HTML document.

Python code for converting PDF to HTML

presentation = Presentation()
try:
    presentation.getSlides().removeAt(0)
    presentation.getSlides().addFromPdf("document.pdf")
    presentation.save("presentation.html", SaveFormat.Html)
finally:
    presentation.dispose()

How to convert PDF to HTML in Python

Follow these steps to import a PDF document and publish its pages as an HTML document.

  1. Install Aspose.Slides for Python via Java .

  2. Configure the package and start the Java Virtual Machine in your application.

  3. Import the PDF pages by calling addFromPdf on the presentation’s slide collection.

  4. Call save with SaveFormat.Html to write the HTML document.