Document Viewer Customizations

Community Driven Extensions Project
Melloware
Posts: 2275
Joined: 22 Apr 2013, 15:48

16 Jul 2020, 13:34

Can you do me a favor?

1. Go to this page: https://www.primefaces.org/showcase-ext ... vanced.jsf

2. Press F12 in Chrome to bring up the Developer Console and go to "Console".

3. Type the following and press Enter:

Code: Select all

window.frames[0].PDFViewerApplication.toolbar.items.openFile.hidden = true;
You should see the Open File button disappear. Let me know if that does not work for you?
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.3 / PF Extensions 8.0.4

GLee
Posts: 18
Joined: 10 Nov 2014, 17:47

16 Jul 2020, 23:03

No, it does not work for me. I also tried it on FireFox.

Melloware
Posts: 2275
Joined: 22 Apr 2013, 15:48

17 Jul 2020, 13:11

I literally just did the above steps and the Open File button disappears from the toolbar.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.3 / PF Extensions 8.0.4

GLee
Posts: 18
Joined: 10 Nov 2014, 17:47

17 Jul 2020, 15:51

Melloware wrote:
17 Jul 2020, 13:11
I literally just did the above steps and the Open File button disappears from the toolbar.
Thank you anyway for looking into this. I tried on several machines with the same result both Mac and Windows. I don't know enough to speculate on why it doesn't work for me.

Here's what I've discovered though. If the PDFViewer is normal or small size, the command to hide the button doesn't work. However if you expand the PDFViewer to the size where the buttons on the toolbar move to the main toolbar, the command works. I even tried to hide the print button and it became hidden. Once you make the PDFViewer small again, the buttons appear. It seems that the size of the viewer is the issue.

Thanks again!

Melloware
Posts: 2275
Joined: 22 Apr 2013, 15:48

17 Jul 2020, 16:05

ahhh that is what is different. they are setting the CSS to displayed again.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.3 / PF Extensions 8.0.4

Melloware
Posts: 2275
Joined: 22 Apr 2013, 15:48

17 Jul 2020, 19:17

Try this which calls it every time you resize the window.

Code: Select all

$( window ).resize(function() {
  window.frames[0].PDFViewerApplication.toolbar.items.openFile.hidden = true;
});
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 8.0.3 / PF Extensions 8.0.4

GLee
Posts: 18
Joined: 10 Nov 2014, 17:47

21 Jul 2020, 19:53

My application has a fixed window, so that will not work. Thanks for helping with this, I guess I'll live with the button visible for now.

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest