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
AtreborAtrebor 

How can I exclude a button on a VF page from displaying when printing??

I have a basic VF page, and on that page, I have a button to print the VF page:
 
<apex:form >
<div align="center" draggable="false" >
<apex:commandbutton id="print" value="Print Win Report" onclick="window.print();" />
</div>

Since this button is only on there to Print, how can I not show the button when printing?  The button is still displaying during the print preview, and then upon printing/saving as PDF.  I have to think there's some simple way to not display the button when printing, but I am not very advanced with VF.
SwethaSwetha (Salesforce Developers) 
HI Atrebor,
A user posted similar question in the past https://developer.salesforce.com/forums/?id=9060G000000IBWvQAO

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

Related: https://salesforce.stackexchange.com/questions/244903/hide-div-from-page-layout-after-print-button-click

If this information helps, please mark the answer as best.Thank you