MHTML Converter – Aspose.HTML for Java
MHTML is a web page archive format that allows embedding multiple resources, such as images, CSS styles, audio, and video files, into a single file, typically with a .mht file extension. MHTML format allows a web page to be saved and sent as a single file, preserving its appearance and interactivity. It can be opened by most web browsers. But sometimes, you want to Convert MHTML to get the advantages of other formats.
Aspose.HTML for Java provides a wide range of MHTML conversions to popular formats, such as PDF, XPS, DOCX, JPG, PNG, BMP, TIFF, and GIF.
This section provides information on the list of supported MHTML conversions and how to perform them using convertMHTML()
methods of the
Converter class. It can be different scenarios, but any MHTML conversion can be made with a few required steps:
- Load an existing MHTML file. You can load MHTML from a file, stream, or URL.
- Create a SaveOptions object. You may customize the rendering process to get the desired result.
- Use one of the
convertMHTML()
methods and pass the required parameters to it.
Let’s consider the following code snippet that shows how to convert MHTML to PDF using our Java library:
1// Open an existing MHTML file for reading.
2java.io.FileInputStream fileInputStream = new java.io.FileInputStream($i("sample.mht"));
3
4// Invoke the ConvertMHTML() method to convert MHTML to PDF
5Converter.convertMHTML(fileInputStream, new PdfSaveOptions(), $o("convert-by-two-lines.pdf"));
Popular MHTML Conversions
- Convert MHTML to PDF – Learn how to convert MHTML to PDF using Java library.
- Convert MHTML to XPS – Consider various MHTML to XPS conversion scenarios in Java code.
- Convert MHTML to JPG – Learn how to convert MHTML to JPG with Aspose.HTML for Java, and you can easily use the Java code described here to convert MHTML to PNG, MHTML to BMP, MHTML to GIF, and MHTML to TIFF.
- Convert MHTML to PNG – Know how to convert MHTML to PNG using the
convertMHTML()
methods of the Converter class and how to applyImageSaveOptions
.
You can download the complete examples and data files from GitHub.
Aspose.HTML provides a free online MHTML Converter that enables you to convert MHTML files to various popular formats. This tool can easily convert MHTML to PDF, XPS, DOCX, JPG, PNG, BMP, TIFF, and GIF. The conversion process is simple and fast. You don’t need any additional software. The best part is that it’s completely free!