title: Html to pdf some characters are missing (itextsharp) in Asp.Net MVC Application
body: <p>I want to export razor view to pdf by using the itextsharp library. The problem is that some turkish characters such as İ,ı,Ş,ş etc... are missing in the pdf document. The code used to export the pdf is:</p>
  
  <pre><code>  public PdfActionResult(object model)
      {
          Model = model;
      }
   public override void ExecuteResult(ControllerContext context)
      {
          IView viewEngineResult;
          ViewContext viewContext;
  
          if (ViewName == null)
          {
              ViewName = context.RouteData.GetRequiredString("action");
          }
  
          context.Controller.ViewData.Model = Model;
  
  
          var workStream = new MemoryStream();
          var document = new Document();
  
          PdfWriter writer = PdfWriter.GetInstance(document, workStream);
          writer.CloseStream = false;
  
          document.Open();
  
          viewEngineResult = ViewEngines.Engines.FindView(context, ViewName, null).View;
          var sb = new StringBuilder();
          TextWriter tr = new StringWriter(sb);
  
          viewContext = new ViewContext(context, viewEngineResult, context.Controller.ViewData,
          context.Controller.TempData, tr);
          viewEngineResult.Render(viewContext, tr);
  
          CultureInfo ci = new CultureInfo("az-Latn-AZ");
          Encoding enc = Encoding.GetEncoding(ci.TextInfo.ANSICodePage);
  
          Stream stream = new MemoryStream(enc.GetBytes(sb.ToString()));
  
          XMLWorkerHelper.GetInstance().ParseXHtml(writer, document, stream, null);
  
          document.Close();
  
          new FileContentResult(workStream.ToArray(), "application/pdf").ExecuteResult(context);
      }
  }
  </code></pre>
  
  <p>Then I access it as:</p>
  
  <pre><code> public ActionResult StudentPdf(Guid studentId)
      {
          var model = _studentRepository.GetByIdGuid(studentId);
  
          return new PdfActionResult(model);
      }
  </code></pre>
  
  <p>Thanks for reply</p>