我想通过将HTML内容传递给函数来生成PDF.我已经为此使用了iTextSharp,但是当它遇到表格并且布局变得混乱时它表现不佳.
有没有更好的办法?
我有一个相当普遍的问题,正如我在各个用户组中看到的那样但找不到合适的答案.
我想要做的是在我的网站中生成一个ASP.NET页面,该页面可以选择导出为Microsoft Word .doc格式.
我用过的方法是这样的:
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Test.doc");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/msword";
StringWriter sw = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(sw);
Page.RenderControl(htmlWrite);
Response.Write(sw.ToString());
Response.End();
Run Code Online (Sandbox Code Playgroud)
然而,尽管它生成了一个单词doc,但是这些图像是在文档中嵌入的,而是将它们作为链接放置.我已经找到了一种方法来做到这一点,但还没有找到真正有用的东西.
我很感激我能得到的任何帮助,因为这是"最后一分钟"的要求(谈论典型的)
谢谢