Free Support Forum -

Font handling (foreign characters like chinese)

We are evaluating Aspose PDF .NET lib for our Company.
We intend to use it for locally inserting text in an existing pdf. This text could potentially be any any Unicode character. How to handle this correctly on the client side where the text would need to be inserted.? When I am inserting text (document.AddText(FormatedText, 1, x, y) which font will be used by Default and what is the best way to select the proper font which is able to display the correct Unicode character ?
Arial Unocde MS was a font that included most Unicode characters but we cant rely on that Client has installed this font. It is not so important that the character has a specific look (for example Times Roman) but that it shows the correct character.

thanks for your advise



Thank you for contacting support.

Please ensure using latest version of the API i.e Aspose.PDF for .NET 18.8 in your environment. You can set any font to a TextFragment or TextSegment with TextState.Font property as explained over Add Text in an Existing PDF File. Moreover, you can embed complete font in a PDF document as well as specify a default font for that document as explained in Formatting PDF Document. Moreover, you need to decide the font which can display your desired character as the API can not detect which characters are not displayed fine aesthetically.

Furthermore, you can also load custom fonts from any directory, as in the lines of code below:

// connect custom font directory
FolderFontSource fs = new FolderFontSource(@"path\to\my\folder");

We hope this will be helpful. Feel free to contact us if you need any further assistance.