Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Aspose.HTML for Java converts MHTML or MHT archives to PDF, XPS, DOCX, JPG, PNG, BMP, GIF, and TIFF. Open the source as a file, stream, or URL, create the save options for the required output, and call Converter.convertMHTML().
MHTML, also known as MIME HTML, is a MIME-based web archive format described in
RFC 2557 and commonly stored with the .mht or .mhtml extension. It packages HTML markup and handled resources, such as stylesheets and images, into one archive. Converting MHTML is useful when an archived web page must be distributed, printed, edited, or represented as a static image.
PdfSaveOptions, XpsSaveOptions, DocSaveOptions, or ImageSaveOptions.The following example opens sample.mht as a FileInputStream, uses the default PdfSaveOptions, and converts the archive to convert-by-two-lines.pdf.
1// Convert MHTML to PDF using Java
2
3// Open an existing MHTML file for reading
4java.io.FileInputStream fileInputStream = new java.io.FileInputStream("sample.mht");
5
6// Invoke the convertMHTML() method to convert MHTML to PDF
7Converter.convertMHTML(fileInputStream, new PdfSaveOptions(), "convert-by-two-lines.pdf");Download complete Java examples and data files from GitHub.
Use the free online MHTML Converter for quick manual conversion to PDF, XPS, DOCX, or image formats without writing Java code. Use Aspose.HTML for Java when MHTML conversion must run programmatically.
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.