Sample code for 30+ languages & platforms
Java

Save Web Page as .mht Web Archive

See more MHT / HTML Email Examples

Downloads a web page into a .mht web archive.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Mht;

public class ChilkatExample {

    public static void main(String[] args) {
        // This example assumes the Chilkat API to have been previously unlocked.
        // See Global Unlock Sample for sample code.

        Mht mht = new Mht();

        try {
            mht.getAndSaveMHT("http://www.bonairefishing.com/", "bonairefishing.mht");
            System.out.println("MHT Created!");
        } catch (ChilkatException e) {
            System.out.println(e.getLastErrorText());
            return;
        }
    }
}