Convert MHTML to XPS – Cloud SDKs and REST API


Aspose.HTML Cloud v4.0 provides the simplest API to convert MHTML documents to XPS format with high quality, easy and fast.

The article explains in a set of code examples how to convert an MHTML document to XPS using Aspose.HTML Cloud client SDKs and REST API calls. SDKs are available in PHP, C++, Ruby, Python, C#, Java, Android, Swift, and Node.js. We will consider various scenarios of MHTML to XPS conversion.

SDK Examples of MHTML to XPS Conversion

A widespread use case for Aspose.HTML Cloud SDK functions is file processing and converting. Cloud SDK allows you to fetch an MHTML document from a storage location by its name or from a local file on your drive, convert it to a specified format, and save it to storage or your local drive. The following code examples demonstrate how to convert MHTML to XPS for different cases using available SDKs and cURL.

Example 1. Convert MHTML file to XPS with default save options

MHTML to XPS conversion occurs with the default conversion options: the resulting XPS document’s width and height correspond to A4, and all margins have zero value.

Example 2. Convert MHTML to XPS with explicitly specified options

The example below demonstrates how to convert an MHTML file from a local file system to XPS with explicitly specified options and save the result back to the local path.

More details about available conversion parameters for MHTML files are in the SDK Conversion Options section.

Example 3. Convert MHTML to XPS inside cloud storage

Aspose.HTML Cloud allows you to get an MHTML file from your cloud storage and save conversion result back to cloud storage. The conversion occurs with default conversion options.

See Also