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.
Try to convert PDF to HTML online
Aspose.PDF for Python presents you online free application “PDF to HTML”, where you may try to investigate the functionality and quality it works.
Steps: Convert PDF to HTML in Python
- Create an instance of Document object with the source PDF document.
- 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