我正在使用下面的代码打印带有会话文本的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>
答案 0 :(得分:0)
据我所知,您无法强迫用户将文件下载到特定位置。
正如您所指出的,站点访问者的浏览器通常会想要呈现文件,但如果您将服务器端的MIME类型指定为类似'octet-stream'的类型以指示二进制文件,则应该提示用户下载文件。
浏览器下载文件一般在这里讨论:Download File Using Javascript/jQuery
如果您告诉我们您正在使用的服务器端框架,我们可能会更有帮助。