Please find the snippet below
List<com.aspose.words.FolderFontSource> folderFontSources = new ArrayList<com.aspose.words.FolderFontSource>();
for (String fontFolder : m_fileData.getFontFolders()) {
LOG.debug("Adding folder with path: " + fontFolder + " to word font folder sources.");
folderFontSources.add(new com.aspose.words.FolderFontSource(fontFolder, true));
}
FontSourceBase[] updatedFontSources = (FontSourceBase[]) folderFontSources.toArray(new FontSourceBase[folderFontSources.size()]);
FontSettings.getDefaultInstance().setFontsSources(updatedFontSources);
// set options on generated file
m_wordSaveOptions = new com.aspose.words.HtmlFixedSaveOptions();
m_wordSaveOptions.setSaveFormat(SaveFormat.HTML_FIXED);
m_wordSaveOptions.setEncoding(Charset.defaultCharset());
m_wordSaveOptions.setExportEmbeddedFonts(true);
m_wordSaveOptions.setExportEmbeddedCss(true);
m_wordSaveOptions.setExportEmbeddedImages(true);
m_wordSaveOptions.setExportEmbeddedSvg(true);
m_wordSaveOptions.setExportFormFields(true);
m_wordSaveOptions.setPrettyFormat(true);
m_wordSaveOptions.setUseHighQualityRendering(true);
m_wordSaveOptions.setJpegQuality(90);
m_wordSaveOptions.setPageCount(Integer.MAX_VALUE);
m_wordSaveOptions.setPageMargins(10);
m_wordSaveOptions.setShowPageBorder(false);
m_wordSaveOptions.setDmlEffectsRenderingMode(2);
m_wordSaveOptions.setDmlRenderingMode(1);
m_wordSaveOptions.setDefaultTemplate("");
m_wordSaveOptions.setFontFormat(ExportFontFormat.WOFF);
m_wordSaveOptions.setOptimizeOutput(true);
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
if (m_fileData.getSourceFileTypeCode().intValue() == FILE_FORMAT_DOCX_CODE ||
m_fileData.getSourceFileTypeCode().intValue() == FILE_FORMAT_DOCM_CODE ||
m_fileData.getSourceFileTypeCode().intValue() == FILE_FORMAT_DOC_CODE) {
// Load source document
Document doc = new Document(m_fileData.getSourceFileFullPath());
// Generate docs
doc.setFontSettings(FontSettings.getDefaultInstance());
doc.save(outStream, m_wordSaveOptions);
If I am running the conversion in a machine by specifying font folders, the font is still not displayed in the rendered HTML, however, we were able to see the font for the same in pdf.Please help us with this issue