Class FontSavingArgs
Namespace: Aspose.Words.Saving
Assembly: Aspose.Words.dll (25.3.0)
Provides data for the Aspose.Words.Saving.IFontSavingCallback.FontSaving(Aspose.Words.Saving.FontSavingArgs) event.
To learn more, visit the Save a Document documentation article.
public class FontSavingArgs
Inheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
When Aspose.Words saves a document to HTML or related formats and Aspose.Words.Saving.HtmlSaveOptions.ExportFontResources
is set to true
, it saves each font subject for export into a separate file.
Aspose.Words.Saving.FontSavingArgs controls whether particular font resource should be exported and how.
Aspose.Words.Saving.FontSavingArgs also allows to redefine how font file names are generated or to completely circumvent saving of fonts into files by providing your own stream objects.
To decide whether to save a particular font resource, use the Aspose.Words.Saving.FontSavingArgs.IsExportNeeded property.
To save fonts into streams instead of files, use the Aspose.Words.Saving.FontSavingArgs.FontStream property.
Properties
Bold
Indicates whether the current font is bold.
public bool Bold { get; }
Property Value
Document
Gets the document object that is being saved.
public Document Document { get; }
Property Value
FontFamilyName
Indicates the current font family name.
public string FontFamilyName { get; }
Property Value
FontFileName
Gets or sets the file name (without path) where the font will be saved to.
public string FontFileName { get; set; }
Property Value
Remarks
This property allows you to redefine how the font file names are generated during export to HTML.
When the event is fired, this property contains the file name that was generated by Aspose.Words. You can change the value of this property to save the font into a different file. Note that file names must be unique.
Aspose.Words automatically generates a unique file name for every embedded font when exporting to HTML format. How the font file name is generated depends on whether you save the document to a file or to a stream.
When saving a document to a file, the generated font file name looks like <document base file name>.<original file name><optional suffix>.<extension>.
When saving a document to a stream, the generated font file name looks like Aspose.Words.<document guid>.<original file name><optional suffix>.<extension>.
Aspose.Words.Saving.FontSavingArgs.FontFileName must contain only the file name without the path. Aspose.Words determines the path for saving using the document file name, the Aspose.Words.Saving.HtmlSaveOptions.FontsFolder and Aspose.Words.Saving.HtmlSaveOptions.FontsFolderAlias properties.
Aspose.Words.Saving.FontSavingArgs.FontStream Aspose.Words.Saving.HtmlSaveOptions.FontsFolder Aspose.Words.Saving.HtmlSaveOptions.FontsFolderAliasFontStream
Allows to specify the stream where the font will be saved to.
public Stream FontStream { get; set; }
Property Value
Remarks
This property allows you to save fonts to streams instead of files during HTML export.
The default value is null
. When this property is null
, the font
will be saved to a file specified in the Aspose.Words.Saving.FontSavingArgs.FontFileName property.
IsExportNeeded
Allows to specify whether the current font will be exported as a font resource. Default is true
.
public bool IsExportNeeded { get; set; }
Property Value
IsSubsettingNeeded
Allows to specify whether the current font will be subsetted before exporting as a font resource.
public bool IsSubsettingNeeded { get; set; }
Property Value
Remarks
Fonts can be exported as complete original font files or subsetted to include only the characters that are used in the document. Subsetting allows to reduce the resulting font resource size.
By default, Aspose.Words decides whether to perform subsetting or not by comparing the original font file size with the one specified in Aspose.Words.Saving.HtmlSaveOptions.FontResourcesSubsettingSizeThreshold. You can override this behavior for individual fonts by setting the Aspose.Words.Saving.FontSavingArgs.IsSubsettingNeeded property.
Italic
Indicates whether the current font is italic.
public bool Italic { get; }
Property Value
KeepFontStreamOpen
Specifies whether Aspose.Words should keep the stream open or close it after saving a font.
public bool KeepFontStreamOpen { get; set; }
Property Value
Remarks
Default is false
and Aspose.Words will close the stream you provided
in the Aspose.Words.Saving.FontSavingArgs.FontStream property after writing a font into it.
Specify true
to keep the stream open.
OriginalFileName
Gets the original font file name with an extension.
public string OriginalFileName { get; }
Property Value
Remarks
This property contains the original file name of the current font if it is known. Otherwise it can be an empty string.
Aspose.Words.Saving.FontSavingArgs.OriginalFileSizeOriginalFileSize
Gets the original font file size.
public int OriginalFileSize { get; }
Property Value
Remarks
This property contains the original file size of the current font if it is known. Otherwise it can be zero.
Aspose.Words.Saving.FontSavingArgs.OriginalFileName Aspose.Words.Saving.FontSavingArgs.IsSubsettingNeeded