How to Print from JavaScript HTML using window.print


Posted on : Sat, 13th Jun 15 05:43 pm GMT

Ever came across a need where you want to print the HTML form or page. This is possible using the JavaScript window.print() function. You can use this code with any control (like Button) and even any event (like onclick).
This will simply bring up the printer options from your machine and then you can follow the normal procedure of printing.

Note - A printer must be configured on your machine.

Code Type : Show the printer options
  
window.print();
  


This will not directly print the page, similar to the way you do it on your machine. The printer options window will show and you can make adjustments and settings before actually printing the contents.


We are operating with limited resources due to COVID-19 - Stay Safe!


We stands in support of racial equality!

Follow us : Facebook - Twitter