Disable Adobe Reader toolbar from my ActiveX

半世苍凉 提交于 2019-12-31 04:59:45

问题


I am loading a PDF document in my ActiveX using AxAcroPDFLib and iTextSharp libraries. I want to disable the toolbar (that have Save, Print etc options) from the loaded PDF so that user cannot 'Save' the PDF from ActiveX.

I have following code:

axAcroPDF1.Width = someWidth;
axAcroPDF1.Height = someHeight;
axAcroPDF1.LoadFile(documentPath);
axAcroPDF1.setPageMode("none");
axAcroPDF1.setShowToolbar(false);

axAcroPDF1.Show();
axAcroPDF1.Focus();

The axAcroPDF1.setShowToolbar(false) disables the toolbar but the other gray toolbar enables at the bottom ( as shown in figure on this link) of PDF when I move mouse in that area. That toolbar also have saving option in it and I want to disable this one as well.

It would be really nice if it allows to disable only 'Save' option and keep the other options enabled on toolbar.


回答1:


You are asking something that is impossible. Please read this thread dating from December 2011. You'll find a snippet where Leonard Rosenthol, Adobe's PDF architect says: "there is no way to hide the toolbar (or the HUD) in the browser."

Setting the toolbar to false works for the toolbar, but you are referring to the "Heads Up Display" (HUD). As documented by Adobe, there is no way to customize this feature, let me quote Adobe:

the "Heads Up Display" (HUD) is not customizable. There are no APIs to HUD. You can’t use JavaScript to enter Read Mode, exit Read Mode or detect that the document is in Read Mode. Though it might seem like it, this wasn’t an oversight. There are some very sound engineering reasons why this is the case but I won’t go into those here.




回答2:


I success using

this.axAcroPDF1.src = filePath + "#toolbar=0";


来源:https://stackoverflow.com/questions/23081728/disable-adobe-reader-toolbar-from-my-activex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!