Three methods for page printing using javascript _ typical special effects

Source: Internet
Author: User
Three methods for page printing using javascript some time ago I heard from my friends about some methods for printing webpages. on a quiet night, I accidentally found several pieces of code when I listened to the songs, post it and share it with you.

Because I have never printed a webpage or a printer, and the specific effect is not very clear, it is normal to print it as a PDF, the second method has more points in the pop-up setting window than the first and third methods.

Note: the controls in the second method require the support of IE5.5 +. if the security settings of IE on the client side are too high, it will not work properly.
Run the code in this example. if a printer has been installed, the printer printing page is called directly. Otherwise, a prompt is displayed for printer installation.

1. use the print method of the window object


2. use the WebBrowser control

Classid = "CLSID: 8856F961-340A-11D0-A96B-00C04FD705A2">

3. run the print command in the document area.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.