asp.net将网页里面的内容导出为.pdf格式文件当中。 比如一个<div>这里面有很多内容,控件,文本。图片之类的导出到pdf中去。像把html里面所以内容提取出来 然后导入到pdf中。!!!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.cnblogs.com/lhb25/archive/2008/07/30/1256847.html找相关资料看 本帖最后由 net_lover 于 2011-08-10 11:02:03 编辑 我网页里面的内容生成HTML是这样子的:<div id="UpdatePanel1"> <img id="Chart2" BorderDashStyle="Solid" src="/ChartImg.axd?i=chart_cfd00cd270884c5dba9620d3e43efcc4_1.png&g=e5a7c325c16f45b4a914a592dead6d16" alt="" usemap="#Chart2ImageMap" style="height:300px;width:500px;border-width:0px;" /> <map name="Chart2ImageMap" id="Chart2ImageMap"> <area shape="rect" coords="199,139,239,152" href="javascript:__doPostBack('Chart2','8')" alt="" /> <area shape="poly" coords="167,163,256,100,265,114,271,130,275,146,276,163" title="9.86% : 12,180.00万元" href="javascript:__doPostBack('Chart2','8')" alt="" /> <area shape="rect" coords="170,107,216,121" href="javascript:__doPostBack('Chart2','7')" alt="" /> <area shape="poly" coords="167,163,174,54,198,58,220,67,240,81,256,100" title="14.11% : 17,430.00万元" href="javascript:__doPostBack('Chart2','7')" alt="" /> <area shape="rect" coords="127,103,173,117" href="javascript:__doPostBack('Chart2','6')" alt="" /> <area shape="poly" coords="167,163,96,79,114,67,133,59,153,54,174,54" title="12.07% : 14,910.00万元" href="javascript:__doPostBack('Chart2','6')" alt="" /> <area shape="rect" coords="106,118,146,132" href="javascript:__doPostBack('Chart2','5')" alt="" /> <area shape="poly" coords="167,163,76,101,86,89,96,79" title="4.34% : 5,360.00万元" href="javascript:__doPostBack('Chart2','5')" alt="" /> <area shape="rect" coords="89,149,135,162" href="javascript:__doPostBack('Chart2','4')" alt="" /> <area shape="poly" coords="167,163,64,202,60,189,58,176,57,163,58,150,60,137,64,124,70,112,76,101" title="15.30% : 18,900.00万元" href="javascript:__doPostBack('Chart2','4')" alt="" /> <area shape="rect" coords="102,187,142,201" href="javascript:__doPostBack('Chart2','3')" alt="" /> <area shape="poly" coords="167,163,96,247,77,226,70,214,64,202" title="8.16% : 10,080.00万元" href="javascript:__doPostBack('Chart2','3')" alt="" /> <area shape="rect" coords="130,209,176,222" href="javascript:__doPostBack('Chart2','2')" alt="" /> <area shape="poly" coords="167,163,189,271,164,273,140,270,116,261,96,247" title="14.41% : 17,800.00万元" href="javascript:__doPostBack('Chart2','2')" alt="" /> <area shape="rect" coords="178,198,224,212" href="javascript:__doPostBack('Chart2','1')" alt="" /> <area shape="poly" coords="167,163,267,209,253,231,235,249,214,262,189,271" title="14.96% : 18,480.00万元" href="javascript:__doPostBack('Chart2','1')" alt="" /> <area shape="rect" coords="200,167,240,181" href="javascript:__doPostBack('Chart2','0')" alt="" /> <area shape="poly" coords="167,163,276,163,274,186,267,209" title="6.80% : 8,400.00万元" href="javascript:__doPostBack('Chart2','0')" alt="" /> <area shape="rect" coords="333,95,356,110" title="6.80% : 8,400.00万元" href="javascript:__doPostBack('Chart2','0')" alt="" /> <area shape="rect" coords="356,95,466,110" title="6.80% : 8,400.00万元" href="javascript:__doPostBack('Chart2','0')" alt="" /> <area shape="rect" coords="333,110,356,125" title="14.96% : 18,480.00万元" href="javascript:__doPostBack('Chart2','1')" alt="" /> <area shape="rect" coords="356,110,466,125" title="14.96% : 18,480.00万元" href="javascript:__doPostBack('Chart2','1')" alt="" /> <area shape="rect" coords="333,125,356,140" title="14.41% : 17,800.00万元" href="javascript:__doPostBack('Chart2','2')" alt="" /> <area shape="rect" coords="356,125,466,140" title="14.41% : 17,800.00万元" href="javascript:__doPostBack('Chart2','2')" alt="" /> <area shape="rect" coords="333,140,356,155" title="8.16% : 10,080.00万元" href="javascript:__doPostBack('Chart2','3')" alt="" /> <area shape="rect" coords="356,140,466,155" title="8.16% : 10,080.00万元" href="javascript:__doPostBack('Chart2','3')" alt="" /> <area shape="rect" coords="333,155,356,170" title="15.30% : 18,900.00万元" href="javascript:__doPostBack('Chart2','4')" alt="" /> <area shape="rect" coords="356,155,466,170" title="15.30% : 18,900.00万元" href="javascript:__doPostBack('Chart2','4')" alt="" /> <area shape="rect" coords="333,170,356,185" title="4.34% : 5,360.00万元" href="javascript:__doPostBack('Chart2','5')" alt="" /> <area shape="rect" coords="356,170,466,185" title="4.34% : 5,360.00万元" href="javascript:__doPostBack('Chart2','5')" alt="" /> <area shape="rect" coords="333,185,356,200" title="12.07% : 14,910.00万元" href="javascript:__doPostBack('Chart2','6')" alt="" /> <area shape="rect" coords="356,185,466,200" title="12.07% : 14,910.00万元" href="javascript:__doPostBack('Chart2','6')" alt="" /> <area shape="rect" coords="333,200,356,215" title="14.11% : 17,430.00万元" href="javascript:__doPostBack('Chart2','7')" alt="" /> <area shape="rect" coords="356,200,466,215" title="14.11% : 17,430.00万元" href="javascript:__doPostBack('Chart2','7')" alt="" /> <area shape="rect" coords="333,215,356,230" title="9.86% : 12,180.00万元" href="javascript:__doPostBack('Chart2','8')" alt="" /> <area shape="rect" coords="356,215,466,230" title="9.86% : 12,180.00万元" href="javascript:__doPostBack('Chart2','8')" alt="" /> </map> </div> public static bool HtmlToPdf(string url, string path) { try { if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(path)) return false; Process p = new Process(); string str = System.Web.HttpContext.Current.Server.MapPath("wkhtmltopdf.exe"); if (!System.IO.File.Exists(str)) return false; p.StartInfo.FileName = str; p.StartInfo.Arguments = " \"" + url + "\" " + path; p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardInput = true; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.RedirectStandardError = true; p.StartInfo.CreateNoWindow = true; p.Start(); System.Threading.Thread.Sleep(500); return true; } catch (Exception ex) { HttpContext.Current.Response.Write(ex); } return false; } iframe 怎么使父窗口重定向 wcf .ashx文件中Response.Write XML不稳定 请教c#+asp.net编程中的一个问题。 为什么页面响应postback 过程变得奇慢无比 怎么设置 AjaxPro.net中的服务器端Ajax方法中不能使用 GDI+ 创建图片吗? 在线等一datalist 全选多选反选单选的例子 哪有xmlhttp做聊天室的例子 关于WEB用户控件 急!!!坐等求解 vs2010 .net 部分控件无法自由拖动问题 如何在点击动态树形菜单的最后一个子节点时,弹出小对话框
<img id="Chart2" BorderDashStyle="Solid" src="/ChartImg.axd?i=chart_cfd00cd270884c5dba9620d3e43efcc4_1.png&g=e5a7c325c16f45b4a914a592dead6d16" alt="" usemap="#Chart2ImageMap" style="height:300px;width:500px;border-width:0px;" />
<map name="Chart2ImageMap" id="Chart2ImageMap">
<area shape="rect" coords="199,139,239,152" href="javascript:__doPostBack('Chart2','8')" alt="" />
<area shape="poly" coords="167,163,256,100,265,114,271,130,275,146,276,163" title="9.86% : 12,180.00万元" href="javascript:__doPostBack('Chart2','8')" alt="" />
<area shape="rect" coords="170,107,216,121" href="javascript:__doPostBack('Chart2','7')" alt="" />
<area shape="poly" coords="167,163,174,54,198,58,220,67,240,81,256,100" title="14.11% : 17,430.00万元" href="javascript:__doPostBack('Chart2','7')" alt="" />
<area shape="rect" coords="127,103,173,117" href="javascript:__doPostBack('Chart2','6')" alt="" />
<area shape="poly" coords="167,163,96,79,114,67,133,59,153,54,174,54" title="12.07% : 14,910.00万元" href="javascript:__doPostBack('Chart2','6')" alt="" />
<area shape="rect" coords="106,118,146,132" href="javascript:__doPostBack('Chart2','5')" alt="" />
<area shape="poly" coords="167,163,76,101,86,89,96,79" title="4.34% : 5,360.00万元" href="javascript:__doPostBack('Chart2','5')" alt="" />
<area shape="rect" coords="89,149,135,162" href="javascript:__doPostBack('Chart2','4')" alt="" />
<area shape="poly" coords="167,163,64,202,60,189,58,176,57,163,58,150,60,137,64,124,70,112,76,101" title="15.30% : 18,900.00万元" href="javascript:__doPostBack('Chart2','4')" alt="" />
<area shape="rect" coords="102,187,142,201" href="javascript:__doPostBack('Chart2','3')" alt="" />
<area shape="poly" coords="167,163,96,247,77,226,70,214,64,202" title="8.16% : 10,080.00万元" href="javascript:__doPostBack('Chart2','3')" alt="" />
<area shape="rect" coords="130,209,176,222" href="javascript:__doPostBack('Chart2','2')" alt="" />
<area shape="poly" coords="167,163,189,271,164,273,140,270,116,261,96,247" title="14.41% : 17,800.00万元" href="javascript:__doPostBack('Chart2','2')" alt="" />
<area shape="rect" coords="178,198,224,212" href="javascript:__doPostBack('Chart2','1')" alt="" />
<area shape="poly" coords="167,163,267,209,253,231,235,249,214,262,189,271" title="14.96% : 18,480.00万元" href="javascript:__doPostBack('Chart2','1')" alt="" />
<area shape="rect" coords="200,167,240,181" href="javascript:__doPostBack('Chart2','0')" alt="" />
<area shape="poly" coords="167,163,276,163,274,186,267,209" title="6.80% : 8,400.00万元" href="javascript:__doPostBack('Chart2','0')" alt="" />
<area shape="rect" coords="333,95,356,110" title="6.80% : 8,400.00万元" href="javascript:__doPostBack('Chart2','0')" alt="" />
<area shape="rect" coords="356,95,466,110" title="6.80% : 8,400.00万元" href="javascript:__doPostBack('Chart2','0')" alt="" />
<area shape="rect" coords="333,110,356,125" title="14.96% : 18,480.00万元" href="javascript:__doPostBack('Chart2','1')" alt="" />
<area shape="rect" coords="356,110,466,125" title="14.96% : 18,480.00万元" href="javascript:__doPostBack('Chart2','1')" alt="" />
<area shape="rect" coords="333,125,356,140" title="14.41% : 17,800.00万元" href="javascript:__doPostBack('Chart2','2')" alt="" />
<area shape="rect" coords="356,125,466,140" title="14.41% : 17,800.00万元" href="javascript:__doPostBack('Chart2','2')" alt="" />
<area shape="rect" coords="333,140,356,155" title="8.16% : 10,080.00万元" href="javascript:__doPostBack('Chart2','3')" alt="" />
<area shape="rect" coords="356,140,466,155" title="8.16% : 10,080.00万元" href="javascript:__doPostBack('Chart2','3')" alt="" />
<area shape="rect" coords="333,155,356,170" title="15.30% : 18,900.00万元" href="javascript:__doPostBack('Chart2','4')" alt="" />
<area shape="rect" coords="356,155,466,170" title="15.30% : 18,900.00万元" href="javascript:__doPostBack('Chart2','4')" alt="" />
<area shape="rect" coords="333,170,356,185" title="4.34% : 5,360.00万元" href="javascript:__doPostBack('Chart2','5')" alt="" />
<area shape="rect" coords="356,170,466,185" title="4.34% : 5,360.00万元" href="javascript:__doPostBack('Chart2','5')" alt="" />
<area shape="rect" coords="333,185,356,200" title="12.07% : 14,910.00万元" href="javascript:__doPostBack('Chart2','6')" alt="" />
<area shape="rect" coords="356,185,466,200" title="12.07% : 14,910.00万元" href="javascript:__doPostBack('Chart2','6')" alt="" />
<area shape="rect" coords="333,200,356,215" title="14.11% : 17,430.00万元" href="javascript:__doPostBack('Chart2','7')" alt="" />
<area shape="rect" coords="356,200,466,215" title="14.11% : 17,430.00万元" href="javascript:__doPostBack('Chart2','7')" alt="" />
<area shape="rect" coords="333,215,356,230" title="9.86% : 12,180.00万元" href="javascript:__doPostBack('Chart2','8')" alt="" />
<area shape="rect" coords="356,215,466,230" title="9.86% : 12,180.00万元" href="javascript:__doPostBack('Chart2','8')" alt="" />
</map>
</div>
{
try
{
if (string.IsNullOrEmpty(url) || string.IsNullOrEmpty(path))
return false;
Process p = new Process();
string str = System.Web.HttpContext.Current.Server.MapPath("wkhtmltopdf.exe");
if (!System.IO.File.Exists(str))
return false;
p.StartInfo.FileName = str;
p.StartInfo.Arguments = " \"" + url + "\" " + path;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
System.Threading.Thread.Sleep(500); return true;
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex);
}
return false;
}