In this quick tutorial you will learn how to convert PDF to HTML in Java. One can easily save PDF to HTML in Java by adopting simple steps and code executing in Windows, macOS, or Linux with no dependence on Adobe Acrobat or any other third party tool.
Steps to Convert PDF to HTML in Java
- Configure your project to add Aspose.PDF for Java reference from the Maven repository
- Add a reference to Aspose.PDF namespace in your project
- Instantiate Document class object to load PDF for exporting to HTML
- Create HtmlSaveOptions object to set different HTML options
- Convert PDF to HTML in Java by using Save method
In order to develop PDF to HTML converter Java based application can be used. The process will commence by including API reference and loading source PDF file from disk. In subsequent steps, HtmlSaveOptions class will be used to set desired HTML file export options. Lastly, the generated HTML will be saved by using Save method and SaveFormat.Html enumerator.
Code to Save PDF to HTML in Java
By using above example in Java PDF to HTML conversion can be easily achieved. We have customized the HTML output by using HtmlSaveOptions class which offers the provision to set the SVG export options like compression and SVG content along with path settings for exported images from source PDF. You can also manage fonts inside exported HTML along with option to split PDF pages to multi page HTML output. Finally, we can save the generated HTML either on disk or in a MemoryStream for further usage.
In the above example, we have learned to convert PDF to HTML in Java with a customized output. If you are looking to create a PDF programmatically, refer to the article on how to Create PDF using Java.