Receipt printing implementation method and storage medium for government hall
Through the server-side template engine and conversion tools, cross-terminal display and unified format of receipts in government affairs halls are realized, which solves the problems of difficulty in maintaining receipt templates and inconsistent display, and improves the convenience and operation and maintenance efficiency of government services.
Patent Information
- Application Number
- CN202110746352.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-01
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-07-01
AI Technical Summary
It is difficult to maintain the receipt template of the government hall and cannot be displayed across terminals. The traditional printing method is backward, resulting in low service efficiency and high operation and maintenance costs, affecting the convenience and mobility of government services.
The server-side outputs html text format based on the Freemarker template engine, and converts it into pdf and image formats through Java iText and Pdfbox tools to achieve cross-terminal display, combines lodop printing components and pdf.js for silent printing, and provides an online template editor for templates. Configuration and maintenance.
It realizes centralized management of receipt templates and unified display across terminals, reduces the need for manual maintenance, improves the convenience and operation and maintenance efficiency of government services, and supports the same performance effects of multiple types of terminals.
Smart Images

Figure CN113608706B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data printing, and specifically to a method and storage medium for printing receipts in a government hall. Background Art
[0002] In the field of government services, people who come to do business usually queue up in the government hall to get a number. The number-taking machine will provide a small ticket with detailed information about the matter, including basic information of the matter, available windows, current number of people waiting, queue number, etc., so that people can easily obtain information about the queue. Therefore, the printed ticket has certain format requirements. At present, general surveys have found that the number-taking machines in government halls generally run on the Windows platform. The technical architecture is a C# application built on WinForm or a Node application built on open source electron. The mode of printing small tickets is to use html files as templates, which are rendered with dynamic data and then printed using the lodop printing component. However, since the html file as a template is saved on the client, it is more troublesome to change the template layout due to business changes. It is necessary to manually change the template file on the number-taking terminal on site. This approach undoubtedly occupies a lot of human resources, has low service efficiency, and is not conducive to long-term operation and maintenance.
[0003] With the gradual development of mobile Internet, the government service capabilities need to be continuously improved, and the government service level needs to be continuously developed. This is reflected in the government queuing number requirements, which require the number-taking methods to become more diversified and convenient, the number-taking process to be more humane and intelligent, and the number-taking results to be more accurate and mobile. Therefore, the printed receipt after taking the number is no exception and must have a new form of presentation, that is, paperless services display the number-taking receipt on the mobile application, and the style and content must be consistent with the number-taking machine. However, at this stage, the output of the ticket template does not have the ability to cross terminals and platforms, and the data and format cannot be guaranteed to be unified on multiple terminals.
[0004] The following problems exist in the printing of queue-taking receipts in the government field: printing templates are difficult to maintain, maintenance labor costs are high, changing demands cannot be responded to quickly, receipts cannot be displayed across terminals, content formats are not unified, traditional printing methods are backward, the content displayed on the queue-taking receipts is complex, etc. However, with the continuous development of government service capabilities, more new problems will arise with queue-taking receipts, affecting the user experience of the people who come to do business and hindering the improvement of the government's service capabilities. Summary of the invention
[0005] The technical task of the present invention is to provide a method and storage medium for implementing receipt printing in a government service hall, so as to solve the problem of how to avoid the need to manually change the template on site at the government service hall every time the template is updated, and to provide users and operation and maintenance personnel with a root number experience and convenience, thereby improving the efficiency and service capabilities of the government service hall.
[0006] The technical task of the present invention is achieved in the following way: a method for printing a receipt in a government hall, which is specifically as follows:
[0007] On the server side, make templates based on the Freemarker template engine and output them in HTML text format;
[0008] Convert html text format to pdf text format based on Java iText conversion tool on the server side;
[0009] On the server side, convert the pdf text format into an image format file based on the Pdfbox conversion tool;
[0010] Different printing methods are used for PDF format files and image format files on each terminal platform of the client to display the content of the receipt.
[0011] Preferably, the Freemarker template engine uses the rend method to output the HTML file format, as follows:
[0012] Based on the ftl template file and dynamic rendering data, assemble the dynamic rendering data into eneity entity class;
[0013] Convert the uploaded image data in the dynamic rendering data into base64 text;
[0014] Convert the QR code and barcode generated by the tool class into base64 text;
[0015] Call the render method to convert the ftl text retrieved from the database into standard html text format.
[0016] More preferably, the eneity entity class includes strings, objects, arrays and lists.
[0017] Preferably, the Java iText conversion tool adopts the iText5 version, and the Freemarker template engine is parsed into the html text format based on the iText5 version and then converted into a pdf format file, as follows:
[0018] Relying on Flying Sacuer to complete the analysis of CSS advanced features, the PDF format file is based on the PostScript language image model, which ensures accurate color and accurate printing effect. That is, PDF will faithfully reproduce every character, color and image of the original file, which is the most ideal carrier format for cross-end display;
[0019] With the help of Chinese fonts and CSS advanced feature components installed on the server, @page sets the size of the template content;
[0020] PDF files can be displayed on various terminals, or converted into image files using Pdfbox on mobile devices.
[0021] As a preferred method, different printing methods are used on various terminal platforms of the client for PDF format files and image format files to complete the content display of the receipt. The specific situation is as follows:
[0022] ①. The number-taking terminal in the government hall uses lodop as the web printing component, and uses the pdf.js rendering tool to parse the PDF output file into canvas and call lodop to achieve silent printing;
[0023] ②. Get the pdf format file or image format file on the mobile terminal and display it directly.
[0024] Preferably, the number-taking terminal includes an Electron terminal and a WinFrom terminal; the printer on the number-taking terminal is a thermal printer, and the sizes of thermal papers of different models are different, as follows:
[0025] Set the size of the printed receipt template. Drag or click the provided component pattern to the template area according to your needs. Each component pattern has its own configuration rules. Modify its configuration rules to complete the configuration of the template. You can freely change the position of the components in the configured template by dragging the component domain.
[0026] The standard code corresponding to each component follows the syntax of Freemarker and Html, and provides a source code mode for operation and maintenance personnel to change the specific display details of the component at any time. After all the editing is completed, the source code corresponding to the component will be combined into a text in ftl format and stored in the database;
[0027] In addition to the editing function, it also provides a real-time preview function, which allows you to input virtual data of all required data in the component to generate PDF format files or image format files, achieving a completely WYSIWYG printing effect in the background management system.
[0028] Preferably, the dynamic rendering data adopts the Java server-side rendering method, and uses the Freemarker template engine to render a complete HTML file, as follows:
[0029] The backend management system provides online editing of the .ftl format text of the Freemarker template engine, and all data is persisted in the database;
[0030] The Freemarker template engine provides three ways to read templates: loading modules from a directory on the file system on the disk, loading templates from the class path, and loading templates from the web application directory.
[0031] When the service uses the built-in class loader to read the template from the database, it uses the freemarker.cache.TemolateLoader interface to implement its own DataSourceTemplateLoader, reads different template files according to different business scenarios, calls its rendering process again, and renders the dynamic data of the order into a complete version of HTML format text.
[0032] Preferably, the working process of the number taking terminal is as follows:
[0033] (1) After the number is taken, the terminal requests the server to print a receipt;
[0034] (2) The server obtains the ftl format file of the corresponding printing template from the database or cache, assembles the required dynamic data, and uses the Freemarker template engine to render the data and template into a standard html format document;
[0035] (3) Use iText to convert the HTML document into a PDF document, and then transfer the PDF document file stream to the number-taking terminal;
[0036] (4) pdf.js processes the pdf file stream and loads it into a hidden canvas. The electron development used by the number-taking terminal uses ipcReader to call the lodop printing component to implement silent printing. In this way, there is no need to arrive at the site every time the style of the receipt needs to be changed. It can be achieved by changing the print template file data stored on the server. When the template on the server changes, there is no need to notify each terminal, and the matter can be switched directly without feeling.
[0037] Preferably, the background management system of the printing template uses an online template editor for the receipt template. The online template editor has the functions of componentization, dragging, real-time preview and online editing. The operating logic is a combination of dragging and manual editing. The content displayed on the receipt is divided into different components according to the format, and various patterns of built-in text fields, lists, QR codes, title headers, straight lines, dotted lines, * lines, # lines, simple tables, height-increasing pads, pictures and barcodes.
[0038] A computer-readable storage medium having a computer program stored therein, wherein the computer program can be executed by a processor to implement the above-mentioned method for printing receipts in a government affairs hall.
[0039] The government hall receipt printing implementation method and storage medium of the present invention have the following advantages:
[0040] (I) The present invention provides a method for implementing the printing of ticket collection receipts in a government service hall in the field of government service, and particularly relates to a method for achieving the same performance of receipts of multiple types of terminals, optimizing the ticket printing mode of the ticket collection machine in the government service hall, and using server-side configuration and rendering to improve the efficiency of development and deployment, and enhance the cross-platform performance of receipt information;
[0041] (ii) The present invention implements the configuration of printing templates and rendering based on dynamic data based on the freemarker template engine, uses Java iText to convert HTML format text into PDF format text, and uses PDFbox to convert PDF into image format. Different printing methods for PDF and image formats on various terminal platforms can have the same performance capabilities;
[0042] (III) The number-taking terminals in government service halls and the mobile terminal devices of the public are diverse and used in different ways. After taking the number, in order to provide the public with the same information feedback, a number-taking receipt will be output as a voucher for subsequent services. The content and format of the receipt need to be concise and clear and have service effectiveness. Therefore, the receipt must have the same display format and data. The server-side assembly and rendering ensures the same display format across terminals. There must also be a background management function for template content to avoid frequent offline changes, free editing to adapt to changes in needs, quick customization, simple use and convenient operation and maintenance;
[0043] (IV) The present invention uses the Freemarker template engine to make templates, which has high performance and high efficiency. The database manages the number of ftl template files, which is convenient for operation and maintenance and rapid version iteration. The database manages all maintained template data to achieve template maintenance by the management end. The server is used to render the freemarker template into a PDF format file as the receipt data, achieving the same performance effect across terminals.
[0044] (V) The Freemarker template data of the present invention can be manually maintained and edited in the background management system, and virtual data is used to render and output the display content in real time, which has the capability of what you see is what you get, and can ensure completely consistent printing effect display during the maintenance stage; at the same time, freemarker is used as the template parsing engine, the database manages all ftl template files, and the online template editor is used to realize what you see is what you get small ticket printing template editing, and the ftl template file is rendered as an html file, and the iText library is used to convert it into a pdf file as the carrier of the small ticket for transmission;
[0045] (VI) The present invention uses a dynamic data rendering template to output Html text format, and converts Html to PDF file based on JavaiText to ensure the uniformity of multi-terminal output formats;
[0046] (VII) The present invention converts the PDF format into the image format based on PDFBox to ensure multi-format transmission and display;
[0047] (VIII) The government hall terminal of the present invention uses lodop as a web printing component, uses pdf.js to parse the pdf output file to canvas, and calls lodop to realize silent printing;
[0048] (IX) The mobile terminal of the present invention obtains a PDF format file or a picture format file for display, ensuring that the receipt has the same validity certificate;
[0049] (10) The printing method of the receipt template data provided by the present invention can enable the receipt to be flexibly changed when the display style and display content need to be changed, which brings great convenience to users and operation and maintenance personnel, and avoids the need to go to the government hall for manual changes every time the template is updated;
[0050] (XI) The online template editor makes it easy to maintain the template format and content, and has excellent personalized customization capabilities. The online template editor enables real-time editing and preview of FTL format file data, and realizes the ability to print what you see is what you get;
[0051] (XII) Server-side rendering avoids inconsistent display effects caused by the diversity of client types. At the same time, server-side rendering can give full play to the computing power of the server, and the rendering effect is efficient and fast;
[0052] (XIII) The pdf file format, as the transmission information, achieves the same presentation effect and presentation capability on multiple types of terminals. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] The present invention is further described below in conjunction with the accompanying drawings.
[0054] Attached Figure 1 This is a flowchart of the implementation method for printing receipts in the government hall. DETAILED DESCRIPTION
[0055] The following detailed description is made of the government hall receipt printing implementation method and storage medium of the present invention with reference to the drawings and specific embodiments of the specification.
[0056] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0057] Embodiment 1:
[0058] As attached Figure 1 As shown, the method for printing receipts in the government hall of the present invention is as follows:
[0059] S1. Make a template based on the Freemarker template engine on the server and output it in HTML text format;
[0060] S2. Convert the html text format to pdf text format based on the Java iText conversion tool on the server side;
[0061] S3. Convert the pdf text format into an image format file based on the Pdfbox conversion tool on the server side;
[0062] S4. Different printing methods are used for PDF format files and image format files on each terminal platform of the client to display the content of the receipt.
[0063] In this embodiment, the Freemarker template engine uses the rend method to output the HTML file format, as follows:
[0064] S101, based on the ftl template file and the dynamic rendering data, assembling the dynamic rendering data into an eneity entity class; the eneity entity class includes a string, an object, an array and a list;
[0065] S102, converting the data of the uploaded image in the dynamic rendering data into base64 text;
[0066] S103, converting the QR code and barcode generated by the tool class into base64 text;
[0067] S104, calling the render method to convert the ftl text retrieved from the database into a standard html text format.
[0068] In this embodiment, the Java iText conversion tool adopts the iText5 version, and the Freemarker template engine is parsed into the html text format based on the iText5 version and then converted into a pdf format file, as follows:
[0069] (1) Rely on Flying Sacuer to complete the analysis of CSS advanced features. The PDF format file is based on the PostScript language image model to ensure accurate color and accurate printing effect. That is, PDF will faithfully reproduce every character, color and image of the original file, which is the most ideal carrier format for cross-end display;
[0070] (2) Install Chinese fonts and CSS advanced feature components on the server, and set the size of the template content with @page;
[0071] (3) PDF files can be displayed on various terminals, or converted into image files using Pdfbox on mobile devices.
[0072] In this embodiment, different printing methods are used on each terminal platform of the client for PDF format files and image format files to complete the content display of the receipt. The specific situation is as follows:
[0073] ①. The number-taking terminal in the government hall uses lodop as the web printing component, and uses the pdf.js rendering tool to parse the PDF output file into canvas and call lodop to achieve silent printing;
[0074] ②. Get the pdf format file or image format file on the mobile terminal and display it directly.
[0075] The number-taking terminal in this embodiment includes an Electron terminal and a WinFrom terminal; the printer on the number-taking terminal is a thermal printer, and the sizes of thermal papers of different models are different, as follows:
[0076] (1) Set the size of the printed receipt template. Drag or click the provided component pattern to the template area according to your needs. Each component pattern has its own configuration rules. Modify its configuration rules to complete the configuration of the template. The position of the components in the configured template can be freely changed by dragging the component domain.
[0077] (2) The standard code corresponding to each component follows the syntax of Freemarker and Html, and provides a source code mode for operation and maintenance personnel to change the specific display details of the component at any time. After all the editing is completed, the source code corresponding to the component will be combined into a text in ftl format and stored in the database;
[0078] (3) In addition to the editing function, it provides a real-time preview function, which allows you to input virtual data of all required data in the component to generate a PDF file or an image file, achieving a WYSIWYG printing effect in the background management system.
[0079] There are many ways to implement the template rendering of printing receipts. There are two ways to achieve cross-terminal capabilities. One is client-side rendering. Each type of terminal obtains the transmitted data. Since it is cross-terminal, the defined data format has strict requirements and general universality. Each terminal relies on the parsing method and ability of its own platform to parse and render. The implementation method of this rendering is essentially similar to the cloud form system relying on the SDK of each terminal to process the data into the same content. However, the disadvantage is that the SDK of each terminal needs to be developed and maintained separately, resulting in slow function iteration. The general universality of the data format leads to certain differences in the performance of each terminal. The maintenance of the data format is relatively complex, and the rendering capability and performance results are inconsistent during the operation and maintenance stage. Another way is server-side rendering, which abandons the differences between terminal types and assigns the rendering task to the server with better performance. The data transmitted to the client is a completely fixed pdf file format or image file format, which ensures the same performance results for each terminal. The server-side rendering still needs to manage the template of the receipt. The html file is still a good template carrier. The combination of assembled dynamic data and html can get priority performance. Therefore, based on the above analysis, the method of this patent chooses to use server-side rendering.
[0080] Generally speaking, the combination of javascript and html has excellent performance, especially when used as a carrier for receipt templates. However, when there is no browser, a JavaScript operating environment, the dynamic rendering data in this embodiment adopts the Java server-side rendering method and uses the Freemarker template engine to render a complete html file, as follows:
[0081] (1) The backend management system provides online editing of the .ftl format text of the Freemarker template engine, and all data is persisted in the database;
[0082] (2) The Freemarker template engine provides three ways to read templates: loading modules from a directory on the file system on the disk, loading templates from the class path, and loading templates from the web application directory.
[0083] (3) When the service uses the built-in class loader to read the template from the database, it uses the freemarker.cache.TemolateLoader interface to implement its own DataSourceTemplateLoader, reads different template files according to different business scenarios, calls its rendering process again, and renders the dynamic data of the order into a complete version of HTML format text.
[0084] The number-taking terminal runs on a Windows environment. Electron technology is currently widely used to achieve cross-platform development. Advanced features can be displayed based on JavaScript and C# at the same time. The pdf.js and lodop printing components cooperate with each other to achieve silent printing of the terminal number-taking receipt. Specifically, the working process of the number-taking terminal in this embodiment is as follows:
[0085] (1) After the number is taken, the terminal requests the server to print a receipt;
[0086] (2) The server obtains the ftl format file of the corresponding printing template from the database or cache, assembles the required dynamic data, and uses the Freemarker template engine to render the data and template into a standard html format document;
[0087] (3) Use iText to convert the HTML document into a PDF document, and then transfer the PDF document file stream to the number-taking terminal;
[0088] (4) pdf.js processes the pdf file stream and loads it into a hidden canvas. The electron development used by the number-taking terminal uses ipcReader to call the lodop printing component to implement silent printing. In this way, there is no need to arrive at the site every time the style of the receipt needs to be changed. It can be achieved by changing the print template file data stored on the server. When the template on the server changes, there is no need to notify each terminal, and the matter can be switched directly without feeling.
[0089] Among them, iText is a well-known open source Java class library. Through iText, you can not only generate PDF or RTF documents, but also convert XML and HTML files into PDF files.
[0090] In this embodiment, the background management system of the printing template uses an online template editor for the receipt template. The online template editor has the functions of componentization, dragging, real-time preview and online editing. The operation logic is a combination of dragging and manual editing. The content displayed on the receipt is divided into different components according to the format, and various patterns such as built-in text fields, lists, QR codes, title headers, straight lines, dotted lines, * lines, # lines, simple tables, height-increasing pads, pictures and barcodes.
[0091] The present invention uses the ticket printing terminal in the government service hall as a system case: a queuing number-taking program in the government service field is developed based on the front-end and back-end separation mode. The background management end and the number-taking terminal and various types of number-taking terminals are run separately. The background management system has a ticket printing management module. The module has an online template editor, which provides a variety of component types that are dragged to the ticket area for typesetting. Each component has a separate attribute configuration. The editor also provides a source code mode to fine-tune the specific display details of the template. After the template editing is completed, it is persistently stored in a database or a cache such as Redis and Memcache.
[0092] After the number-taking terminal completes the number-taking process, it sends a request to print a receipt to the server. The server assembles the dynamic data, obtains the ftl template in the database, calls the template engine to render it into a complete html format file, and uses the java iText library to convert the html format file into a pdf format file stream and transmits it to the number-taking terminal. The number-taking terminal uses pdf.js to parse the file stream and uses the lodop printing component to achieve silent printing of the receipt template. The entire process is fast. After getting the number-taking receipt, the people who come to do the business just need to wait for the number to be called to handle the business. The receipt also has a QR code or barcode, which can be scanned using WeChat to jump to the complete information about the number-taking business.
[0093] In addition, after the mobile terminal takes the number, it uses the same processing flow to request the server to obtain the PDF file or image file of the printed receipt for display, which can ensure that it has the same credential validity and display capabilities as the number-taking machine terminal.
[0094] Embodiment 2:
[0095] 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 the printing of receipts in the government hall 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.
[0096] 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.
[0097] 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.
[0098] 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.
[0099] 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.
[0100] 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 with 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 printing receipts in a government hall, characterized in that: The method is as follows: On the server side, make templates based on the Freemarker template engine and output them in HTML text format; On the server side, convert the html text format into pdf text format based on the Java iText conversion tool; On the server side, convert the pdf text format into an image format file based on the Pdfbox conversion tool; Different printing methods are used for PDF format files and image format files on each terminal platform of the client to display the content of the receipt; Among them, the Freemarker template engine uses the rend method to output the HTML file format, as follows: Based on the ftl template file and dynamic rendering data, assemble the dynamic rendering data into eneity entity classes; wherein the eneity entity classes include strings, objects, arrays and lists; Convert the uploaded image data in the dynamic rendering data into base64 text; Convert the QR code and barcode generated by the tool class into base64 text; Call the render method to convert the ftl text retrieved from the database into standard html text format; The Java iText conversion tool uses the iText5 version. Based on the iText5 version, the Freemarker template engine is parsed into HTML text format and then converted into PDF format files. The details are as follows: Relying on Flying Sacuer to complete the analysis of CSS advanced features, the PDF format file is based on the PostScript language image model, which ensures accurate color and accurate printing effect. That is, PDF will faithfully reproduce every character, color and image of the original file, which is the most ideal carrier format for cross-end display; With the help of Chinese fonts and CSS advanced feature components installed on the server, @page sets the size of the template content; PDF files can be displayed on various terminals, or converted into image files using Pdfbox on mobile terminals; Different printing methods are used on various terminal platforms of the client for PDF format files and image format files to complete the content display of the receipt. The specific situation is as follows: ①. The number-taking terminal in the government hall uses lodop as the web printing component, and uses the pdf.js rendering tool to parse the PDF output file into canvas and call lodop to achieve silent printing; ②. Get the pdf format file or picture format file on the mobile terminal and display it directly; The number-taking terminal includes the Electron terminal and the WinFrom terminal; the printer on the number-taking terminal is a thermal printer, and the sizes of thermal paper of different models are different, as follows: Set the size of the printed receipt template. Drag or click the provided component pattern to the template area according to your needs. Each component pattern has its own configuration rules. Modify its configuration rules to complete the configuration of the template. You can freely change the position of the components in the configured template by dragging the component domain. The standard code corresponding to each component follows the syntax of Freemarker and Html, and provides a source code mode for operation and maintenance personnel to change the specific display details of the component at any time. After all the editing is completed, the source code corresponding to the component will be combined into a text in ftl format and stored in the database; Provide real-time preview function, input virtual data of all required data in the component to generate PDF format files or image format files, and achieve the effect of what you see is what you get in the background management system; Dynamic rendering data uses Java server-side rendering and uses the Freemarker template engine to render a complete HTML file, as follows: The backend management system provides online editing of the .ftl format text of the Freemarker template engine, and all data is persisted in the database; The Freemarker template engine provides three ways to read templates: loading modules from a directory on the file system on disk, loading templates from the class path, and loading templates from the web application directory. When the service uses the built-in class loader to read the template from the database, it uses the freemarker.cache.TemolateLoader interface to implement its own DataSourceTemplateLoader, reads different template files according to different business scenarios, calls its rendering process again, and renders the dynamic data of the order into a complete version of the HTML format text; The working process of the number-taking terminal is as follows: (1) After the number is taken, the terminal requests the server to print a receipt; (2) The server obtains the ftl format file of the corresponding print template from the database or cache, assembles the required dynamic data, and uses the Freemarker template engine to render the data and template into a standard html format document; (3) Use iText to convert the HTML document into a PDF document, and then transfer the PDF document file stream to the number-taking terminal; (4) pdf.js processes the pdf file stream and loads it into the hidden canvas. The electron development used by the number-taking terminal uses ipcReader to call the lodop printing component to achieve silent printing, which is achieved by changing the print template file data stored on the server. The background management system of the printing template uses the online template editor for the receipt template. The online template editor has the functions of componentization, dragging, real-time preview and online editing. The operation logic is a combination of drag-and-drop operation and manual editing. The content displayed on the receipt is divided into different components according to the format, and various patterns such as built-in text fields, lists, QR codes, title headers, straight lines, dotted lines, * lines, # lines, simple tables, height-increasing pads, pictures and barcodes.
2. 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 printing receipts in a government hall as described in claim 1.
