How to hide PDF toolbar on a ASP:NET page "embed object"

Roberto Guardamagna 1 Reputation point
2021-06-07T12:43:33.763+00:00

Hi,

I can correctly load and display a PDF on an ASP.NET page getting the content from a database table.
When the PDF is displayed a toolbar appears (zoom, download, print etc) and I would like to hide it.
Searching on the net I found that there is the "#toolbar=0" parameter to include in the URL to load the PDF but since the content is loaded directly from a database table, I don't have a "real" URL.
The way I load the PDF is tyhe following:

  • at first I create a string with the command:

embed = "<object data=\"{0}{1}\" type=\"application/pdf\" width=\"80%\" height=\"1000px\">";
embed += "</object>";

  • the PDF is loaded through an ASHX file: ltEmbed.Text = string.Format(embed, ResolveUrl("~/FileCS.ashx?Id="), ID); where the "ID" is a number that identifies the content to load and "ltEmbed" is a "asp:Literal".
    I tried different solutions but no one worked so...is there someone who knows how to hide the PDF viewer toolbar?
    Thank you, best regards.

Roberto

Developer technologies ASP.NET Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.