PHP在网页上查看PDF并禁止用户下载 [英] PHP to view PDF on web page and disable user to download

查看:803
本文介绍了PHP在网页上查看PDF并禁止用户下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打算编写一个站点,允许用户查看pdf文件,但是由于版权法,我不希望他们将文件保存到自己的硬盘中.我正在研究如何使用PHP进行查看,但是我不知道如何禁止用户不要下载文件.

I'm going to write a site that lets users to view pdf files but I don't want them to save the files to their own hard drive due to the copy right law. I'm researching how to view it by using PHP, but I have no idea how to disable user not to download the files.

实际上,我想使用JavaScript禁用此操作,但是我从其他人那里得到了建议,因为这样做会使用户感到烦恼.

Actually, I want to use JavaScript to disable this action, but I get suggestions from other people not to do so because it's annoying to user.

因此,任何建议或帮助将不胜感激.

So any suggestion or help would be very much appreciated.

推荐答案

方法01

使用 Google图书

<iframe frameborder="0" scrolling="no" style="border:0px" src="https://books.google.com.kh/books?id=e5MkzETNcsgC&lpg=PP1&dq=typography&pg=PA11&output=embed" width="500" height=500>
</iframe>

在上图中,它显示了Embed,这将是代码.并且下载或打印"选项对此不可用. Google dosc可以阻止下载,但允许Save to Drive选项.然后在驱动器中我可以下载. 但是 Google图书不允许任何 .

In above image it shows Embed that will be the code. And Download or Print option is not available on this. Google dosc can prevent download but its allow to Save to Drive option. Then in drive i can download it. But Google books not allow any of that.

可见

方法02

使用 Google云端硬盘

右键单击pdf并转到共享(下图)

Right click on pdf and goto Share(below image)

然后转到左下方的高级选项

同时选中两个复选框.复制embed链接后,将其粘贴到您的src. 不允许下载和保存驱动器选项

Tick Both check boxes. After copy embed link and paste it to your src. No download and Save drive option is not allowed

注意:方法01 方法02 已测试

Note: Method 01 and Method 02 is Tested

这篇关于PHP在网页上查看PDF并禁止用户下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆