Home >Web Front-end >JS Tutorial >Three methods of page printing using JavaScript_Typical special effects
Some time ago, I heard a friend talk about some methods of printing web pages. On a quiet night, I accidentally discovered a few pieces of code while listening to music, and I posted them to share with you.
Because I have never printed a webpage, and I don’t have a printer, the specific effect is not very clear. It is normal to test printing to PDF, but the second one in the pop-up setting window is better than the first and third ones. There are more methods.
Note: The control in the second method requires the support of IE5.5, and because of the use of the control, if the security setting of the client IE is too high, it will not function properly.
Special Tips
Run this example code. If a printer has been installed, the printer will be directly called to print the page. Otherwise, you will be prompted to install a printer.
1. Use the print method of the window object
2. Use the WebBrowser control
3. Execute the print command in the document area