Hide Print to PDF Button

  • 2 September 2016
  • 18 replies
  • 103 views

Badge +1

Hi there,

is there a way to hide the Print to PDF Button in the Ribbon?


18 replies

Userlevel 6
Badge +13

This blog post should help

Hide Individual Ribbon Elements on Form | Nintex Community 

Userlevel 7
Badge +17

I apologize that I haven't checked myself yet, but I know in O365 there is a disable option in the form settings. Do you see that on prem?

190598_pastedImage_13.png

Badge +11

Unfortunately onPrem the enable/disable option is missing

Userlevel 6
Badge +13

The custom CSS link I gave you above will do the job here. You'll need to use the dev tools of your browser to identify the Print to PDF CSS class.

Userlevel 5
Badge +12

I  agree with Ryan, I'd just use some CSS or JS to hide  the button as needed.   With some additional logic you could make the PDF button hide and show as needed depending on variables as required.  

Userlevel 6
Badge +13

Hi ‌, if one of these posts gives you the correct answer, could you please mark it as such to help other members.

Badge +1

Thanks all for the replies. My first tries didn't work in our Scenario but I will give it another a try and come back to this discussion with more Details.

Badge +1

The CSS solution doesn't work for us as I'm finding that the ID changes every time the form loads... 

1st -   Nintex.Forms.SharePoint.Ribbon.FillerGroup.ca3dacb75ac5462f9be8a6e58e19377f

2nd -  Nintex.Forms.SharePoint.Ribbon.FillerGroup.acd997ca69114adfadc1465498e9664a

Is anyone else having this issue?

Badge +11

Hi Sean,

I cannot confirm this issue. I tested it for the cancel button in preview and in published version, the id of the button always remains the same (even after re-publishing the form). Which control did you try to hide?

Badge +1

We're trying to hide the Print to PDF button.

Here's the first time I load it

first

and the next time I load it...

The ID for the PDF button is totally different when the form loads....

214b8e209a1b...  vs  5b9fa47899... 

Badge +11

Hi Sean,

I can confirm this behaviour, the ID of the print to pdf button changes everytime.

However, as a workaround you can use this css:

.ms-cui-tabContainer ul li:nth-child(5){
visibility: hidden !important;
}

Where "5" is the number of the li-element containing your print to pdf button. Doesn't work on preview mode for me, but works after publishing.

Regards

Philipp

Badge +1

Sorry, but I found an issue with this...  it works when the form is in Edit mode but the Print PDF button still appears in View mode.  Weird.  Everything looks the same... 

Badge +11

Let me have a look on this tomorrow, no access to my VM at the moment.

Badge +11

Allright, it doesn't work on view mode because in view mode it is the 3rd child. To work around this we will need some JS/JQuery.

To find out in which mode your form is:  

Then you can use the CSS I provided for the new/edit mode and change the 5 to a 3 in the display mode section.

Badge +2

This works for me, but it also removes it from the back end when I use it in a Rich Text widget. I am using the responsive forms and I dont have direct access to the CSS or the formatting rules.

Badge +5

Hi @burnsmh,

Try the following custom JS solution instead of CSS.

NWF$(document).ready(function(){
    var print2pdfid = document.querySelector('[id^="Nintex.Forms.Print.Ribbon.Print"]').parentNode.parentNode.id;
    var print2pdf = document.getElementById(print2pdfid.substring(0, print2pdfid.indexOf("-")));
    print2pdf.style.display = 'none';
});

 

Badge +2

@shaneoss Works for me, thanks

Badge +2

I tried to use the below code and it worked for me. But the problem is it will be hidden in both view and edit mode.

 

NWF$("#RibbonPrintToPDFButton").hide();

 

Reply