0

I have some issue in default fonts at export pdf file.I want to change default fonts type like unicode (myanmar) font.Because of blow code is doesn't show unicode font in pdf file.My data include unicode font data also.How should i solve that error. Please show me right direction. my code is

GridView GridView1 = new GridView();
                Response.ContentType = "Application/pdf";
                Response.AddHeader("content-disposition", "attachment; filename = SalesByBranch.pdf");
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                StringWriter sw = new StringWriter();
                HtmlTextWriter hw = new HtmlTextWriter(sw);
                List<SalesByBranchVM> list = data as List<SalesByBranchVM>;
                GridView1.DataSource = list;
                GridView1.AllowPaging = false;
                GridView1.DataBind();
                GridView1.RenderControl(hw);
                StringReader sr = new StringReader(sw.ToString());
                Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f);
                HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
                PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
                pdfDoc.Open();
                htmlparser.Parse(sr);
                pdfDoc.Close();
                Response.Write(pdfDoc);
                Response.End();

Please reply me !!

Cyrus
  • 23
  • 1
  • 11
  • look at this link - https://stackoverflow.com/questions/15225488/changing-font-of-pdf-using-itextsharp/15241639#15241639 – jjj Sep 05 '18 at 08:54
  • You are using `HTMLWorker`; please read the Q&A here: https://stackoverflow.com/questions/47895935/converting-html-to-pdf-using-itext You should upgrade to iText 7 + the pdfHTML add-on, and pick a font following the explanation of the tutorial: https://developers.itextpdf.com/content/itext-7-converting-html-pdf-pdfhtml/chapter-6-using-fonts-pdfhtml – Bruno Lowagie Sep 05 '18 at 10:05

0 Answers0