隐藏/禁用Chrome PDF Viewer上的下载按钮

我正在寻找隐藏或禁用Chrome PDF查看器中显示的下载按钮的方法。 我已使用fpdf的保护脚本禁用了打印按钮( http://www.fpdf。 org / en / script / script37.php ),但它对下载按钮没有帮助。 PDF目前正在新窗口中通过以下方式打开:</ p>

</ p>





 <  code> window.open(URL,“”,“resizable = yes,scrollbars = yes,titlebar = yes,width = 1024,height = 900,top = 10,left = 10”); </ code> </ pre>

</ div>

</ div>

我意识到这不会阻止任何有点知情的用户保存/打印PDF,但客户端坚持 关于这个“安全措施”。</ p>

如果我使用开发工具检查元素并添加display:none,它会做我想要的,但我不知道如何在默认情况下添加它 打开的新窗口。</ p>
</ div>

展开原文

原文

I'm looking for a way to hide or disable the download button that appears in the Chrome PDF viewer. I have disabled the print button using the protection script of fpdf(http://www.fpdf.org/en/script/script37.php), but it doesn't help with the download button. The PDF is currently being opened in a new window via :

window.open(URL, "", "resizable=yes, scrollbars=yes, titlebar=yes, width=1024, height=900, top=10, left=10");

I realize this won't stop any somewhat informed user from saving/printing the PDF, but the client is insisting on this "security measure".

If I inspect the element using Dev Tools and add display: none it does what I want, but I'm not sure how to add that by default in the new window that opens.

</div>

3个回答



您可以使用embed标签</ p>

</ p>

< p>通过#toolbar = 0,你可以隐藏下载和打印按钮。</ p>
</ div>

展开原文

原文

You can do it by using embed tag

by making #toolbar=0 you will be able to hide the download and print button.

drnbotxo449747
drnbotxo449747 这对我有用 - 我使用对象标签,而不是嵌入,但是将#toolbar = 0添加到文件末尾,进入数据属性工作。 谢谢!
一年多之前 回复



由于您将pdf文件直接发送到浏览器,使用Adobe Reader ActiveX显示,如何防止文件下载,因为 下载到临时目录后会显示文件吗?</ p>

因此无法使用任何JavaScript库。</ p>

保护主文件的唯一方法 PDF文件是通过为每个页面创建图像,并通过您自己的界面(html,flash等)在Web上向用户显示这些图像。</ p>

您可以使用 ImageMagick 以及 GhostScript 。</ p>

您可以浏览非常有吸引力的人 </ p>

希望这会有所帮助。 (:</ p>
</ div>

展开原文

原文

Since you are delivering pdf file directly into the browser, displayed using Adobe Reader ActiveX, how can it be possible to prevent file download, since the files are displayed after downloaded into your temp directory?

So it is not possible using ANY JavaScript library.

The only way to secure your master PDF files is by creating Images for each page and present those to the user on the web via your own interface (html, flash etc).

You may use ImageMagick along with GhostScript for this.

You may go through veryinteractivepeople

Hope this helps. (:

dq_1984
dq_1984 你应该尝试pdf.js
3 年多之前 回复
dphg63476
dphg63476 我不认为这是可能的。
大约 4 年之前 回复
douzhang8144
douzhang8144 嗨,我不需要实际阻止下载文件,因为这是不可能的,因为就像你说它是在临时文件系统中。 我只想隐藏chrome PDF查看器中的工具栏以满足任意客户端请求。 如果我使用开发人员工具检查元素,然后添加display:none,它就可以解决问题,但我不确定如何在默认情况下设置它。
大约 4 年之前 回复



如果仅限于不那么科技用户,您可以通过生成一次性可用的唯一网址来禁用chrome pdf查看器中的下载 例如。 使用存储在服务器上的查询字符串参数,并且只允许使用一次。 下载按钮会再次下载,在这种情况下会失败。 然而,这是chrome pdf viewer中可能会更改的实现细节。 如果用户在浏览器中没有pdf查看器或被禁用,则默认情况下只会下载文件。</ p>

您可能想尝试 pdf.js ,它将在任何浏览器中呈现和不下载,但技术娴熟的用户仍然可以获取该文档。 它可能也不如chrome pdf viewer更高效。</ p>

如果您将内容转换为图像,用户仍然可以将这批图像合并为pdf,但在这种情况下 文本更难恢复,但仍然可以使用OCR。</ p>

如果您想更难复制内容或只是检测它,您也可以在下载的图像中使用水印或 合并隐写术,以根据在野外发现的已发布文件来识别制作副本的用户。 请注意,水印总是可以从PDF文件中删除,通常非常容易删除,但仍然可以从图像中删除。 精心设计的隐藏标识符(隐写术)也可以删除,但必须首先找到它,并且通常用户不会在文档没有明显标记的情况下查看。</ p>
</ div>

展开原文

原文

If it's only for not so tech-saavy users, you can disable download in the chrome pdf viewer by generating one-time usable unique urls eg. with a query string parameter that is stored on server and allowed to be used only once. The download button does download a second time and will fail in this case. This is however an implementation detail in the chrome pdf viewer that might change. If the user does not have a pdf viewer in the browser or it is disabled, the file will simply download by default.

You might want to try pdf.js, that will render and not download in any browser, but tech-saavy users will still be able to get the document. It is probably also less performant than the chrome pdf viewer.

If you turn the content into images, users can still take the batch of images and combine them into a pdf, however in this case the text is harder to recover, but still possible with OCR.

If you want to make it harder to copy the content or just detect it, you could also use watermarks in your downloaded images or incorporate steganography to identify the user who made the copy based on the released file found in the wild. Be aware that watermarks can always be removed, usually very easily from PDF files and it is a bit harder but still possible to remove from images. Carefully designed hidden identifiers (steganography) can also be removed but it has to be found first and usually users don't look when a document is not obviously stamped.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐