Convert XPS to MHTML Files Online using App
- Upload XPS files to convert
- Wait for few seconds or more depending on XPS size
- Keep an eye on uploading status bar
- Click the “Convert” button
- XPS will be converted into MHTML document
- Download the converted MHTML file
Convert XPS to MHTML via Java Automation API
Few more cases for saving XPS to MHTML with other features like Open Password Protected XPS Document via Java, Save MHTML Document to a Database via Java.
Document document = new Document("input.xps", "password");
// save XPS as a DOC
document.save("DocOutput.doc", SaveFormat.DOC);
public static void StoreToDatabase(Document doc, Connection mConnection) throws Exception {
// create an output stream which uses byte array to save data
ByteArrayOutputStream aout = new ByteArrayOutputStream();
// save the document to byte array
doc.save(aout, SaveFormat.MHTML);
// get the byte array from output steam
// the byte array now contains the document
byte[] buffer = aout.toByteArray();
// get the filename from the document.
String fileName = doc.getOriginalFileName();
String filePath = fileName.replace("\\", "\\\\");
// create the SQL command.
String commandString = "INSERT INTO Documents (FileName, FileContent) VALUES('" + filePath + "', '" + buffer + "')";
Statement statement = mConnection.createStatement();
statement.executeUpdate(commandString);
}
Develop XPS File Conversion Application using Java
Need to develop Java based software application to easily save and export XPS files to MHTML document ? With
Aspose.Total for Java
, any Java developer can integrate the above API code to program the conversion application across variety of formats including Microsoft Word (DOC, DOCX), Excel (XLS, XLSX), Powerpoint (PPT, PPTX), PDF, Email files, Images (JPG, PNG, BMP, GIF) and other formats. Powerful Java library for document conversion, supports many popular formats including XPS format. Exporting and rendering documents to other formats, programmers can use Aspose.Total for Java child APIs inlcluding
Aspose.Words for Java
,
Aspose.Cells for Java
,
Aspose.Slides for Java
,
Aspose.PDF for Java
,
Aspose.Imaging for Java
and more.
XPS Conversion Library for Java
There are alternative options to integrate Aspose.Total for Java onto your system. Please choose one that resembles your needs and follow the step-by-step instructions:
- Use Aspose.Total for Java directly from a Maven based project and include relevant child API in pom.xml.
- Alternatively, one can get a ZIP file from downloads .
Saving XPS to MHTML App Requirements
Any Operating System that can run the Java Runtime Environment (JRE) can run Aspose.Total for Java. The following lists mostly, but not all, supported Operating Systems.
- Microsoft Windows
- Linux : Ubuntu, OpenSUSE, CentOS and others
- macOS : 10.9 (Mavericks) and later
- Mobile : Android, iOS