ASP. NET Printing

Source: Internet
Author: User
Network Print overview? B/S structure causes Web Applications Program . ? The program runs in the browser and the printer runs locally, while the files may run on the server, resulting in inflexible print control. ? How to Control and customize the format is a problem we may face during development. Print Document generation? 1. client scripts generally use JavaScript to analyze the content of the Source Page and extract the elements of the page to be printed for printing. By analyzing the content of the source document, you can generate a printed target document. Advantage: the client generates the printed target document independently to reduce the server load. disadvantage: The analysis operation of the source document is complex and the printed content in the source document must be agreed. ? 2. backend applications Code Read the print source from the database and generate the printed target document. When the page is generated, you should also consider using CSS to implement forced paging control. Advantage: You can generate a rich set of printed target documents, which are highly controllable. Since the printed content is obtained from the database, the generation operation is relatively simple; disadvantage: the server load is relatively large; page settings? Page settings mainly refer to setting the margins, headers, footers, and paper of printed documents. Page settings directly affect the generation of the printed document layout, so it is closely related to the generation of printed documents. For example, the number of rows, size, position, and font size of a table. The existing technology is to use the built-in print template of ie6.0 to control page settings, which can have a great impact on printing the target document. The print template can control the page margins, headers, footers, and even pages, get user settings, and send settings to the server. The print template technology allows you to customize the preview window and print format to maximize the impact on the target document and print effect. Can I print ie directly? That is, you can directly call the execwb method of the window. Print or webrower control to print it.? Advantage: it is convenient and convenient, and the client does not need any settings.? Disadvantage: The printing control is not flexible. If you directly call window. Print to print the page, other elements on the page will be printed, and the format of the header and end of the page is not easy to control.? Common method: In most cases, the query result is bound to the DataGrid and the DataGrid is printed. In this case, the printing format is generally relatively fixed and simple, and will not be changed after confirmation. Therefore, ie can be used for direct printing. [Instance Code] Note: ① this is the client that prints the specified content through window. Print. Sprnstr and eprnstr are defined here to specify the content for code execution: The following is a reference snippet: <input type = "button" name = "print" value = "preview and print" onclick = "Preview ()">

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.