I am developing an report generation library using Aspose.pdf for C#/.Net. This library is deployed on docker container.
I would like to use custom fonts (.ttf) within the pdf.
I have tried the procedure mentioned in the following post but i get an error “font ABCXX not found”. Fonts are copied to /usr/share/fonts/truetype/ABCXX
Aspose.Pdf.FontNotFoundException: Font ABCXX was not found at Aspose.Pdf.Text.FontRepository.FindFont(String fontName)
Thanks Asad, It working fine now after placing the fonts in “/usr/share/fonts/truetype/msttcorefonts”.
Do we have any other solution without placing the custom font in mstcorefonts, because we wont be using Microsoft fonts.
Is it necessary to install Microsoft fonts as default?
Please kindly let us know.
Yes, it is necessary to install Microsoft Fonts in the system where you are using the API and Aspose.PDF tries to find the fonts in “/usr/share/fonts/truetype/msttcorefonts” directory by default in non-Windows environment.
Furthermore, you can use FontRepository.LoadFonts() methods in order to load fonts from all specified directories in case you added them as FontSources. Also, you can use FontRepository.OpenFont() method to use a font from complete file path.
asad.ali writes:
“use FontRepository.LoadFonts() methods in order to load fonts from all specified directories”
How do you specify directories.
I am building my Docker on a dotnet:6.0 linux image and I do not have permission to write outside my app directory, and I cannot apt-get True Type font so I can only copy TTF files into my app directory.