Ram ram

Ram ram

  • 1.6k
  • 74
  • 4.2k

XMlworkerheper html data convert pdf kannada font issue

Aug 10 2023 9:59 AM

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);
            }
        }

 


Answers (1)