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 save() method.

    import aspose.pdf as ap

    input_pdf = DIR_INPUT + "sample.pdf"
    output_pdf = DIR_OUTPUT + "convert_pdf_to_html.html"
    # Open PDF document
    document = ap.Document(input_pdf)

    # save document in HTML format
    save_options = ap.HtmlSaveOptions()
    document.save(output_pdf, save_options)

See Also

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

Format: HTML