I am creating a pdf using asp.net. I have been able to successfully create the pdf in English, but when I am fetching data in Hindi language it shows blank in the pdf. How can I fetch data in Hindi?
This is my code :
protected void GenerateReport(object sender, EventArgs e)
{
DataRow dr = GetData("SELECT * FROM plant_detail where id = " + ddlEmployees.SelectedItem.Value).Rows[0]; ;
Document document = new Document(PageSize.A4, 88f, 88f, 10f, 10f);
Font NormalFont = FontFactory.GetFont("Arial", 12, Font.NORMAL, Color.BLACK);
BaseFont bf = BaseFont.CreateFont(Environment.GetEnvironmentVariable("windir") + @"\fonts\ARIALUNI.TTF", BaseFont.IDENTITY_H, true);
using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
{
PdfWriter writer = PdfWriter.GetInstance(document, memoryStream);
Phrase phrase = null;
PdfPCell cell1 = null;
PdfPTable table = null;
Color color = null;
document.Open();
//Header Table
table = new PdfPTable(2);
table.TotalWidth = 500f;
table.LockedWidth = true;
table.SetWidths(new float[] { 0.3f, 0.7f });
//Company Logo
cell1 = ImageCell("~/images/index.jpg", 30f, PdfPCell.ALIGN_CENTER);
table.AddCell(cell1);
string cellText = "कार्यालय";
iTextSharp.text.Font font = new iTextSharp.text.Font(bf, 10, iTextSharp.text.Font.NORMAL);
//Company Name and Address
phrase = new Phrase();
iTextSharp.text.pdf.PdfPCell cell = new iTextSharp.text.pdf.PdfPCell(new Phrase(12, cellText, font));
//phrase.Add(new Chunk("कार्यालय कलेक्टर रायपुर\n\n\n\n\n\n", FontFactory.GetFont("Arial", 16, Font.BOLD, Color.RED)));
// phrase.Add(new Chunk("कार्यालय कलेक्टर रायपुर\n\n\n\n\n\n", FontFactory.GetFont("Arial", 16, Font.BOLD, Color.RED)));
phrase.Add(new Chunk("\n", FontFactory.GetFont("Arial", 8, Font.NORMAL, Color.BLACK)));
phrase.Add(new Chunk("\n", FontFactory.GetFont("Arial", 8, Font.NORMAL, Color.BLACK)));
phrase.Add(new Chunk("", FontFactory.GetFont("Arial", 8, Font.NORMAL, Color.BLACK)));
cell = PhraseCell(phrase, PdfPCell.ALIGN_LEFT);
cell.VerticalAlignment = PdfCell.ALIGN_TOP;
table.AddCell(cellText);
}
}