function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Gautier Swiercz 7Gautier Swiercz 7 

Hide Button on visual force page Printable view

Hi,

I have two buttons on my VisualForce Page, "Save" and "Print".
When i click on "Print", standard navigation printable view is called. Now I just want to hide my buttons when I want to print my document.

Anyone can help me ? 
Thanks in advance.

GS
Best Answer chosen by Gautier Swiercz 7
Arvind KumarArvind Kumar
Hi Gautier,

You can use below code in your vf page.
<apex:commandLink value="Print" onclick="window.print();"/>

And you can take the help from the below blog. It is a very useful blog.

http://www.infallibletechie.com/2013/08/how-to-print-visualforce-page-in.html

Thanks,
Arvind Kumar

All Answers

Arvind KumarArvind Kumar
Hi Gautier,

You can use below code in your vf page.
<apex:commandLink value="Print" onclick="window.print();"/>

And you can take the help from the below blog. It is a very useful blog.

http://www.infallibletechie.com/2013/08/how-to-print-visualforce-page-in.html

Thanks,
Arvind Kumar

This was selected as the best answer
Gautier Swiercz 7Gautier Swiercz 7
Hi, 

Thanks for help,

The commandLink is good, but when i click on "Print", the Print link still appear on my printable view, as you can see : 

User-added image 

 
viv1somaniviv1somani

In your stylesheet add:
@media print { .no-print, .no-print * { display: none !important; } }
Then add class='no-print' on you button.

Hope this will work.