PowerBuilder
PowerBuilder
Exclude Resources Matching a Pattern
See more MHT / HTML Email Examples
Demonstrates Mht.ExcludeImagesMatching, which adds an exclusion pattern used while gathering embeddable resources, so matching resources are omitted from the archive.
Background. Despite the method name, the test applies to embeddable resources generally, not only images. Each candidate is tested against its fully resolved reference — an absolute URL for web content, or the resolved local path for a local resource.
Chilkat PowerBuilder Downloads
integer li_rc
oleobject loo_Mht
string ls_MhtText
loo_Mht = create oleobject
li_rc = loo_Mht.ConnectToNewObject("Chilkat.Mht")
if li_rc < 0 then
destroy loo_Mht
MessageBox("Error","Connecting to COM object failed")
return
end if
// Add an exclusion pattern for embeddable resources. Each candidate resource is tested against its
// fully resolved reference (an absolute URL for web content), so resources whose reference matches
// the pattern are omitted from the archive. Here, resources ending in ".gif" are excluded.
loo_Mht.ExcludeImagesMatching("*.gif")
// Create the MHT web archive without the excluded resources.
ls_MhtText = loo_Mht.GetMHT("https://example-code.com/crumb/index.html")
if loo_Mht.LastMethodSuccess = 0 then
Write-Debug loo_Mht.LastErrorText
destroy loo_Mht
return
end if
Write-Debug ls_MhtText
destroy loo_Mht