HtmlSaveOptions.ExportCidUrlsForMhtmlResources

HtmlSaveOptions ExportCidUrlsForMhtmlResources property. Specifies whether to use CID ContentID URLs to reference resources images fonts CSS included in MHTML documents. Default value is false.

HtmlSaveOptions.ExportCidUrlsForMhtmlResources property

Specifies whether to use CID (Content-ID) URLs to reference resources (images, fonts, CSS) included in MHTML documents. Default value is false.

public bool ExportCidUrlsForMhtmlResources { get; set; }

Remarks

This option affects only documents being saved to MHTML.

By default, resources in MHTML documents are referenced by file name (for example, “image.png”), which are matched against “Content-Location” headers of MIME parts.

This option enables an alternative method, where references to resource files are written as CID (Content-ID) URLs (for example, “cid:image.png”) and are matched against “Content-ID” headers.

In theory, there should be no difference between the two referencing methods and either of them should work fine in any browser or mail agent. In practice, however, some agents fail to fetch resources by file name. If your browser or mail agent refuses to load resources included in an MTHML document (doesn’t show images or doesn’t load CSS styles), try exporting the document with CID URLs.

Examples

Shows how to specify whether to use CID (Content-ID) URLs to reference resources (images, fonts, CSS) included in MHTML documents.

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.Mhtml);
htmlSaveOptions.ExportCidUrlsForMhtmlResources = true;

Converter.Create()
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "HtmlSaveOptions.ExportCidUrlsForMhtmlResources.mhtml", htmlSaveOptions)
    .Execute();

See Also