Hi this code i am using kannada font display but kannada font come some different Unicodefontfactory (arialuni.ttf) in this tunga .ttf call path not find issue allready i install this and this path only i called so please help me for this
XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, msHtml, null, Encoding.UTF8, new UnicodeFontFactory());
public class UnicodeFontFactory : FontFactoryImp
{
// private static readonly string FontPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts),
// "Tunga.ttf");
private static readonly string FontPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts),
"arialuni.ttf");
private readonly BaseFont _baseFont;
public UnicodeFontFactory()
{
// _baseFont = BaseFont.CreateFont(FontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
_baseFont = BaseFont.CreateFont(FontPath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
}
public override Font GetFont(string fontname, string encoding, bool embedded, float size, int style, BaseColor color,
bool cached)
{
return new Font(_baseFont, size, style, color);
}
}
Mohammad HussainPosted Aug 10, 2023, 3:06 PM
It seems that you're facing an issue with using the "Tunga.ttf" font for Kannada characters in the PDF generated using iTextSharp's XMLWorkerHelper. You've mentioned that you've installed the "arialuni.ttf" font, and the code is set up to use it, but it's still not working.
Here are a few steps you can take to troubleshoot and resolve the issue:
Font Availability and Path:
Environment.GetFolderPath(Environment.SpecialFolder.Fonts).Ensure Font is Embeddable:
Font Name Case Sensitivity:
GetFontmethod of yourUnicodeFontFactory.Encoding and Content:
UnicodeFontFactory Configurations:
UnicodeFontFactoryis correctly being used by theXMLWorkerHelper.Font Family Variations:
Check Error Messages:
Try Other Fonts:
By following these steps, you should be able to id