X
點擊此處開啟此網站的行動版。

技術支援討論區

I want to remove the pdf toolbar using HTML and CSS. Can I do that?

已張貼

I have a client who wants the toolbar for the built in PDF reader removed so that no one can download the PDF displayed on the client's website. Using a text editor, am I able to remove the toolbar?

I have a client who wants the toolbar for the built in PDF reader removed so that no one can download the PDF displayed on the client's website. Using a text editor, am I able to remove the toolbar?
附加的畫面擷圖

被選擇的解決方法

Hmm, I don't think you can get rid of that toolbar.

Is the PDF in a frame within a web page, is that how HTML and CSS might be involved? I don't think you can reach inside and modify the viewer from the outside, as it is a privileged page.

While there are URL parameters for things such as page to display, zoom level, and sidebar state, there isn't one to automatically trigger full-screen view since Firefox requires a user action to initiate that.

One option might for the client to embed a custom viewer in the page instead of letting the browser choose how to view the PDF. The latest code of the PDF.js viewer web app is available to the public:

從原來的回覆中察看解決方案 1
引用

額外的系統細節

應用程式

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0

更多資訊

jscher2000
  • Top 10 Contributor
8516 個解決方法 69560 個答案

選擇的解決方法

Hmm, I don't think you can get rid of that toolbar.

Is the PDF in a frame within a web page, is that how HTML and CSS might be involved? I don't think you can reach inside and modify the viewer from the outside, as it is a privileged page.

While there are URL parameters for things such as page to display, zoom level, and sidebar state, there isn't one to automatically trigger full-screen view since Firefox requires a user action to initiate that.

One option might for the client to embed a custom viewer in the page instead of letting the browser choose how to view the PDF. The latest code of the PDF.js viewer web app is available to the public:

Hmm, I don't think you can get rid of that toolbar. Is the PDF in a frame within a web page, is that how HTML and CSS might be involved? I don't think you can reach inside and modify the viewer from the outside, as it is a privileged page. While there are [https://github.com/mozilla/pdf.js/wiki/Viewer-options URL parameters] for things such as page to display, zoom level, and sidebar state, there isn't one to automatically trigger full-screen view since Firefox requires a user action to initiate that. One option might for the client to embed a custom viewer in the page instead of letting the browser choose how to view the PDF. The latest code of the PDF.js viewer web app is available to the public: * Code: https://github.com/mozilla/pdf.js ''(there are over 6,000 forks, so possibly someone has tweaked one the way you want, although, I have no idea how to find it efficiently)'' * Demo: https://mozilla.github.io/pdf.js/web/viewer.html
這篇文章有幫助嗎? 1
引用
cor-el
  • Top 10 Contributor
  • Moderator
17277 個解決方法 156165 個答案

有幫助的回覆

Note that hiding the toolbar won't prevent (advanced) users from downloading the PDF file and there is still save page as or save link as in the context menu. As long as the file is requested from the server then you can find its URL even if the file would be loaded via XHR. You could convert the file to an image or render its content on canvas as small blobs using JavaScript.

Note that hiding the toolbar won't prevent (advanced) users from downloading the PDF file and there is still save page as or save link as in the context menu. As long as the file is requested from the server then you can find its URL even if the file would be loaded via XHR. You could convert the file to an image or render its content on canvas as small blobs using JavaScript.
這篇文章有幫助嗎? 1
引用
問個問題

如果您還沒有帳號,您必須先 登入您的帳號 來回覆文章。請 開始一個新問題