Disable Adobe Reader toolbar from my ActiveX

2020-04-20 00:51发布

问题:

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";