Existing Web Print control technology is divided into several schemes
Custom control finishes printing
Using IE self-webbrowser control to realize printing
Printing with third party controls
The following are mainly about the first two aspects of the content
One, custom control way
Custom control way is to use VB or VC tools to generate COM components, with a defined print format to analyze the printing source files to achieve printing. You can print on the client only if you download and register the generated components on the client computer.
The main difficulty is to define the print format and how to analyze the print source files. The best way to do this is to use XML technology to solve problems comprehensively, and XML makes it easy to define the format of text, tables, and so on that print the target. But the development of the programmer requires high, difficult than the larger.
Second, the use of WebBrowser to achieve web printing
WebBrowser is an IE-built browser control that requires no user downloads. This document discusses the WebBrowser control technical content for the IE6.0 version. Its related technical requirements are: the production of printed documents, page settings, printing operations, such as the implementation of several links.
(i), print the document generation
1. Client Script mode
Client script is divided into VBScript, JavaScript, and JScript scripting languages. The syntax used for developing applications under IE is JScript, which is almost indistinguishable from JavaScript, so it can also be called JavaScript (JS below). Generally, the main use of JS to achieve the analysis of DOM documents, Dom for Microsoft proposed a Web document model, mainly for the implementation of Web script programming.
The use of JS can analyze the content of the source page, will be printed on the page elements extracted to achieve printing. You can generate a print target document by analyzing the contents of the source document.
Advantages: The client completes the production of the printing target document independently and reduces the server load;
Disadvantages: The source document analysis operation is complex, and the source document print content to have the agreement;
2, server-side program mode
Server-side program mode, mainly using background code to read the print source from the database, to generate the print target document. When the page is generated, you should also consider using CSS to enforce paging control.
Advantages: can generate very rich content of the printing target document, the content of the target document is more controllable. Because the print content is obtained from the database, the generation operation is relatively simple;
Disadvantage: Server-side load is relatively large;
(b), page Setup
Page Setup is mainly about setting the margins, headers, footers, paper, and so on for the printed document. Page Setup will directly affect the production of printed document layout, so it is closely related to the generation of printed documents. For example: Table number of rows, size, position, size of the font and so on.
The existing technology is to use the IE6.0 built-in print template to control page settings, which can have a very large impact on the printing of the target document. The Print Template Controls page margins, headers, footers, odd and even pages, and can get the user's settings and send settings to the server side.
Print template technology can customize the preview window and print format to maximize the impact of the target document and printing effect.
(iii), the implementation of printing operations
This feature is implemented primarily by using the function interface of the WebBrowser control to achieve print, Print preview (default), page Setup (default).
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.