
## 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``.



```js
get exportCidUrlsForMhtmlResources(): boolean
```

### 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 enable content IDs for output MHTML documents.

```js
let doc = new aw.Document(base.myDir + "Rendering.docx");

// Setting this flag will replace "Content-Location" tags
// with "Content-ID" tags for each resource from the input document.
let options = new aw.Saving.HtmlSaveOptions(aw.SaveFormat.Mhtml);
options.exportCidUrlsForMhtmlResources = exportCidUrlsForMhtmlResources;
options.cssStyleSheetType = aw.Saving.CssStyleSheetType.External;
options.exportFontResources = true;
options.prettyFormat = true;

doc.save(base.artifactsDir + "HtmlSaveOptions.ContentIdUrls.mht", options);

let outDocContents = fs.readFileSync(base.artifactsDir + "HtmlSaveOptions.ContentIdUrls.mht").toString();

if (exportCidUrlsForMhtmlResources)
{
  expect(outDocContents.includes("Content-ID: <document.html>")).toEqual(true);
  expect(outDocContents.includes("<link href=3D\"cid:styles.css\" type=3D\"text/css\" rel=3D\"stylesheet\" />")).toEqual(true);
  expect(outDocContents.includes("@font-face { font-family:'Arial Black'; font-weight:bold; src:url('cid:arib=\r\nlk.ttf') }")).toEqual(true);
  expect(outDocContents.includes("<img src=3D\"cid:image.003.jpeg\" width=3D\"350\" height=3D\"180\" alt=3D\"\" />")).toEqual(true);
}
else
{
  expect(outDocContents.includes("Content-Location: document.html")).toEqual(true);
  expect(outDocContents.includes("<link href=3D\"styles.css\" type=3D\"text/css\" rel=3D\"stylesheet\" />")).toEqual(true);
  expect(outDocContents.includes("@font-face { font-family:'Arial Black'; font-weight:bold; src:url('ariblk.t=\r\ntf') }")).toEqual(true);
  expect(outDocContents.includes("<img src=3D\"image.003.jpeg\" width=3D\"350\" height=3D\"180\" alt=3D\"\" />")).toEqual(true);
}
```

### See Also

* module [Aspose.Words.Saving](../../)
* class [HtmlSaveOptions](../)

