Unicode render issue to PDF using iTextSharp
I was trying to render Gujarati language HTML text to PDF which get render
but not correctly. I was trying to render
"કાર્બન
કેમેસ્ટ્રી"
text to PDF but it get render like "કારબન
કેમસટરી"
Could you please help to render it properly.
protected void btnPDF_Click(object sender, EventArgs e)
{
Document doc = new Document(iTextSharp.text.PageSize.LETTER, 10,
10, 42, 35);
BaseFont Gujarati =
iTextSharp.text.pdf.BaseFont.CreateFont("C:\\WINDOWS\\Fonts\\ARIALUNI.TTF",
BaseFont.IDENTITY_H, BaseFont.EMBEDDED); // --> CHANGED
iTextSharp.text.Font fontNormal = new iTextSharp.text.Font(Gujarati);
PdfWriter wri = PdfWriter.GetInstance(doc, new
FileStream("c:\\Test11.pdf", FileMode.Create));
//Open Document to write
doc.Open();
//Write some content
Paragraph paragraph = new
Paragraph("કાર્બન
કેમેસ્ટ્રી",
fontNormal); // --->> CHANGED Specify the font to use
// Now add the above created text using different class object to
our pdf document
doc.Add(paragraph);
doc.Close(); //Close document
}
No comments:
Post a Comment