How do I open PDF document in new browser window?
如何在新的浏览器窗口中打开PDF文档?
The window should be full and withouth menu.
窗口应该是满的,没有菜单。
Just a PDF document in a clean full window with native Javascript or jQuery.
只是一个PDF文档,在一个干净的完整窗口中使用本机Javascript或jQuery。
3 个解决方案
#1
46
<a href="#" onclick="window.open('MyPDF.pdf', '_blank', 'fullscreen=yes'); return false;">MyPDF</a>
The above link will open the PDF in full screen mode, that's the best you can achieve.
以上链接将以全屏模式打开PDF,这是您可以实现的最佳效果。
#2
3
var pdf = MyPdf.pdf;
window.open(pdf);
This will open the pdf document in a full window from JavaScript
这将在JavaScript的完整窗口中打开pdf文档
A function to open windows would look like this:
打开窗口的功能如下所示:
function openPDF(pdf){
window.open(pdf);
return false;
}
#3
1
I'm going to take a chance here and actually advise against this. I suspect that people wanting to view your PDFs will already have their viewers set up the way they want, and will not take kindly to you taking that choice away from them :-)
我打算在这里抓住机会并实际建议不要这样做。我怀疑想要查看你的PDF的人已经让他们的观众按照他们想要的方式设置了,并且不会好心地把你的选择从他们身上带走:-)
Why not just stream down the content with the correct content specifier?
为什么不使用正确的内容说明符简化内容?
That way, newbies will get whatever their browser developer has a a useful default, and those of us that know how to configure such things will see it as we want to.
这样,新手将获得他们的浏览器开发人员有一个有用的默认值,我们这些知道如何配置这些东西的人将会看到我们想要的。
#1
46
<a href="#" onclick="window.open('MyPDF.pdf', '_blank', 'fullscreen=yes'); return false;">MyPDF</a>
The above link will open the PDF in full screen mode, that's the best you can achieve.
以上链接将以全屏模式打开PDF,这是您可以实现的最佳效果。
#2
3
var pdf = MyPdf.pdf;
window.open(pdf);
This will open the pdf document in a full window from JavaScript
这将在JavaScript的完整窗口中打开pdf文档
A function to open windows would look like this:
打开窗口的功能如下所示:
function openPDF(pdf){
window.open(pdf);
return false;
}
#3
1
I'm going to take a chance here and actually advise against this. I suspect that people wanting to view your PDFs will already have their viewers set up the way they want, and will not take kindly to you taking that choice away from them :-)
我打算在这里抓住机会并实际建议不要这样做。我怀疑想要查看你的PDF的人已经让他们的观众按照他们想要的方式设置了,并且不会好心地把你的选择从他们身上带走:-)
Why not just stream down the content with the correct content specifier?
为什么不使用正确的内容说明符简化内容?
That way, newbies will get whatever their browser developer has a a useful default, and those of us that know how to configure such things will see it as we want to.
这样,新手将获得他们的浏览器开发人员有一个有用的默认值,我们这些知道如何配置这些东西的人将会看到我们想要的。