How to Add a Print Button to HTML Page

Share it with your friends Like

Thanks! Share it with your friends!

Close

Follow this step by step tutorial to learn how to add a print button in to html page.

Don’t forget to check out our site http://howtech.tv/ for more free how-to videos!
http://youtube.com/ithowtovids – our feed
http://www.facebook.com/howtechtv – join us on facebook
https://plus.google.com/103440382717658277879 – our group in Google+

A print button on your web page will allow your visitors to quickly print the contents of the page. When the button is pressed, the browser’s print dialog box will pop up. Then all the user has to do is choose his printer from the list, change the properties if he desires, and then click “OK” to print the web page.

Step #1 — Open index.html in editor

Open index.html file in any html editor or notepad I use free online html editor.

Step # 2 — Write HTML code

You can easily add a print button to your website by adding the onclick=”window.print(); script to your anchor tag. Simply put, you’re forcing the link you created to open up the browsers’ default printer settings instead of opening up a new window or sending a user to a different page.

(a title=”Print Screen” alt=”Print Screen” onclick=”window.print();” target=”_blank” style=”cursor:pointer;” )PRINT BUTTON(/a)

Step # 3 — Submit you code

Save the HTML file and upload it to your website. Click the print button to test it out.

Step # 4 — Click print button.

That’s it for this video on How to add a Print button to your website. .Now you have been successfully installed print button in you webpage.

Comments

Internet Services and Social Networks Tutorials from HowTech says:

❗ Subscribe To Our Main YouTube Channel

https://www.youtube.com/user/howtechpc

Anmol Singh says:

Awesome video.

Status Nanba says:

Using button tag

<button target="blank" style="cursor: pointer" onclick="window.print();">Print</button>

MinisGallery com says:

So thankful I found this video. It helped me solve a simple problem where all other sites I was referencing were using javascript to accomplish the same thing. Thank you.

brandfilms says:

To anyone looking to remove the print button:

1) Add class="print-button" to the print button.

2) Add @media print { .print-button { display:none; } } to your CSS in a <style> element.

Sayed Mortaza kazemi says:

thanks alot

dojajaje says:

thanks,but i dont want printer to print "PRINT BUTTON" or my url on my paper

Mary Ann Ranola says:

THANK YOU 🙂

Ataur Rahman says:

Thanks a lot mam, It definitely works but I want to print a particular portion like a <div> which contains I need to print out only. Besides this way "Ctrl+P" works the same. How it will possible? Pls. help in this regards . Thanks once again.

Ninine Tahra says:

THANKS BUT I WANT TO Remove print Button how i can do this ?

Adam Stephano says:

Is that only to add a printer to the web page

The Ultimate Simp says:

Is there any way I can use an JPG image as a print screen?

Mickey Mouse says:

Very useful. Thank you!

Write a comment

*