【发布时间】:2013-07-15 00:46:01
【问题描述】:
我正在使用下面的代码打印带有会话文本的 pdf。有没有办法让它只保存到一个位置而不打印?
<script type="text/javascript">
<!--
function printTextBox() {
var windowUrl = 'about:blank';
var windowName = 'Print' + new Date().getTime();
var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
printWindow.document.write('Last Name:<%= Session("DoctorLastName") %>');
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
// -->
</script>
【问题讨论】:
-
您可以通过添加内容处置标头来获得下载弹出窗口,但至于用户决定将其保存在何处或是否保存,则不取决于您。
-
@adeneo 他在做这个客户端,你不能在那里乱用标题。基本上他是通过使用浏览器的打印功能生成 PDF。
-
通常的处理方式是使用服务器上的 PDF 生成库。其实“.NET HTML转PDF库”是名副其实的山寨产业。
-
是的,我认为有一种不涉及用户的简单方法
标签: javascript asp.net vb.net