One call of pure JavaScript Printing
This method is called window. the print () method calls the print function provided by the browser (it seems to be limited to IE), but it calls very few interfaces, except one-click printing, other basic functions such as header, footer, margin, width, and paper cannot be configured through code.Implementation. This method will be discarded for projects that require printing a little bit, because their configuration type is too bad.
Second, use JS + ActiveX
This method is widely used in the current market. It is a configurable printing effect that needs to be achieved by installing ActiveX plug-ins to interact with Js. Because of its need to install plug-ins, it is somewhat contrary to the original intention of the web project. The cost of cross-platform and maintainability is greatly increased. I also tried to use the "scriptx" plug-in on the market for development, but after several free versions, I found that the local machine can be used normally. Once remote access occurs, problems may occur, later I found that it seems that the license is required for remote access, and finally I decided to give up.
① Someone said this:ScriptxThe free version is better and can meet most of the requirements.
The meadco's scriptx control can be used in either the free version or the paid version. The free version supports fewer features, however, the most important and common page settings are provided. Therefore, use the free version. However, both versions use the same cab file, but there are some differences in the Code settings
② Some people recommended: Print CSS
This is an ideal way to implement Web attacks. This method controls the output and printing of HTML documents by embedding printed CSS styles in HTML documents, such as setting the paper size, vertical and horizontal orientation, and printing margins, paging. Obviously, this method is low in cost and does not require any plug-ins to be downloaded, and it is very cross-platform. Print CSS has been launched for some time, but unfortunately, no vendor's browser has implemented these standards well so far, which makes it impossible for programmers to use print CSS for actual development. For more information about Printing CSS, see http://css-discuss.incutio.com /? Page = printstylesheets
③ The charge is good: jatoolsprinter (. Print Control)
Iii. Using Applet
The use of Applet, paging or accurate printing, can be done perfectly, but the disadvantage is also very obvious, manifested in:
The cost of installing the applet is huge. You need to download files of dozens of MB.
When printing a report, you need to retrieve data from the server again, which is less efficient. Because of the applet scheme, data is usually presented in HTML mode. When printing, the applet must retrieve the data of the same ticket from the server. It seems that the bill on the current page is printed. In fact, the applet does not print the data on the current HTML page at all, but downloads the data from the server to the applet for printing. That is to say, for printing, two requests must be requested, HTML Rendering at a time, and printing at a time.
Continuous printing cannot be solved. For example, instead of printing only one bill, several bills are printed consecutively.
The printer setting problem cannot be solved. If there are multiple printers, you always need to manually select which printer to print.
Continuous printing cannot be solved. For example, instead of printing only one bill, several bills are printed consecutively.
The printer setting problem cannot be solved. If there are multiple printers, you always need to manually select which printer to print.
Java reporting tools on the market. Generally, we recommend using Applet