Khushboo Kumari

Khushboo Kumari

  • NA
  • 112
  • 14k

hindi Font HTML content pdf conversion

Nov 8 2017 1:51 AM
i am not able to convert hindi font HTML content
 
will you please any one help me .Ihave used this code below
  1. private void CreatePDFFromHTMLFile(string html, string FileName)  
  2. {  
  3. TextReader reader = new StringReader(html);  
  4. // step 1: creation of a document-object  
  5. Document document = new Document(PageSize.A4, 30, 30, 30, 30);  
  6. // step 2:  
  7. // we create a writer that listens to the document  
  8. // and directs a XML-stream to a file  
  9. PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(FileName, FileMode.Create));  
  10. // step 3: we create a worker parse the document  
  11. HTMLWorker worker = new HTMLWorker(document);  
  12. // step 4: we open document and start the worker on the document  
  13. document.Open();  
  14. // step 4.1: register a unicode font and assign it an allias  
  15. FontFactory.Register("C:\\Windows\\Fonts\\ARIALUNI.TTF""arial unicode ms");  
  16. // step 4.2: create a style sheet and set the encoding to Identity-H  
  17. iTextSharp.text.html.simpleparser.StyleSheet ST = new iTextSharp.text.html.simpleparser.StyleSheet();  
  18. ST.LoadTagStyle("body""encoding""Identity-H");  
  19. // step 4.3: assign the style sheet to the html parser  
  20. worker.Style = ST;  
  21. worker.StartDocument();  
  22. // step 5: parse the html into the document  
  23. worker.Parse(reader);  
  24. // step 6: close the document and the worker  
  25. worker.EndDocument();  
  26. worker.Close();  
  27. document.Close();  
  28. }

Answers (3)