Data table to PDF with Dubai (Arabic) font using iTextSharp not working in Console Application

Last Reply 5 months ago By dharmendr

Posted 5 months ago


I am facing one issue with ITextSharp Dubai font, I tried with the sample code its working fine but the individual character is not showing in the pdf file

eg: the sentence الخطة التشغيلية لمبادرة دراية لعام 2020 م ignore the character "م" or any another single character. Kindly guide me how to resolve this issue.

Can you please create a console application using Dubai font.

Font download link :

PdfPTable hedertable = new PdfPTable(new float[] { 20, 60, 20 });
BaseFont bf1 = BaseFont.CreateFont(Server.MapPath("/fonts/") + "Dubai-Regular.ttf",BaseFont.IDENTITY_H,BaseFont.EMBEDDED);
string cellTextm = "الخطة التشغيلية لمبادرة دراية لعام" + thisDay + "م";
iTextSharp.text.Font fontheader = new iTextSharp.text.Font(bf1, 20, iTextSharp.text.Font.NORMAL);
iTextSharp.text.pdf.PdfPCell mcell = new iTextSharp.text.pdf.PdfPCell(new Phrase(16, cellTextm, fontheader))
{ HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER };
mcell.VerticalAlignment = Element.ALIGN_MIDDLE;
mcell.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
//Create PDF
Document pdfDoc = new Document(PageSize.A4.Rotate(), 10f, 10f, 10f, 10f);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf");


You are viewing reply posted by: Andrea 5 months ago.
Posted 5 months ago
Hi @sajeerma,
Please try the following

[Solved] Column Header not displaying while exporting DataTable to PDF using iTextSharp in ASP.Net

It might help you.

Cheers Andrea.