exportFontsAsBase64 property
HtmlSaveOptions.exportFontsAsBase64 property
Specifies whether fonts resources should be embedded to HTML in Base64 encoding.
Default is false.
get exportFontsAsBase64(): boolean
Remarks
By default, fonts are written to separate files. If this option is set to true, fonts will be embedded
into the document’s CSS in Base64 encoding.
Examples
Shows how to save a .html document with images embedded inside it.
let doc = new aw.Document(base.myDir + "Rendering.docx");
let options = new aw.Saving.HtmlSaveOptions();
options.exportImagesAsBase64 = exportImagesAsBase64;
options.prettyFormat = true;
doc.save(base.artifactsDir + "HtmlSaveOptions.exportImagesAsBase64.html", options);
let outDocContents = fs.readFileSync(base.artifactsDir + "HtmlSaveOptions.exportImagesAsBase64.html").toString();
expect(exportImagesAsBase64
? outDocContents.includes("<img src=\"data:image/png;base64")
: outDocContents.includes("<img src=\"HtmlSaveOptions.exportImagesAsBase64.001.png\"")).toBe(true);
Shows how to embed fonts inside a saved HTML document.
let doc = new aw.Document(base.myDir + "Rendering.docx");
let options = new aw.Saving.HtmlSaveOptions();
options.exportFontsAsBase64 = true;
options.cssStyleSheetType = aw.Saving.CssStyleSheetType.Embedded;
options.prettyFormat = true;
doc.save(base.artifactsDir + "HtmlSaveOptions.exportFontsAsBase64.html", options);
See Also
- module Aspose.Words.Saving
- class HtmlSaveOptions