Mahendra Kumar

Mahendra Kumar

  • NA
  • 164
  • 5.4k

How to generate hindi pdf

Jun 22 2018 11:43 PM
How to generate Hindi Pdf by HTMLWorker class with use of itextsharp
 
Code is..
 
protected void btnGenerate_Click(object sender, EventArgs e)
{
try
{
Document pdfDoc = new Document(PageSize.A4, 25, 10, 25, 10);
PdfWriter pdfWriter = PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
string strHTML = @"

This is Header

???? ????? ?? ?????
????? ?????? ??????? ??????

:
";
HTMLWorker htmlWorker = new HTMLWorker(pdfDoc);
htmlWorker.Parse(new StringReader(strHTML));
pdfWriter.CloseStream = false;
pdfDoc.Close();
Response.Buffer = true;
Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Test.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(pdfDoc);
Response.Flush();
Response.End();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}