Method and system for realizing batch silent printing based on HTML
By mapping HTML data to word templates and outputting them to local printers, the problem of batch silent printing on the web is solved, and efficient and low-cost batch printing effect is achieved.
Patent Information
- Application Number
- CN202111039050.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-06
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2041-09-06
AI Technical Summary
It is difficult to realize batch silent printing on the web side in the prior art, especially when the printing demand of governments or enterprises is high, the printing controls on third-party clients are expensive and the printing effect is not ideal.
By extracting and mapping HTML data to the corresponding word template, the word file that has been written inversely is output to the local printer when printing, and silent printing is achieved. The specific steps include configuring the HTML template, configuring the word template to be printed, mapping the business items of the HTML and word templates, replacing the form business data to the word template, and sending tasks directly to the local printer when printing.
It realizes batch silent printing without a third-party client on the web side, which reduces development costs, improves scalability and application, and saves printing operation time.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of silent printing, in particular to a method and system for realizing batch silent printing based on HTML. Background Art
[0002] With the development of information technology, the demand for batch printing by governments or enterprises is increasing. For general printing needs, printing is usually based on web pages. However, for printing with higher requirements or batch printing, web pages are often unable to achieve this. As for the third-party client printing controls on the market, the cost is often high or the printing effect is not ideal.
[0003] At the same time, government or corporate users hope to use a fixed printer every time they print, and no dialog box will pop up for settings, that is, silent printing. Specifically, when clicking print, no option window or printer setting window will pop up, and printing will be performed directly.
[0004] HTML, Hypertext Markup Language, is an application under Standard Generalized Markup Language. "Hypertext" means that a web page can contain pictures, links, and even non-text elements such as music and programs. The structure of Hypertext Markup Language includes a "header" part (English: Head) and a "body" part (English: Body), where the "header" part provides information about the web page and the "body" part provides the specific content of the web page.
[0005] Therefore, how to implement silent batch printing on the web based on HTML is a technical problem that needs to be solved urgently. Summary of the invention
[0006] The technical task of the present invention is to provide a method and system for implementing batch silent printing based on HTML, so as to solve the problem of how to implement batch silent printing on the web side based on HTML.
[0007] The technical task of the present invention is achieved in the following way: a method for implementing batch silent printing based on HTML, which extracts HTML data and maps it to a corresponding word template, and outputs the reversed word file to a local printer to implement silent printing during printing; the details are as follows:
[0008] Configure HTML template: Configure HTML according to the template to be printed to provide business data entry;
[0009] Configure the word template to be printed;
[0010] Configure the mapping between HTML and print word templates: map business items one by one according to the relationship between HTML and print word templates;
[0011] Replace the HTML form business data into the print word template;
[0012] When printing, the print job is sent directly to the local printer for silent printing.
[0013] As a preferred option, the word template to be printed is configured as follows:
[0014] Map the HTML business to the print word template;
[0015] When the HTML form business data is filled in and saved, the HTML form business data is replaced with the print word template;
[0016] When the form business data template changes, just modify the corresponding template.
[0017] As a preferred method, replace the HTML form business data with the printed word template as follows:
[0018] Enter the HTML form business data, and replace the form business data with the print word template according to the bookmark configured in the print word template when saving;
[0019] When printing, the generated word microservice is called to store the generated word file of the substitute form business data to the file server for printing and downloading.
[0020] Preferably, the print job is sent directly to the local printer for silent printing as follows:
[0021] Use nginx proxy to proxy the generated word files, and select the files to be printed in batches through IE browser;
[0022] When the generated word file is requested to be printed through nginx proxy, the server returns the file stream;
[0023] The IE browser starts the local office word application, and the office word application calls the print function to send the file stream to be printed to the printer to complete silent printing.
[0024] A system for implementing batch silent printing based on HTML, the system comprising:
[0025] HTML designer, used to draw the print word template into HTML and provide input of print business data;
[0026] Nginx, used to implement services and file proxy;
[0027] IE browser, used to implement the transfer association between local word and word files on the file server;
[0028] The file server microservice is used to implement the maintenance interface of the HTML template and the conversion function of the HTML form data; it is also used to convert the form data into the printing word template data and store the printing word template data in the file service, and implement the maintenance interface of the printing word template and the mapping interface between the printing word template domain and the HTML domain;
[0029] The FastDFS architecture is used for clients to request Tracker servers to upload and download files. The files are then uploaded and downloaded by the Storage server through Tracker server scheduling.
[0030] As a preferred method, when Nginx calls to generate the word microservice, it finds the corresponding application service through the Nginx proxy and transmits the data to the corresponding word microservice;
[0031] When IE browser accesses the word file, the Nginx proxy has generated the word file and returns the file information on the file server to the IE browser according to the access path. IE can then directly obtain the file to be printed.
[0032] As a preferred embodiment, the ActiveX of the IE browser calls the local office word application interface technology to realize the transmission association between the local word application and the word file on the file server, and uses the officeword control of the ActiveX of the IE browser to realize the transmission of the word file on the file server to the local office word application; the details are as follows:
[0033] (1) By calling the print function of the Office Word control of ActiveX, the Word file stream on the file server is transferred to the local Office Word application;
[0034] (2) The local office word calls the printer again;
[0035] (3) Send the word file on the file server to the printer;
[0036] (4) The printer is awakened and silently prints the file stream on the file server.
[0037] Preferably, the FastDFS architecture has the following roles:
[0038] ① Tracker Server: used for scheduling and balancing; specifically:
[0039] Manage all storage servers and groups. After startup, each storage will connect to Tracker, inform the information of its group, and maintain periodic heartbeats. When uploading files, Trackerserver will find Storageserver according to the set strategy to provide file upload services.
[0040] ② Storage Server: Provides capacity and backup services; specifically:
[0041] The unit is group. There are multiple storage servers in each group, and the data is backed up by each other. Storage server does not implement its own file system but uses the file system of the operating system to manage files.
[0042] ③. Client: The server for uploading and downloading data, that is, the server where our own project is deployed.
[0043] Preferably, the working process of the system is as follows:
[0044] (1) Use HTML designer to draw the document template into HTML, and IE browser renders the drawn HTML to realize the document printing template input interface;
[0045] (ii) After completing the form data, submit it to the file server. The microservice that generates the word will process the data and replace the form data with the print word template using the bookmark, thereby writing the data back to the print word template;
[0046] (3) When printing, generate a word file and save it to the file server.
[0047] A computer-readable storage medium stores a computer program, and the computer program can be executed by a processor to implement the above-mentioned method for implementing batch silent printing based on HTML.
[0048] The method and system for implementing batch silent printing based on HTML of the present invention have the following advantages:
[0049] (i) The present invention configures form templates and word printing templates through an interface, maps the business relationship between forms and printing templates, directly selects the print form browser to start local office word when printing, and returns the print task to the printer. Compared with the traditional batch printing method, only office word needs to be installed on the client, while many third-party printing methods require the installation of third-party plug-ins;
[0050] (ii) The present invention is based on HTML and has good compatibility with previous business systems, which not only saves development costs but also has good expansibility and applicability; it also provides a visual configuration interface, which can be customized by printing templates;
[0051] (III) The form template configuration of the present invention is flexible and can be configured in different versions according to different forms;
[0052] (iv) The printing word template of the present invention can configure different templates according to versions, map the business relationship of the form to the printing template, and multiple templates can be configured with multiple business relationships;
[0053] (V) When printing, the present invention directly selects the print form browser to start the local office word, and returns the print task to the printer. The printer does not need to preview, which saves a lot of operation time. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] The present invention is further described below in conjunction with the accompanying drawings.
[0055] Attached Figure 1 A flowchart of a method for implementing batch silent printing based on HTML;
[0056] Attached Figure 2 This is a structural block diagram of a system for implementing batch silent printing based on HTML. DETAILED DESCRIPTION
[0057] The method and system for implementing batch silent printing based on HTML of the present invention are described in detail below with reference to the accompanying drawings and specific embodiments of the specification.
[0058] Embodiment 1:
[0059] The method for implementing batch silent printing based on HTML of the present invention is to extract and map HTML data to a corresponding word template, and output the reversed word file to a local printer to implement silent printing during printing; the details are as follows:
[0060] S1. Configure HTML template: configure HTML according to the template to be printed to provide business data entry;
[0061] S2. Configure the word template to be printed;
[0062] S3. Configure the mapping of corresponding items between HTML and print word templates: map business items one by one according to the relationship between HTML and print word templates;
[0063] S4. Replace the HTML form business data into the print word template;
[0064] S5. When printing, the print task is sent directly to the local printer for silent printing.
[0065] The configuration of the word template to be printed in step S2 of this embodiment is as follows:
[0066] S201, mapping to a print word template according to the HTML service;
[0067] S202, when the HTML form business data is filled in and saved, the HTML form business data is replaced with the print word template;
[0068] S203: When the form business data template changes, just modify the corresponding template.
[0069] In step S4 of this embodiment, the HTML form service data is replaced into the print word template as follows:
[0070] S401, entering HTML form business data, and replacing the form business data with the print word template according to the bookmark configured in the print word template when saving;
[0071] S402: When printing, call the generated word microservice to store the generated word file of the substitute form business data in the file server so as to provide printing and downloading.
[0072] In this embodiment, step S5 of sending the print task directly to the local printer for silent printing is specifically as follows:
[0073] S501, use nginx proxy to proxy the generated word files, and select the files to be printed in batches through IE browser;
[0074] S502, when the generated word file is requested to be printed through nginx proxy, the server returns the file stream;
[0075] S503, the IE browser starts the local office word application, and the office word application calls the print function to send the file stream to be printed to the printer, thereby completing silent printing.
[0076] As attached Figure 1 As shown, the printing process of the present invention is as follows:
[0077] (1) Use HTML to draw the document web page template and implement the data entry interface;
[0078] (2) Use HTML to print the word template configuration, map the filled data to the print word template, and write the data back to word;
[0079] (3) When printing, the reverse-written word file is output to the printer to achieve silent printing.
[0080] Embodiment 2:
[0081] As attached Figure 2 As shown, the system for implementing batch silent printing based on HTML of the present invention mainly involves HTML technology, HTML designer, Ajax technology, Nginx, IE browser ActiveX calling local office word application interface technology, microservices, and file storage service FastDFS. The system includes:
[0082] HTML designer is used to draw the printing word template into HTML and provide input for printing business data. The reason for using HTML designer is that the printing template modification and maintenance volume is relatively large. Using HTML designer can unify management and maintenance and reduce workload.
[0083] Ajax mainly implements submitting the print form business data to the backend server, echoing and initializing the form data, and checking whether the server file exists.
[0084] Nginx is used to implement services and file proxies. When Nginx calls to generate word microservices, it finds the corresponding application service through the Nginx proxy and transmits the data to the corresponding word microservice.
[0085] When IE browser accesses the word file, the Nginx proxy has generated the word file and returns the file information on the file server to the IE browser according to the access path. IE can then directly obtain the file to be printed.
[0086] IE browser is used to realize the transfer association between the local word application and the word file on the file server; the ActiveX of the IE browser calls the local office word application interface technology to realize the transfer association between the local word application and the word file on the file server, and uses the office word control of the ActiveX of the IE browser to realize the transmission of the word file on the file server to the local office word application; the details are as follows:
[0087] (1) By calling the print function of the Office Word control of ActiveX, the Word file stream on the file server is transferred to the local Office Word application;
[0088] (2) The local office word calls the printer again;
[0089] (3) Send the word file on the file server to the printer;
[0090] (4) The printer is awakened and silently prints the file stream on the file server.
[0091] The file server microservice is used to implement the maintenance interface of the HTML template and the conversion function of the HTML form data; it is also used to convert the form data into the printing word template data and store the printing word template data in the file service, and implement the maintenance interface of the printing word template and the mapping interface between the printing word template domain and the HTML domain;
[0092] The FastDFS architecture is used for clients to request Tracker servers to upload and download files. The files are then uploaded and downloaded by the Storage server through Tracker server scheduling. The FastDFS architecture has the following roles:
[0093] ① Tracker Server: used for scheduling and balancing; specifically:
[0094] Manage all storage servers and groups. After startup, each storage will connect to Tracker, inform the information of its group, and maintain periodic heartbeats. When uploading files, Trackerserver will find Storageserver according to the set strategy to provide file upload services.
[0095] ② Storage Server: Provides capacity and backup services; specifically:
[0096] The unit is group. There are multiple storage servers in each group, and the data is backed up by each other. Storage server does not implement its own file system but uses the file system of the operating system to manage files.
[0097] ③. Client: The server for uploading and downloading data, that is, the server where our own project is deployed.
[0098] The working process of the system is as follows:
[0099] (1) Use HTML designer to draw the document template into HTML, and IE browser renders the drawn HTML to realize the document printing template input interface;
[0100] (ii) After completing the form data, submit it to the file server. The microservice that generates the word will process the data and replace the form data with the print word template using the bookmark, thereby writing the data back to the print word template;
[0101] (3) When printing, generate a word file and save it to the file server.
[0102] Embodiment 3:
[0103] The embodiment of the present invention further provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions are loaded by a processor, so that the processor executes the method for implementing batch silent printing based on HTML in any embodiment of the present invention. Specifically, a system or device equipped with a storage medium can be provided, on which a software program code for implementing the functions of any of the above embodiments is stored, and a computer (or CPU or MPU) of the system or device reads and executes the program code stored in the storage medium.
[0104] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0105] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.
[0106] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.
[0107] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0108] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for implementing batch silent printing based on HTML, characterized in that: This method extracts HTML data and maps it to the corresponding word template, and outputs the reversed word file to the local printer to achieve silent printing when printing; the details are as follows: Configure HTML template: Configure HTML according to the template to be printed to provide business data entry; Configure the word template to be printed; Configure the mapping between HTML and print word templates: map business items one by one according to the relationship between HTML and print word templates; Replace the HTML form business data into the print word template; When printing, the print task is sent directly to the local printer for silent printing; The configuration of the word template to be printed and the mapping of the corresponding items between HTML and the printed word template are as follows: Map HTML business items to print word templates; When the HTML form business data is filled in and saved, the HTML form business data is replaced with the print word template; When the form business data template changes, just modify the corresponding template; Replace the HTML form business data with the print word template as follows: Enter the HTML form business data, and replace the form business data with the print word template according to the bookmark configured in the print word template when saving; When printing, call the generated word microservice to store the generated word file of the substitute form business data on the file server for printing and downloading; Send the print job directly to the local printer for silent printing as follows: Use nginx proxy to proxy the generated word files, and select the files to be printed in batches through IE browser; When the generated word file is requested to be printed through nginx proxy, the server returns the file stream; The IE browser starts the local office word application, and the office word application calls the print function to send the file stream to be printed to the printer to complete silent printing.
2. A system for implementing batch silent printing based on HTML, characterized in that: The system is used to implement the method for implementing batch silent printing based on HTML as claimed in claim 1; the system comprises: HTML designer, used to draw the print word template into HTML and provide input of print business data; Nginx, used to implement services and file proxy; IE browser, used to implement the transfer association between local word and word files on the file server; The file server microservice is used to implement the maintenance interface of the HTML template and the conversion function of the HTML form data; it is also used to convert the form data into the printing word template data and store the printing word template data in the file service, and implement the maintenance interface of the printing word template and the mapping interface between the printing word template domain and the HTML domain; Fast DFS architecture is used for clients to request Tracker servers to upload and download files. The files are then uploaded and downloaded by Storage servers through Tracker server scheduling. When Nginx calls to generate the word microservice, it finds the corresponding application service through the Nginx proxy and transmits the data to the corresponding word microservice; When IE browser accesses the word file, the Nginx proxy has generated the word file and returns the file information on the file server to the IE browser according to the access path. IE can then directly obtain the file to be printed. The ActiveX of the IE browser calls the local office word application interface technology to realize the transmission association between the local word application and the word file on the file server, and uses the office word control of the ActiveX of the IE browser to realize the transmission of the word file on the file server to the local office word application; the details are as follows: (1) By calling the print function of the Office Word control of ActiveX, the Word file stream on the file server is transferred to the local Office Word application; (2) The local office word calls the printer again; (3) Send the word file on the file server to the printer; (4) The printer is awakened and the file stream on the file server is silently printed; The Fast DFS architecture has the following roles: ①. Tracking server: used for scheduling and balancing; specifically: Manage all Storage servers and groups. After startup, each storage will connect to the Tracker, inform the information of the group to which it belongs, and maintain periodic heartbeats. When uploading files, the Tracker server will find the Storage server according to the set policy to provide file upload services. ② Storage server: provides capacity and backup services; specifically: The unit is group. There are multiple Storage servers in each group, and the data is backed up by each other. Storage server uses the file system of the operating system to manage files. ③、Client: server for uploading and downloading data; The working process of the system is as follows: (1) Use HTML designer to draw the document template into HTML, and use IE browser to render the drawn HTML to realize the document printing template input interface; (ii) After completing the form data, submit it to the file server. The microservice that generates the word will process the data and replace the form data with the print word template using the bookmark, thereby writing the data back to the print word template; (III) Generate a word file when printing and save it to the file server.
3. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which can be executed by a processor to implement the method for implementing batch silent printing based on HTML as claimed in claim 1.
Citation Information
Patent Citations
Report printing method and system based on HTML (Hyper Text Markup Language) template
CN104571977A
Map page printing method and system
CN110399105A