MHTMLSaveOptions Class

MHTMLSaveOptions class

Represents MHTML save options. By assigning specific properties you can manage resource processing such as max handling depth and so on. More info see in documentation article.

public class MHTMLSaveOptions : SaveOptions


MHTMLSaveOptions()The default constructor.


getResourceHandlingOptions Gets a ResourceHandlingOptions object which is used for configuration of resources handling.


You can find complete examples and data files on GitHub.


import com.aspose.html;
import com.aspose.html.Converters;
import com.aspose.html.Saving;
import System;
import System.IO;
	 // Prepare HTML code with a link to another file and save it to the file as 'document.html'
      var code = "<span>Hello, World!!</span> " +
            "<a href='document2.html'>click</a>";
      File.WriteAllText("document.html", code);

      // Prepare HTML code and save it to the file as 'document2.html'
      code = @"<span>Hello, World!!</span>";
      File.WriteAllText("document2.html", code);
      String savePath = Path.Combine(OutputDir, "output-options.mht");

      // Change the value of the resource linking depth to 1 in order to convert document with directly linked resources
      var options = new MHTMLSaveOptions()
        ResourceHandlingOptions =
          MaxHandlingDepth = 1

      // Convert HTML to MHTML
      Converter.ConvertHTML("document.html", options, savePath);  

See Also