0

I use the following approach to display a PDF within a JSP:

<object id="pdfObj" data='myController.do?#toolbar=0&amp;navpanes=0&amp;scrollbar=1&amp' type='application/pdf' width='100%' height='460px' onkeypress="javascript:alert('key press event not triggered!');"></object>

The toolbar and the navigation panes are hidden when the screen loads. The floating toolbar also is not visible. However, an F8 or a F4 opens up the toolbar or the navigation pane respectively.
An attempt on trapping the keypress or keydown event works for the rest of the screen but once I click within the PDF, the key press events are not captured and this results in the toolbar getting enabled.

I understand that stopping the PDF displayed in the browser from getting saved is not possible, atleast without tha use of any plugin.
However, my question here is more for preventing the function key press just to add one more layer that the user needs to go through to save the document.
[Update] Accommodating @robertc's comment below, can we have a script to capture the function keys at the screen level before that gets handled by the application that handles the embedded object?


I was unable to intercept/block/capture the key stroke that was handled by the PDF client (Adobe installed in my system). Accepting comment from @robertc as answer. Since he posted it as a comment, I am moving it here: "you can only block function keys for an application in that application"

4

1 回答 1

0

我无法拦截/阻止/捕获由 PDF 客户端(Adobe 安装在我的系统中)处理的击键。接受来自@robertc 的评论作为答案。由于他将其作为评论发布,因此我将其移至此处:“您只能阻止该应用程序中某个应用程序的功能键”

于 2013-03-15T10:55:49.793 回答