Convert PDF to HTML in Python

Overview

This article explains how to convert PDF to HTML using Python. It covers these topics.

Format: HTML

Convert PDF to HTML

Aspose.PDF for Python via .NET provides many features for converting various file formats into PDF documents and converting PDF files into various output formats. This article discusses how to convert a PDF file into HTML. You can use just a couple of lines of code Python for converting PDF To HTML. You may need to convert PDF to HTML if you want to create a website or add content to an online forum. One way to convert PDF to HTML is to programmatically use Python.

Steps: Convert PDF to HTML in Python

  1. Create an instance of Document object with the source PDF document.
  2. Save it to HtmlSaveOptions by calling Document.save() method.


from asposepdf import Api

documentName = "../../testdata/source.pdf"
documentOutName = "../../testout/result.html"
# Open PDF document
document = Api.Document(documentName)

# save document in HTML format
save_options = Api.HtmlSaveOptions()
document.save(documentOutName, save_options)

See Also

This article also covers these topics. The codes are same as above.

Format: HTML