I want to remove that download icon that is in the PDF viewer, but I can't. I'm opening the pdf through an iframe. Here is an example of my code below:
<html>
<head>
<title>Disable Context Menu</title>
</head>
<body oncontextmenu="return false">
<iframe id="pdfFrame" width="500px" height="600px" src="png.pdf"></iframe>
</body>
</html>
First I tried to apply a style inside the page opened by the iframe, but I couldn't succeed in that.
CodePudding user response:
Change:
<iframe id="pdfFrame" width="500px" height="600px" src="png.pdf"></iframe>
In:
<iframe id="pdfFrame" width="500px" height="600px" src="png.pdf#toolbar=0"></iframe>
Hope that helped!
CodePudding user response:
You cannot simply change the view of a PDF when you placed it in the Distributed Network System (WorldWideWeb) it became just the same as EVERY item in the Public Domain an embedded object for download and view.
You can make suggestions as to how those dis-positions may be handled (see how I suggested via a fragment the second frame could be #toolbar=0) but once you publish html objects they are no longer yours to control.
Most browsers will come with their own editors to remove that just as easy as you can add it.
There are ways google can make it more difficult to extract the source PDF copy but if the client can view it a copy has already been gifted (dis-possessed) to them.
<html>
<head>
<title>Disable Context Menu</title>
</head>
<body oncontextmenu="return false">
<iframe id="pdfFrame" width="500px" height="600px" src="https://docs.google.com/viewerng/viewer?url=http://infolab.stanford.edu/pub/papers/google.pdf&embedded=true"></iframe>
</body>
</html>