public class FontSavingArgs
extends java.lang.Object
IFontSavingCallback.fontSaving(com.aspose.words.FontSavingArgs) event.
To learn more, visit the Save a Document documentation article.
When Aspose.Words saves a document to HTML or related formats and HtmlSaveOptions.getExportFontResources() / HtmlSaveOptions.setExportFontResources(boolean) is set to true, it saves each font subject for export into a separate file.
FontSavingArgs controls whether particular font resource should be exported and how.
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 isExportNeeded() / isExportNeeded(boolean) property.
To save fonts into streams instead of files, use the P:Aspose.Words.Saving.FontSavingArgs.FontStream property.
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBold()
Indicates whether the current font is bold.
|
Document |
getDocument()
Gets the document object that is being saved.
|
java.lang.String |
getFontFamilyName()
Indicates the current font family name.
|
java.lang.String |
getFontFileName()
Gets the file name (without path) where the font will be saved to.
|
java.io.OutputStream |
getFontStream() |
boolean |
getItalic()
Indicates whether the current font is italic.
|
boolean |
getKeepFontStreamOpen()
Specifies whether Aspose.Words should keep the stream open or close it after saving a font.
|
java.lang.String |
getOriginalFileName()
Gets the original font file name with an extension.
|
int |
getOriginalFileSize()
Gets the original font file size.
|
boolean |
isExportNeeded()
Allows to specify whether the current font will be exported as a font resource.
|
void |
isExportNeeded(boolean value)
Allows to specify whether the current font will be exported as a font resource.
|
boolean |
isSubsettingNeeded()
Allows to specify whether the current font will be subsetted before exporting as a font resource.
|
void |
isSubsettingNeeded(boolean value)
Allows to specify whether the current font will be subsetted before exporting as a font resource.
|
void |
setFontFileName(java.lang.String value)
Sets the file name (without path) where the font will be saved to.
|
void |
setFontStream(java.io.OutputStream value) |
void |
setKeepFontStreamOpen(boolean value)
Specifies whether Aspose.Words should keep the stream open or close it after saving a font.
|
public Document getDocument()
public java.lang.String getFontFamilyName()
String value.public boolean getBold()
boolean value.public boolean getItalic()
boolean value.public java.lang.String getOriginalFileName()
This property contains the original file name of the current font if it is known. Otherwise it can be an empty string.
getOriginalFileSize()public int getOriginalFileSize()
This property contains the original file size of the current font if it is known. Otherwise it can be zero.
getOriginalFileName(),
isSubsettingNeeded(),
isSubsettingNeeded(boolean)public boolean isExportNeeded()
true.boolean value.public void isExportNeeded(boolean value)
true.value - The corresponding boolean value.public boolean isSubsettingNeeded()
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 HtmlSaveOptions.getFontResourcesSubsettingSizeThreshold() / HtmlSaveOptions.setFontResourcesSubsettingSizeThreshold(int). You can override this behavior for individual fonts by setting the isSubsettingNeeded() / isSubsettingNeeded(boolean) property.
boolean value.public void isSubsettingNeeded(boolean value)
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 HtmlSaveOptions.getFontResourcesSubsettingSizeThreshold() / HtmlSaveOptions.setFontResourcesSubsettingSizeThreshold(int). You can override this behavior for individual fonts by setting the isSubsettingNeeded() / isSubsettingNeeded(boolean) property.
value - The corresponding boolean value.public java.lang.String getFontFileName()
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
When saving a document to a stream, the generated font file name looks like Aspose.Words.
getFontFileName() / setFontFileName(java.lang.String) must contain only the file name without the path. Aspose.Words determines the path for saving using the document file name, the HtmlSaveOptions.getFontsFolder() / HtmlSaveOptions.setFontsFolder(java.lang.String) and HtmlSaveOptions.getFontsFolderAlias() / HtmlSaveOptions.setFontsFolderAlias(java.lang.String) properties.
HtmlSaveOptions.getFontsFolder(),
HtmlSaveOptions.setFontsFolder(java.lang.String),
HtmlSaveOptions.getFontsFolderAlias(),
HtmlSaveOptions.setFontsFolderAlias(java.lang.String)public void setFontFileName(java.lang.String value)
throws java.lang.Exception
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
When saving a document to a stream, the generated font file name looks like Aspose.Words.
getFontFileName() / setFontFileName(java.lang.String) must contain only the file name without the path. Aspose.Words determines the path for saving using the document file name, the HtmlSaveOptions.getFontsFolder() / HtmlSaveOptions.setFontsFolder(java.lang.String) and HtmlSaveOptions.getFontsFolderAlias() / HtmlSaveOptions.setFontsFolderAlias(java.lang.String) properties.
value - The file name (without path) where the font will be saved to.java.lang.ExceptionHtmlSaveOptions.getFontsFolder(),
HtmlSaveOptions.setFontsFolder(java.lang.String),
HtmlSaveOptions.getFontsFolderAlias(),
HtmlSaveOptions.setFontsFolderAlias(java.lang.String)public boolean getKeepFontStreamOpen()
Default is false and Aspose.Words will close the stream you provided in the P:Aspose.Words.Saving.FontSavingArgs.FontStream property after writing a font into it. Specify true to keep the stream open.
boolean value.public void setKeepFontStreamOpen(boolean value)
Default is false and Aspose.Words will close the stream you provided in the P:Aspose.Words.Saving.FontSavingArgs.FontStream property after writing a font into it. Specify true to keep the stream open.
value - The corresponding boolean value.public java.io.OutputStream getFontStream()
public void setFontStream(java.io.OutputStream value)