【发布时间】:2016-08-08 05:20:19
【问题描述】:
我尝试在单独的窗口中下载/打开 PDF 文件,但当前 PDF 文件在同一窗口中打开
这就是我的尝试
<script type="text/javascript">
//$(function sumdata() {
function mypdf() {
$('#tabledata').tableExport({ type: 'pdf', escape: 'false' });
window.open(mypdf);
}
//});
</script>
<a href="#" id="pdf" onclick="mypdf()" style="background-color: #3399FF;color: #FFFFFF;font-weight: bold;display:none;font-size: medium;PADDING: 15px;margin: 12px;"">EXPORT TO PDF</a>
当我尝试这个window.open(mypdf,'_blank') 时显示一个错误
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Most likely causes:
The directory or file specified does not exist on the Web server.
The URL contains a typographical error.
A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
Create the content on the Web server.
Review the browser URL.
Check the failed request tracing log and see which module is calling SetStatus. For more information, click here.
Detailed Error Information:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://localhost:33578/function mypdf() { $('
Physical Path C:\Users\Administrator\Documents\MIS\chart_project\chart_project\function mypdf() { $('
Logon Method Anonymous
Logon User Anonymous
Request Tracing Directory C:\Users\Administrator\Documents\CHART_PROJECT
More Information:
This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.
View more information »
表格导出js 检查此链接
【问题讨论】:
-
您希望您的 PDF 文档在 PDF 查看器中打开,而不是在 Web 浏览器中打开?这是一个操作系统设置,而不是可以编码的东西。您需要打开 PDF 查看器并在其中找到一个选项,以便在浏览器中不打开。这是旧的,但你明白了:blogs.adobe.com/acrolaw/2007/08/…
-
但是当我将项目发送给客户时,我认为他们不能更喜欢这些设置.. 我有表格并且有按钮,我只想要当我点击那个按钮然后 pdf 在新标签中打开
-
据我所知,您无法告诉链接在新选项卡、新窗口或来自 javascript 的客户端应用程序中打开。这是在浏览器或操作系统外部决定的。
标签: jquery pdf export-to-pdf