|
(Java) Pack Local HTML File and Referenced Images as MHT Archive
Demonstrates how to pack a local HTML file and referenced files (images, style sheets, etc.) into a .mht web archive.
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkMht mht = new CkMht();
boolean success = mht.GetAndSaveMHT("C:/AAWorkarea/mht_unpack/test.html","qa_output/test.mht");
if (success == false) {
System.out.println(mht.lastErrorText());
return;
}
else {
System.out.println("MHT Created!");
}
}
}
|