GridView 导出 pdf 中文不显示,只有数字?

解决方案 »

  1.   

    编码问题吧,给个参考你Response.ContentType = "application/pdf";
    Response.AddHeader("content-disposition", "attachment; filename=MypdfFile.pdf");
    using iTextSharp.text;
    using iTextSharp.text.pdf;MemoryStream m = new MemoryStream();
      Document document = new Document();
      try  
      {
      Response.ContentType = "application/pdf";
      PdfWriter.GetInstance(document, m);
      document.Open();
      document.Add(new Paragraph(DateTime.Now.ToString()));
      }  
      catch (DocumentException ex)  
      {
        
      }
      document.Close();
      Response.OutputStream.Write(m.GetBuffer(), 0, m.GetBuffer().Length);
      Response.OutputStream.Flush();
      Response.OutputStream.Close();