<body>
<div style="text-align:center;">
<iframe id="pdframe" width="900px;" height="850px;" name="pdframe" src="../dl/NOQRS.htm"
frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes">
</iframe>
</div>
<br />
<table border="0" align="center" cellpadding="0" cellspacing="0" class="wd noprint">
<tr>
<td align="right" height="30">
</td>
</tr>
<tr>
<td align="right" height="50">
<a id="dc_a" class="dc" href="javascrpit:void(0)" target="_blank">
<img src="../../images/dc.jpg" border="0" width="128" height="43" /></a> <a id="dy_a"
class="dy" href="javascrpit:void(0)" onclick="dyqrs()">
<img src="../../images/dy.jpg" border="0" width="128" height="43" /></a>
</td>
</tr>
</table>
</body>
js里面:
$(function () {
$.ajax({
type: "GET",
url: "/DLGL/GetDLZWQRSBH",
cache: false,
dataType: "json",
success: function (data) {
if (data.success) {
var s = "../DL/DL_ZWFYQRSPDF.htm?dwbh=" + data.dwbh;
var ss = "/Tools/HtmlToPdf?url=DL/DL_ZWFYQRSPDF.htm?dwbh=" + data.dwbh;
$("#pdframe").attr("src", s);
$("#dc_a").attr("href", ss);
}
}
});
});
function dyqrs() {
window.print();
}
控制器中
public JsonResult HtmlToPdf(string url) {来源: http://www.phpxs.com/code/1009782/