HtmlSaveOptions.FontFaceTypes
Contents
[
Hide
]HtmlSaveOptions.FontFaceTypes property
Gets or sets the font face types.
public FontFaceType FontFaceTypes { get; set; }
Property Value
The font face types.
Examples
Shows how to save a document in html format with storing all resources(css/fonts/images) to a separate files.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Document(Path.Combine(dataDir, "Aspose.one"));
var options = new HtmlSaveOptions()
{
ExportCss = ResourceExportType.ExportAsStream,
ExportFonts = ResourceExportType.ExportAsStream,
ExportImages = ResourceExportType.ExportAsStream,
FontFaceTypes = FontFaceType.Ttf
};
document.Save(dataDir + "document_out.html", options);
Shows how to save a document to a stream in html format with embedding of all resources(css/fonts/images).
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Document(Path.Combine(dataDir, "Aspose.one"));
var options = new HtmlSaveOptions()
{
ExportCss = ResourceExportType.ExportEmbedded,
ExportFonts = ResourceExportType.ExportEmbedded,
ExportImages = ResourceExportType.ExportEmbedded,
FontFaceTypes = FontFaceType.Ttf
};
var r = new MemoryStream();
document.Save(r, options);
Shows how to save a document in html format with storing all resources(css/fonts/images) by using user-defined callbacks.
// The code below creates 'documentFolder' folder containing document.html, 'css' folder with 'style.css' file, 'images' folder with images and 'fonts' folder with fonts.
// 'style.css' file will contain at the end the following string "/* This line is appended to stream manually by user */"
var savingCallbacks = new UserSavingCallbacks()
{
RootFolder = "documentFolder",
CssFolder = "css",
KeepCssStreamOpened = true,
ImagesFolder = "images",
FontsFolder = "fonts"
};
var options = new HtmlSaveOptions
{
FontFaceTypes = FontFaceType.Ttf,
CssSavingCallback = savingCallbacks,
FontSavingCallback = savingCallbacks,
ImageSavingCallback = savingCallbacks
};
if (!Directory.Exists(savingCallbacks.RootFolder))
{
Directory.CreateDirectory(savingCallbacks.RootFolder);
}
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
var document = new Document(Path.Combine(dataDir, "Aspose.one"));
using (var stream = File.Create(Path.Combine(savingCallbacks.RootFolder, "document.html")))
{
document.Save(stream, options);
}
using (var writer = new StreamWriter(savingCallbacks.CssStream))
{
writer.WriteLine();
writer.WriteLine("/* This line is appended to stream manually by user */");
}
See Also
- enum FontFaceType
- class HtmlSaveOptions
- namespace Aspose.Note.Saving
- assembly Aspose.Note