如何限制用户下载或保存pdf文件? [英] How to restrict user from downloading or saving pdf file?
问题描述
可能重复:
防止PDF文件下载和打印
Possible Duplicate:
Prevent PDF file from downloading and printing
在我当前的symfony项目中(在管理部分中),我上传了pdf文件并使用JavaScript打开了该文件,但我想限制用户下载或保存该pdf文件吗?
In my current symfony project (in admin section) I uploaded pdf file and open it by using JavaScript, but I want to restrict user to download or save for that pdf?
那么我可以限制用户下载或保存pdf吗?
So is it possible to me to restrict user to download or save pdf?
我的意思是用户只能查看该pdf的内容,我想禁用该pdf的所有浏览器的下载或保存选项.
I means user can only view content of that pdf, i want to disable download or save options of all browsers for that pdf.
pdf文件仅从服务器打开.
pdf file is open from server only.
echo "<span onclick=\"clickme('$pdf_name')\";>view</span>";
成功文件代码:
<script type="text/javascript">
function clickme(file_name){
window.open(file_name);
}
</script>
谢谢你.
推荐答案
要阻止人们下载任何东西,几乎要阻止PDF的下载,实际上是不可能的.恐怕您将不得不采用其他选择,例如仅显示文档预览或使用水印.
It's practically impossible to prevent people from downloading anything, much less PDF's. I'm afraid you're gonna have to go with alternatives, such as only showing a preview of the document or using watermarks.
这篇关于如何限制用户下载或保存pdf文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!