Ram ram

Ram ram

  • 1.7k
  • 89
  • 5.1k

string data using iTextSharp.tepdf data convertion kannada font issue

Aug 4 2023 7:28 AM

 Hi

string data i want to convert pdf kannda laguage convertion not working any body please help i am using this bellow code english working

StringReader sr = new StringReader(sb.ToString());

// StringReader sr = new StringReader(textConvert(sb.ToString()));

byte[] bytes = null;
iTextSharp.text.Document pdfDoc = new iTextSharp.text.Document(PageSize.A4, 10f, 10f, 10f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
//htmlparser.Parse(pdfDoc, Encoding.UTF8, new UnicodeFontFactory());


using (MemoryStream memoryStream = new MemoryStream())
{
    iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(pdfDoc, memoryStream);

    
    //if (Session["lang"].ToString() == "Kannada")
    //{
    //    Encoding encFrom = Encoding.UTF8;
    //    Encoding encTo = Encoding.UTF8;

    //    bytes = encFrom.GetBytes(sr.ToString());
    //}


    pdfDoc.Open();
  // htmlparser.Parse(sr,Encoding.UTF8, new UnicodeFontFactory());

     htmlparser.Parse(sr);
    pdfDoc.Close();

    bytes = memoryStream.ToArray();
    Session["pdfbeforeesign"] = bytes;
    memoryStream.Close();
}

 


Answers (1)