ExportFontsAsBase64

HtmlSaveOptions.ExportFontsAsBase64 property

Yazı tipi kaynaklarının HTML’ye Base64 kodlamasıyla gömülmesi gerekip gerekmediğini belirtir. VarsayılanYANLIŞ .

public bool ExportFontsAsBase64 { get; set; }

Notlar

Varsayılan olarak, yazı tipleri ayrı dosyalara yazılır. Bu seçenek olarak ayarlanırsadoğru, yazı tipleri Base64 kodlamasıyla belgenin CSS’sine gömülecek .

Örnekler

Kaydedilmiş bir HTML belgesinin içine yazı tiplerinin nasıl yerleştirileceğini gösterir.

Document doc = new Document(MyDir + "Rendering.docx");

HtmlSaveOptions options = new HtmlSaveOptions
{
    ExportFontsAsBase64 = true,
    CssStyleSheetType = CssStyleSheetType.Embedded,
    PrettyFormat = true
};

doc.Save(ArtifactsDir + "HtmlSaveOptions.ExportFontsAsBase64.html", options);

İçerisinde resimler bulunan bir .html belgesinin nasıl kaydedileceğini gösterir.

Document doc = new Document(MyDir + "Rendering.docx");

HtmlSaveOptions options = new HtmlSaveOptions
{
    ExportImagesAsBase64 = exportImagesAsBase64,
    PrettyFormat = true
};

doc.Save(ArtifactsDir + "HtmlSaveOptions.ExportImagesAsBase64.html", options);

string outDocContents = File.ReadAllText(ArtifactsDir + "HtmlSaveOptions.ExportImagesAsBase64.html");

Assert.True(exportImagesAsBase64
    ? outDocContents.Contains("<img src=\"data:image/png;base64")
    : outDocContents.Contains("<img src=\"HtmlSaveOptions.ExportImagesAsBase64.001.png\""));

Ayrıca bakınız