字体太小:将内容从gridview导出为pdf时,c#中出现0错误

时间:2014-03-19 06:47:32

标签: c# asp.net

我的代码是:

 using (StringWriter sw = new StringWriter())
  {
  using (HtmlTextWriter hw = new HtmlTextWriter(sw))
            {
                GridView2.AllowPaging = false;
                GridView2.RenderControl(hw);
                StringReader sr = new StringReader(sw.ToString());
                Document pdfDoc = new iTextSharp.text.Document(PageSize.A2);
                HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
                PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
                pdfDoc.Open();


                htmlparser.Parse(sr);
                pdfDoc.Close();

                Response.ContentType = "application/pdf";
                Response.AddHeader("contentdisposition","attachment;filename=CustomerReport.pdf");
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.Write(pdfDoc);
                Response.End();
            }
        }*/

请帮我解决这个问题。在这里,我得到font size too small error.Error in htmlparser.parse()

0 个答案:

没有答案