Free Support Forum - aspose.com

Regarding Embedding desired Font using Aspose.words


#1

I am using latest version of Aspose.words Java.
Is there any possibility to embed desired fonts using Aspose.words when creating a new document. I could see there is an API in FontInfo which is getEmbeddedFont (int format, int style) but nothing for adding new Embedded Font. If so, kindly let me know how.


#2

@Anbu2Win

Thanks for your inquiry. Please use the following code example to get the desired output.

Document doc = new Document(MyDir + "input.docx");
FontInfoCollection fontInfos = doc.getFontInfos();

fontInfos.setEmbedTrueTypeFonts(true);
fontInfos.setEmbedSystemFonts(true);
fontInfos.setSaveSubsetFonts(true);
doc.save(MyDir + "19.1.docx");