禁用Adobe PDF阅读器中的保存按钮并隐藏IE窗口中的菜单栏 [英] Disable save button in Adobe PDF reader and hide menu bar in IE window

查看:258
本文介绍了禁用Adobe PDF阅读器中的保存按钮并隐藏IE窗口中的菜单栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过servlet呈现PDF,使用Itext获取PDF文件。

需要在adobe pdf阅读器菜单栏中禁用保存,打印选项,而其他选项如滚动,查找应该在那里此外,还需要禁用渲染它的浏览器窗口的文件菜单。

I am trying to render a PDF via servlet,using Itext for getting PDF file.
Need to disable save ,print option in adobe pdf reader menu bar while other options like scroll,find should be there and in addition need to disable the file menu of the browser window in which it is rendered.

我使用以下代码禁用了打印和文件菜单

I have disabled print and file menu using below code

stamper.setEncryption(null,null,
                 PdfWriter.HideWindowUI, PdfWriter.STRENGTH40BITS); 

stamper.setViewerPreferences(PdfWriter.HideToolbar);

问题是


  1. 在Adobe PDF阅读器菜单栏中禁用保存按钮(使用** Adob​​e Reader 9 **)。


  1. disable save button in Adobe PDF reader menu bar (using **Adobe Reader 9**).


推荐答案

我们需要区分两个不同的方面:打印和保存。

We need to distinguish two different aspects: printing and saving.

您可以加密文件并以这种方式设置权限不允许打印。但是:如果您只使用所有者密码加密文档,则可以非常轻松地解密文档并删除限制。使用所有者密码加密文档仅适用于心理级别:例如:您指示文档的原始制作者不希望打印文档。

You can encrypt a file and set the permissions in such a way that printing isn't allowed. However: if you only encrypt a document with an owner password, it is very easy to decrypt the document and to remove the restrictions. Encrypting a document with an owner password only works on a psychological level: for instance: you indicate that the original producer of the document doesn't want the document to be printed.

如果您想避免最终用户保存PDF文档,您会问一些不可能的事情。避免最终用户没有PDF副本的唯一方法是不向他发送PDF。如果没有磁盘上的实际字节,则无法在Adobe Reader中打开PDF。即使您要禁用保存(例如在Web应用程序的上下文中),您总是会在临时文件中的某处找到PDF,并且人们可以根据需要多次复制该文件。

If you want to avoid that an end users saves a PDF document, you are asking something that is impossible. The only way to avoid that an end user doesn't have a copy of the PDF is by not sending him the PDF. A PDF can't be opened in Adobe Reader without having the actual bytes on the disk. Even if you would disable saving (for instance in the context of a web application), you'd always find the PDF somewhere in the temp files and people would be able to copy that file as many times as they want.

在您的代码段中,您尝试隐藏工具栏(查看者首选项),但这没有意义。是否完全尊重此查看器首选项取决于PDF查看器。例如:在Adobe Reader X及更高版本中,当您将鼠标悬停在文档上时,会出现一个特殊的小部件。这个小部件允许用户保存文档。

In your code snippet, you try hiding the toolbar (a viewer preference), but that doesn't make sense. Whether or not this viewer preference will be respected entirely depends on the PDF viewer. For instance: in Adobe Reader X and later, you have a special widget that appears when you hover over the document. This widget allows users to save the document.

即使使用Adobe Reader 9,隐藏工具栏也是不够的:如果用户选择适当的菜单项或点击相应的菜单项热键,工具栏会出现,他们可以愉快地点击保存按钮。此外,他们可以右键单击并选择保存。

Even with Adobe Reader 9, hiding the toolbar isn't sufficient: if the user chooses the appropriate menu item or hits the appropriate "hot key", the toolbar would appear and they could happily click the Save button. In addition, they could have right-clicked and chosen "Save" as well.

简而言之,你提出了错误的问题。

In short, you're asking the wrong question.

你需要做的不是阻止保存但是控制PDF的实际使用,而这正是DRM(数字版权管理)的用武之地。但是,DRM通常非常昂贵,需要自定义PDF查看器它超出了iText的范围。

What you need to do is NOT prevent saving BUT control the actual use of the PDF and that's where DRM (Digital Rights Management) comes in. DRM however is usually very expensive, it requires a custom PDF viewer and it's out of the scope of iText.

这篇关于禁用Adobe PDF阅读器中的保存按钮并隐藏IE窗口中的菜单栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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