0

I used the below code to hide the toolbar widget that gets displayed in the browser.

stamper.setViewerPreferences(PdfWriter.HideToolbar);

When I open any pdf in the iframe it is still showing me that tooblbar widget. Is there any other way to hide it?

A Beginner
  • 393
  • 2
  • 12

1 Answers1

0

As explained in The Best iText Questions on StackOverflow, you are probably confusing the regular toolbar with the Heads Up Display (HUD):

Heads Up Display

This is not the toolbar that is referred to when you use HideToolbar.

What you're looking for isn't possible. Read the answer by Leonard Rosenthol (Adobe's PDF architect) on the iText mailing list, where he says: "there is no way to hide the toolbar (or the HUD) in the browser."

Setting the tool bar to false works for the tool bar, but you are referring to the "Heads Up Display" (HUD). Since version X of Adobe Reader, there is a new mode called "Read Mode", which is the default viewing mode when you open a PDF in a web browser. In "Read Mode" you can find a semi-transparent floating toolbar containing basic reading controls, such as page navigation, print and zoom: the 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.

Summarized: you're asking something that isn't supported in Adobe Acrobat / Reader. Unchecking "Display in Read Mode by Default" can be done from Edit > Preferences > Internet in Adobe Reader X but it there is no way to disable "read mode" programmatically.

Bruno Lowagie
  • 75,994
  • 9
  • 109
  • 165