Zig
Zig
Save Web Page to MHT String
See more MHT / HTML Email Examples
Downloads a web page into a string variable containing MHT. MHT is a web archive with all images and style sheets embedded. It's a MIME-formatted text document. When saved with the .mht extension, Internet Explorer can open and display the page.Chilkat Zig Downloads
const std = @import("std");
const chilkat = @import("chilkat");
pub fn main(init: std.process.Init) !void {
const alloc = init.arena.allocator();
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
const mht = try chilkat.Mht.init();
defer mht.deinit();
const mht_str = mht.getMHT(alloc, "http://www.google.com/") catch "";
if (!mht.getLastMethodSuccess()) {
std.debug.print("{s}\n", .{try mht.getLastErrorText(alloc)});
} else {
std.debug.print("{s}\n", .{mht_str});
}
}