Page 2 of 2

Re: Document Viewer Customizations

Posted: 16 Jul 2020, 13:34
by Melloware
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?

Re: Document Viewer Customizations

Posted: 16 Jul 2020, 23:03
by GLee
No, it does not work for me. I also tried it on FireFox.

Re: Document Viewer Customizations

Posted: 17 Jul 2020, 13:11
by Melloware
I literally just did the above steps and the Open File button disappears from the toolbar.

Re: Document Viewer Customizations

Posted: 17 Jul 2020, 15:51
by GLee
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!

Re: Document Viewer Customizations

Posted: 17 Jul 2020, 16:05
by Melloware
ahhh that is what is different. they are setting the CSS to displayed again.

Re: Document Viewer Customizations

Posted: 17 Jul 2020, 19:17
by Melloware
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;
});

Re: Document Viewer Customizations

Posted: 21 Jul 2020, 19:53
by GLee
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.