Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable printing options in the browser for certain pages

Tags:

html

jquery

Env: jQuery, richfaces, all major browsers

How to disable printing options in the browser for certain pages (e.g. File-->Print Preview, Print)

like image 858
user339108 Avatar asked Jul 29 '10 06:07

user339108


2 Answers

You cannot disable the actual buttons/menu items but you can use following in required pages to prevent printing:

<style type="text/css" media="print">
BODY {display:none;visibility:hidden;}
</style>
like image 143
Abhijeet Pathak Avatar answered Oct 15 '22 04:10

Abhijeet Pathak


You can not disable the browser print buttons, however you can use print @media CSS to hide certain parts or whole page completely from printing. For example, you can use CSS such as this:

@media print {
  html, body {
    display: none;  /* hide whole page */
  }
}
like image 41
Sarfraz Avatar answered Oct 15 '22 02:10

Sarfraz