ASP. NET web printing-Ultimate Solution

Source: Internet
Author: User

ASP. NET web printing-Ultimate Solution
Comrades who have worked on BS development should have a deep understanding thatProgramPrinting is no longer as easy to control as in applications. Some inherent features of web programs cause this disadvantage, such as: the printer is local, and the file may indeed be on the server; how to Control and customize the format. It has brought us a lot of problems in development. Although there are Crystal Reports and other controls to solve, it is always inconvenient. Of course, someone will study and solve the problem. Here I will give a brief introduction to several popular methods:

1. Print ie directly

You can call the execwb method of the window. Print or webrower control to print the window. Print. It is convenient and convenient, and the client does not need any settings. Some methods can also be used to achieve simple customization, such as creating a template HTM file, dynamically creating a hidden frame in JS, and generating data using scripts, then write the final result file to the hidden frame printing process. If the processing is good, the results are actually good. It should be enough for simple printing. Here is an actual example to illustrate this method:
During development, you often need to print statistical results to users. For example, a common function is to print business reports: the operator first enters the query conditions and then submits the query results, click print to print the report in the defined format.
In most cases, we bind the query results to the DataGrid and print the DataGrid. In this case, the printing format is generally relatively fixed and simple, and will not be changed after confirmation. Therefore, you can use IE to print the page directly. However, if you call window. Print to print the page directly, other elements on the page will also be printed, and the format at the end of the page header is not easy to control.

2. ActiveX Controls

Develop controls by yourself. In this way, many commercial software use this method. After writing controls, it is no longer necessary to use them on the web or in applications. The printing method is very flexible, and basically the web that the program can do can also be done. However, the client needs to install components, which is not easy to deploy.

3.. NET components

Lu Yan wrote a good article.ArticleUsing XML to print general web reports, I believe everyone has read it. The concept is novel and easy to implement. It is indeed a general web printing solution. In particular, the XML method is used to describe printed files, which leaves a good interface for future format expansion and is very easy to expand. This printing method is suitable for applications with large format changes and small data volumes. This idea also gave ASP. NET a new idea of printing: custom components to implement flexible printing. Of course, the disadvantages are also obvious: 1. You need to install the net framework1.0 component on the client. 2. XML parsing is not ideal if the file speed is large. 3. There will be a significant latency when the page is loaded for the first time.

Related Article

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: info-contact@alibabacloud.com 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.