We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

FontSources points to the resources\fonts folder in jar

For the ease of deployment, is it possible to set the fontsSource to the resource folder of the application jar?

For example:

includeFontsSources("**classpath:fonts**")

private fun includeFontsSources(fontFolder:String) {
    val fontfolders = com.aspose.words.SystemFontSource.getSystemFontFolders()
    log.info("fontfolders : ${fontfolders.toList()}")

    val fontSetting = com.aspose.words.FontSettings.getDefaultInstance()
    val newFontSource = com.aspose.words.FolderFontSource(fontFolder, true)
    val newFontSources = fontSetting.fontsSources + newFontSource
    com.aspose.words.FontSettings.getDefaultInstance().fontsSources = newFontSources
}

@kslau

You can use FontSettings.SetFontsSources method to set the sources where Aspose.Words looks for TrueType fonts when rendering documents or embedding fonts. You can use resources folder for fonts as shown in following code snippet.

FontSettings.getDefaultInstance().setFontsSources(
		new FontSourceBase[] { new SystemFontSource(), new FolderFontSource("path to resource folder", true) });

We suggest you please read the following article for more detail.