Convert PDF to HTML in Python

Import PDF pages and publish them as HTML with a cross-platform Python API

Convert PDF to HTML in Python

Aspose.Slides for Python via .NET lets you import PDF pages into a presentation and publish the result as HTML. The API provides SlideCollection.add_from_pdf for importing PDF content and Presentation.save with SaveFormat.HTML for creating the output document.

Each PDF page becomes a slide in the presentation before the presentation is exported as a self-contained HTML file. This workflow does not require Microsoft PowerPoint, Adobe Acrobat, or another presentation application.

Convert PDF to HTML using Python

Create a Presentation, remove its default blank slide, import the PDF pages, and save the presentation with SaveFormat.HTML.

Python code for converting PDF into HTML

with slides.Presentation() as presentation:
    presentation.slides.remove_at(0)
    presentation.slides.add_from_pdf("document.pdf")
    presentation.save("document.html", slides.export.SaveFormat.HTML)

How to Convert PDF to HTML Using the Aspose.Slides Python API

These are the steps to convert PDF to HTML in Python.

  1. Install Aspose.Slides for Python via .NET .

  2. Create a Presentation and remove its default blank slide.

  3. Import the source PDF by using SlideCollection.add_from_pdf.

  4. Call Presentation.save with the output path and SaveFormat.HTML.

Convert PDF to Other Supported Formats

You can also convert PDF documents to other supported formats.