CN113608706A - Method for printing tickets in government affair hall and storage medium - Google Patents

Method for printing tickets in government affair hall and storage medium Download PDF

Info

Publication number
CN113608706A
CN113608706A CN202110746352.1A CN202110746352A CN113608706A CN 113608706 A CN113608706 A CN 113608706A CN 202110746352 A CN202110746352 A CN 202110746352A CN 113608706 A CN113608706 A CN 113608706A
Authority
CN
China
Prior art keywords
template
printing
format
file
pdf
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110746352.1A
Other languages
Chinese (zh)
Inventor
张超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Software Co Ltd
Original Assignee
Inspur Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Software Co Ltd filed Critical Inspur Software Co Ltd
Priority to CN202110746352.1A priority Critical patent/CN113608706A/en
Publication of CN113608706A publication Critical patent/CN113608706A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1203Improving or facilitating administration, e.g. print management
    • G06F3/1204Improving or facilitating administration, e.g. print management resulting in reduced user or operator actions, e.g. presetting, automatic actions, using hardware token storing data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1237Print job management
    • G06F3/1244Job translation or job parsing, e.g. page banding
    • G06F3/1248Job translation or job parsing, e.g. page banding by printer language recognition, e.g. PDL, PCL, PDF
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1237Print job management
    • G06F3/1253Configuration of print job parameters, e.g. using UI at the client
    • G06F3/1257Configuration of print job parameters, e.g. using UI at the client by using pre-stored settings, e.g. job templates, presets, print styles
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C11/00Arrangements, systems or apparatus for checking, e.g. the occurrence of a condition, not provided for elsewhere
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07GREGISTERING THE RECEIPT OF CASH, VALUABLES, OR TOKENS
    • G07G5/00Receipt-giving machines
    • GPHYSICS
    • G07CHECKING-DEVICES
    • G07CTIME OR ATTENDANCE REGISTERS; REGISTERING OR INDICATING THE WORKING OF MACHINES; GENERATING RANDOM NUMBERS; VOTING OR LOTTERY APPARATUS; ARRANGEMENTS, SYSTEMS OR APPARATUS FOR CHECKING NOT PROVIDED FOR ELSEWHERE
    • G07C11/00Arrangements, systems or apparatus for checking, e.g. the occurrence of a condition, not provided for elsewhere
    • G07C2011/04Arrangements, systems or apparatus for checking, e.g. the occurrence of a condition, not provided for elsewhere related to queuing systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • General Engineering & Computer Science (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention discloses a method for realizing ticket printing in a government affair hall and a storage medium, belonging to the technical field of data printing, aiming at solving the technical problems of avoiding the need of manual change to the field of the government affair hall when a template is updated each time, providing root number experience and convenience for users and operation and maintenance personnel and further improving the affair handling efficiency and the affair handling capacity of the government affair hall, and adopting the technical scheme that: the method comprises the following specific steps: a Freemarker template engine is used as a template at a server side, and an html text format is output; converting the html text format into the pdf text format on the service side based on a Java iText conversion tool; converting the pdf text format into a picture format file on the service side based on a Pdfbox conversion tool; and finishing the content display of the receipt by adopting different printing modes aiming at the pdf format file and the picture format file on each terminal platform of the client.

Description

Method for printing tickets in government affair hall and storage medium
Technical Field
The invention relates to the technical field of data printing, in particular to a method for realizing printing of tickets in a government affair hall and a storage medium.
Background
In the field of government affairs service, people handling affairs usually take numbers in a government affairs hall and queue the numbers, and the numbers taking chance provides a receipt carrying detailed information of the items handled, including basic information of the items handled, a window capable of handling affairs, the number of people waiting currently, the queue number and the like, so that the people can conveniently acquire the queuing waiting information. Therefore, the printed tickets have certain format requirements, at present, general investigation finds that a number taking machine in a government hall generally operates on a windows platform, the technical architecture is C # application constructed based on WinForm or Node application constructed based on open source electron, the mode for printing the tickets is html files as templates, and the html files are used for rendering and then printed by a lodop printing component, however, as the html files used as the templates are stored in a client, when the template layout is required to be changed and adjusted due to business change, the html files are troublesome, manual change of the template files on the number taking terminal is required to be carried out on site manually, and the method undoubtedly occupies a large amount of human resources, has low service efficiency and is not beneficial to long-term operation and maintenance.
Along with the gradual development of mobile internet, the government service capacity needs to be improved continuously, the government service level needs to be developed continuously, the fact that the number taking mode is required to be diversified and convenient on the government queuing number taking is reflected, the number taking process is humanized and intelligent, and the number taking result needs to be more accurate and mobile, so that a new display form is required for a printed receipt after number taking, namely, the paperless service displays the number taking receipt on a mobile terminal, the style content is consistent with that of a number taking machine, however, the output of a receipt template at the present stage does not have the capability of cross-terminal and cross-platform, and the data and the format cannot guarantee the multi-terminal unification.
The printing of queuing number-taking tickets in the government affair field has the following problems; the printing template is difficult to maintain, the maintenance labor cost is high, changeable demands cannot be quickly responded, tickets cannot be displayed across terminals, the content formats are not unified, the traditional printing mode is backward, the number taking tickets are complex in displayed content and the like, but the number taking tickets can be more new problems along with the continuous development of government affair service capacity, the use experience of the public affairs handling is influenced, and the promotion of the government affair handling capacity is hindered.
Disclosure of Invention
The technical task of the invention is to provide a method for realizing the printing of tickets in a government affairs hall and a storage medium, so as to solve the problem of how to avoid the need of manually changing the templates in the government affairs hall every time, provide root number experience and convenience for users and operation and maintenance personnel, and further improve the work handling efficiency and the work handling capacity of the government affairs hall.
The technical task of the invention is realized in the following way, and the method for realizing the printing of the tickets in the government affairs hall specifically comprises the following steps:
a Freemarker template engine is used as a template at a server side, and an html text format is output;
converting the html text format into the pdf text format on the service side based on a Java iText conversion tool;
converting the pdf text format into a picture format file on the service side based on a Pdfbox conversion tool;
and finishing the content display of the receipt by adopting different printing modes aiming at the pdf format file and the picture format file on each terminal platform of the client.
Preferably, the Freemarker template engine outputs the html file format by using a rend method, which is as follows:
assembling the dynamic rendering data into an entity class based on ftl the template file and the dynamic rendering data;
converting data with uploaded pictures in the dynamic rendering data into base64 text;
generating two-dimensional codes and bar codes by using tools and converting the two-dimensional codes and the bar codes into base64 texts;
the render method is invoked to convert the retrieved ftl text in the database to a standard html text format.
Preferably, the entity class includes a string, an object, an array, and a list.
Preferably, the Java iText conversion tool adopts an iText5 version, completes the parsing of a Freemarker template engine into an html text format based on an iText5 version, and then converts the HTML text format into a pdf format file, which specifically comprises the following steps:
the parsing of CSS advanced characteristics is completed by relying on Flying Sacker, and the pdf format file is based on a PostScript language image model to ensure accurate color and accurate printing effect, namely the pdf can faithfully reproduce each character, color and image of an original file and is used as an optimal carrier format for cross-terminal display;
setting the size of the template content by using an @ page and installing a Chinese font and CSS advanced feature component by a server;
the pdf format file can be displayed on various terminals, or the pdf format file is converted into a picture format file by adopting Pdfbox at the mobile terminal.
Preferably, the specific case of performing content display of the tickets on each terminal platform of the client by adopting different printing modes for the pdf format file and the picture format file is as follows:
firstly, a number taking terminal of a government affair hall uses lodop as a web printing component, and a pdf.js rendering tool is used for analyzing a pdf output file and calling the lodop into canvas to realize silent printing;
secondly, the mobile terminal obtains the pdf format file or the picture format file and directly displays the pdf format file or the picture format file.
Preferably, the number taking terminal comprises an Electron terminal and a WinFrom terminal; the printer on the number taking terminal is a thermal printer, and the sizes of the thermal paper with different models are different, and the thermal printer is specifically as follows:
setting the size of a printing receipt template, dragging or clicking provided component patterns to a template area according to requirements, wherein each component pattern has a configuration rule, modifying the configuration rule to complete the configuration of the template, and randomly changing the positions of components in the template through dragging the component domain of the configured template;
the standard codes corresponding to each component follow the grammar of Freemarker and the grammar of Html, a source code mode is provided for operation and maintenance personnel to change the specific display details of the component at any time, and after all editing is finished, the source codes corresponding to the components are combined into a text in ftl format and stored in a database;
besides the editing function, the function of real-time preview is provided, and the virtual data of all required data in the input component is used for generating a pdf format file or a picture format file, so that the effect of complete what you see is what you print is achieved in a background management system.
Preferably, the dynamic rendering data is rendered by a Java server side rendering mode, and a freemaker template engine is used to render a complete html file, which is as follows:
the backstage management system provides on-line editing of ftl format text to the Freemarker template engine, all data are persisted to the database;
the mode for reading the template provided by the Freemarker template engine comprises a directory loading module on a file system of a disk, a template loading module on a class path and a template loading mode starting from a web application directory
When the service uses a built-in class loader to read the template from the database, the self DataSourceTemplateLoader is realized by utilizing a freemarker.
Preferably, the working process of the number taking terminal is as follows:
(1) after the number taking is finished, the number taking terminal requests the server side to print a receipt request;
(2) the server side acquires ftl format files corresponding to the printing templates from a database or a cache, assembles required dynamic data, and renders the data and the templates into standard html format documents by using a Freemarker template engine;
(3) converting the html format document into a pdf format document by using iText, and transmitting the file stream of the pdf document to a number taking terminal;
(4) js processes a pdf file stream and then loads the pdf file stream into a hidden canvas, and an electron development used by a number taking terminal uses an ipcReader to call a lodop printing component to realize silent printing, so that the method can be realized by changing printing template file data stored by a server without arriving at the scene when the style of a receipt needs to be changed every time, and can be directly switched among matters without feeling without notifying each terminal when the template of the server is changed.
Preferably, the background management system for the printing template uses a receipt template online template editor, the online template editor has the functions of componentization, dragging, real-time preview and online editing, the operation logic is the combination of dragging operation and manual editing, the displayed content on the receipt is divided into different components according to formats, and various patterns of text fields, lists, two-dimensional codes, header headers, straight lines, point lines, line marks, simple tables, heightening pads, pictures and bar codes are arranged in the different components.
A computer readable storage medium having stored therein a computer program executable by a processor to implement a method for government hall ticket printing as described above.
The method for printing the tickets in the government affair hall and the storage medium have the following advantages that:
the invention provides a method for realizing the printing of number taking tickets handled by a government service hall in the field of government service, in particular to a method for realizing the sameness of the expressive ability of the tickets of various types of terminals, which optimizes the small ticket printing mode of the number taking machine of the government service hall, improves the efficiency of development and deployment by adopting server configuration and rendering and improves the cross-platform expressive ability of the ticket information;
the method comprises the steps that (1) configuration of a printing template and rendering based on dynamic data are achieved based on a freemarker template engine, html format text is converted into pdf format text by using Java iText, pdf is converted into picture format by using pdfbox, and different printing methods aiming at pdf and picture format on each terminal platform can have the same expression capability;
thirdly, the number taking terminal of the government affair service hall and the mobile terminal equipment of the people handling the affairs are various and have different use modes, after the number taking, in order to provide the same information feedback for the people handling the affairs, a number taking receipt is output to serve as evidence for subsequent affairs handling, the content and format of the receipt need to be concise and have the effectiveness of the affairs handling, so the receipt has the same display format and data, the assembly and rendering of the server side ensures that the display format is the same across the terminals, and the background management function of the template content is needed, thereby avoiding the frequent offline replacement, being capable of freely editing and adapting to the change of the demand, being capable of being customized rapidly and simply and conveniently using the operation and maintenance;
the invention is based on the Freemarker template engine as the template, the performance is high-efficient, the database management ftl template file number is convenient to maintain, the operation and the maintenance are convenient, the version iteration is rapid, the database manages all the maintained template data, and the maintenance of the management end to the template is realized; a server side is used for rendering a freemarker template into a pdf format file as receipt data, so that the same cross-terminal expression effect is realized;
the Freemarker template data can be manually maintained and edited in a background management system, and the display content is rendered and output in real time by adopting the virtual data, so that the Freemarker template data has the WYSIWYG (what you see is what you get) capability and can ensure the completely consistent printing effect display in the maintenance stage; meanwhile, freemarker is used as a template analysis engine, all ftl template files are managed by a database, visible-to-the-eye ticket printing template editing is realized by using an online template editor, ftl template files are rendered into html files, and iText class libraries are converted into pdf files which are used as carriers of tickets for transmission;
the method adopts a dynamic data rendering template to output the format of the Html text, and makes an Html to pdf file based on JavaiText, thereby ensuring the unification of multi-end output formats;
seventhly, the pdf format is converted into the picture format based on the pdfbox, so that multi-format transmission display is ensured;
(eighth) the government hall terminal uses lodop as a web printing component, and uses pdf.js to analyze a pdf output file to a canvas to call lodop to realize silent printing;
ninthly, the mobile terminal acquires the pdf format file or the picture format file for displaying to ensure that the tickets have the same effectiveness voucher;
(ten) the printing method of the receipt template data provided by the invention can realize flexible change of the receipt under the condition that the display style and the display content need to be changed, brings great convenience to users and operation and maintenance personnel, and avoids the condition that the template needs to be manually changed on site in a government hall every time the template is updated;
the online template editor ensures that the template format and the content are convenient to maintain, the personalized customization capability is excellent, and the real-time editing and previewing of ftl format file data are realized through the online template editor, so that the WYSIWYG (what you see is what you get) printing capability is realized;
the server side rendering avoids inconsistent display effects caused by diversified client side types, meanwhile, the server side rendering can give full play to the computing capability of the server, and the rendering effect is efficient and rapid;
and (thirteen) pdf file formats are used as transmission information, so that the same expression effect and expression capability of the multi-type terminals are realized.
Drawings
The invention is further described below with reference to the accompanying drawings.
FIG. 1 is a flow chart diagram of a method for realizing the printing of tickets in a government affairs hall.
Detailed Description
The method for realizing the printing of the tickets in the government affairs hall and the storage medium of the invention are explained in detail with reference to the drawings and the specific embodiment of the specification.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Example 1:
as shown in fig. 1, the method for printing tickets in a government hall comprises the following steps:
s1, making a template on the service end by a Freemarker template engine, and outputting an html text format;
s2, converting the html text format into the pdf text format on the service side based on a Java iText conversion tool;
s3, converting the pdf text format into a picture format file on the service end based on a Pdfbox conversion tool;
and S4, displaying the content of the receipt by adopting different printing modes aiming at the pdf format file and the picture format file on each terminal platform of the client.
In this embodiment, the Freemarker template engine outputs the html file format by using a rend method, which is as follows:
s101, assembling dynamic rendering data into an entity class based on ftl template files and the dynamic rendering data; the entity class of the entity comprises character strings, objects, arrays and lists;
s102, converting data with uploaded pictures in the dynamic rendering data into base64 text;
s103, converting the two-dimensional codes and the bar codes into base64 texts after generating the two-dimensional codes and the bar codes by using tools;
and S104, calling a render method to convert the extracted ftl text in the database into a standard html text format.
In this embodiment, the Java iText conversion tool adopts iText5 version, completes the parsing of the freemaker template engine into html text format based on iText5 version, and then converts into pdf format file, which is specifically as follows:
(1) the parsing of CSS advanced characteristics is completed by relying on Flying Sacule, and the pdf format file is based on a PostScript language image model to ensure accurate color and accurate printing effect, namely the pdf can faithfully reproduce each character, color and image of an original file and is used as a cross-end display optimal carrier format;
(2) setting the size of the template content by the @ page by installing a Chinese font and CSS advanced feature component by the server;
(3) the pdf format file can be displayed on various terminals, or the pdf format file is converted into a picture format file by adopting Pdfbox at the mobile terminal.
In this embodiment, the specific case of completing content display of the tickets by adopting different printing modes for the pdf format file and the picture format file on each terminal platform of the client is as follows:
firstly, a number taking terminal of a government affair hall uses lodop as a web printing component, and a pdf.js rendering tool is used for analyzing a pdf output file and calling the lodop into canvas to realize silent printing;
secondly, the mobile terminal obtains the pdf format file or the picture format file and directly displays the pdf format file or the picture format file.
The number taking terminal in the embodiment comprises an Electron terminal and a WinFrom terminal; the printer on the number taking terminal is a thermal printer, and the sizes of the thermal paper with different models are different, and the thermal printer is specifically as follows:
(1) setting the size of a printing receipt template, dragging or clicking provided component patterns to a template area according to requirements, wherein each component pattern has a configuration rule, modifying the configuration rule to complete the configuration of the template, and randomly changing the positions of components in the template through dragging the component domain of the configured template;
(2) the standard codes corresponding to each component follow the grammar of Freemarker and the grammar of Html, a source code mode is provided for operation and maintenance personnel to change the specific display details of the components at any time, and after all editing is finished, the source codes corresponding to the components are combined into a text in ftl format and stored in a database;
(3) and besides the editing function, the function of providing real-time preview is realized, and the virtual data of all required data in the component is input to generate a pdf format file or a picture format file, so that the effect of printing in a background management system is achieved.
The template rendering for printing the receipt has multiple implementations, and two implementations are available for achieving the cross-terminal capability, one is client-side rendering, each type of terminal acquires transmitted data, and the defined data format has strict requirements due to the fact that the cross-terminal is guaranteed, and the client-side rendering has general universality, each terminal performs analysis rendering respectively depending on the analysis mode and capability of the platform, and the implementation manner adopting the rendering is basically similar to a cloud form system which processes data into the same content depending on sdk of each terminal, but the defects are that the function iteration speed is slow due to the fact that sdk of each terminal needs to be developed and maintained independently, the representation effect of each terminal still has certain difference due to the general universality of the data format, and the data format maintenance is complex, and the rendering capability and the representation result are not consistent in the operation and maintenance stage. The other mode is server side rendering, the difference of the types of all terminals is abandoned, rendering tasks are handed to a server side with better performance, data transmitted to a client side are in a pdf file format or a picture file format with a completely fixed format, the same performance result of all terminals is guaranteed, templates of tickets are still managed by adopting server side rendering, html files are still good template carriers, and the assembled dynamic data and html can be combined to obtain preferential performance. Based on the above analysis, the method of the present patent selects a way of using server rendering.
Generally, JavaScript and html are used in combination, and have excellent performance, and are particularly used as a carrier of a receipt template, but when there is no JavaScript running environment such as a browser, dynamic rendering data in this embodiment is rendered in a Java server rendering manner, and a freemaker template engine is used to render a complete html file, which is as follows:
(1) the backstage management system provides on-line editing of ftl format text of a Freemarker template engine, and all data are persisted into a database;
(2) the mode for reading the template provided by the Freemarker template engine comprises a directory loading module on a file system of a disk, a template loading module on a class path and a template loading mode starting from a web application directory
(3) When the service uses a built-in class loader to read the template from the database, the self DataSourceTemplateLoader is realized by utilizing a freemarker.
The number taker terminal operates in a windows environment, the cross-platform development is generally realized by using an electron technology at present, the display of high-grade characteristics can be realized based on JavaScript and c #, and the silent printing of the number-taking receipt of the terminal is realized by the mutual cooperation of pdf. Specifically, the working process of the number taking terminal in this embodiment is as follows:
(1) after the number taking is finished, the number taking terminal requests the server side to print a receipt request;
(2) the server side acquires ftl format files corresponding to the printing templates from a database or a cache, assembles required dynamic data, and renders the data and the templates into standard html format documents by using a Freemarker template engine;
(3) converting the html format document into a pdf format document by using iText, and transmitting the file stream of the pdf document to a number taking terminal;
(4) js processes a pdf file stream and then loads the pdf file stream into a hidden canvas, and an electron development used by a number taking terminal uses an ipcReader to call a lodop printing component to realize silent printing, so that the method can be realized by changing printing template file data stored by a server without arriving at the scene when the style of a receipt needs to be changed every time, and can be directly switched among matters without feeling without notifying each terminal when the template of the server is changed.
The iText is a famous open source java class library, and not only a pdf or rtf document can be generated through the iText, but also xml and html files can be converted into pdf files.
The background management system for the printing template in the embodiment uses a receipt template online template editor, the online template editor has the functions of componentization, dragging, real-time preview and online editing, the operation logic is the combination of dragging operation and manual editing, the displayed content on the receipt is divided into different components according to formats, and various patterns of a text field, a list, a two-dimensional code, a header, a straight line, a dotted line, a # line, a simple table, a heightening pad, a picture and a bar code are arranged in the different components.
The invention uses the number taker terminal of the government affairs service hall to print the receipt to make the system case: the method comprises the steps that a number-taking program is queued in the government affair service field developed based on a mode with separated front and back ends, a background management end, a number-taking terminal and various number-taking terminals are operated independently, a background management system is provided with a printing receipt management module, the module is provided with an online template editor, a plurality of component types are provided, the components are arranged in a receipt area in a dragging mode, each component has independent attribute configuration, the editor also provides a source code mode for fine-tuning specific display details of a template, and the template is persistently stored in a database or high-speed caches such as Redis, Memcache and the like after the template is edited.
The method comprises the steps that a ticket printing request is sent to a server after a number taking link of a number taking terminal is finished, the server assembles dynamic data, obtains an ftl template in a database, calls a template engine to render a complete html format file, converts the html format file into a pdf format file stream by using a java iText class library and transmits the pdf format file stream to the number taking machine terminal, the number taking machine terminal analyzes a file stream by using pdf.js and removes a lodop printing component to realize silent printing of a ticket template, the speed of the whole flow link is high, a number taking crowd can wait for number calling handling business after taking a number taking ticket, two-dimensional codes or bar codes are arranged on the ticket, and the complete information of the number taking handling business can be obtained by using micro-signal scanning.
In addition, after the mobile terminal takes the number, the same processing flow is adopted to request the server terminal to acquire the pdf file or the picture file of the printing receipt for displaying, so that the mobile terminal and the number taking machine terminal have the same credential effectiveness and expression capability.
Example 2:
the embodiment of the invention also provides a computer-readable storage medium, wherein a plurality of instructions are stored, and the instructions are loaded by the processor, so that the processor executes the method for realizing the printing of the tickets in the government affairs hall in any embodiment of the invention. Specifically, a system or an apparatus equipped with a storage medium on which software program codes that realize the functions of any of the above-described embodiments are stored may be provided, and a computer (or a CPU or MPU) of the system or the apparatus is caused to read out and execute the program codes stored in the storage medium.
In this case, the program code itself read from the storage medium can realize the functions of any of the above-described embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
Examples of the storage medium for supplying the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (e.g., CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RYM, DVD-RW, DVD + RW), a magnetic tape, a nonvolatile memory card, and a ROM. Alternatively, the program code may be downloaded from a server computer via a communications network.
Further, it should be clear that the functions of any one of the above-described embodiments may be implemented not only by executing the program code read out by the computer, but also by causing an operating system or the like operating on the computer to perform a part or all of the actual operations based on instructions of the program code.
Further, it is to be understood that the program code read out from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion unit connected to the computer, and then causes a CPU or the like mounted on the expansion board or the expansion unit to perform part or all of the actual operations based on instructions of the program code, thereby realizing the functions of any of the above-described embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for printing tickets in a government affair hall is characterized by comprising the following steps:
a Freemarker template engine is used as a template at a server side, and an html text format is output;
converting the html text format into the pdf text format on the service side based on a Java iText conversion tool;
converting the pdf text format into a picture format file on the service side based on a Pdfbox conversion tool;
and finishing the content display of the receipt by adopting different printing modes aiming at the pdf format file and the picture format file on each terminal platform of the client.
2. The method for realizing the printing of the tickets in the government hall according to claim 1, wherein the Freemarker template engine outputs the html file format by a rend method, which is as follows:
assembling the dynamic rendering data into an entity class based on ftl the template file and the dynamic rendering data;
converting data with uploaded pictures in the dynamic rendering data into base64 text;
generating two-dimensional codes and bar codes by using tools and converting the two-dimensional codes and the bar codes into base64 texts;
the render method is invoked to convert the retrieved ftl text in the database to a standard html text format.
3. The government hall ticket printing implementation method of claim 2 wherein the entity class of entitycomprises a string, an object, an array and a list.
4. The method for realizing the printing of the tickets in the government hall according to claim 1, wherein the Java iText conversion tool adopts iText5 version, completes the parsing of a Freemarker template engine into html text format based on iText5 version and then converts the text format into pdf format file, which is as follows:
the parsing of CSS advanced characteristics is completed by relying on Flying Sacker, and the pdf format file is based on a PostScript language image model to ensure accurate color and accurate printing effect, namely the pdf can faithfully reproduce each character, color and image of an original file and is used as an optimal carrier format for cross-terminal display;
setting the size of the template content by using an @ page and installing a Chinese font and CSS advanced feature component by a server;
the pdf format file can be displayed on various terminals, or the pdf format file is converted into a picture format file by adopting Pdfbox at the mobile terminal.
5. The method for realizing the printing of the tickets in the government hall according to claim 1, wherein the content display of the tickets on each terminal platform of the client is finished by adopting different printing modes aiming at the pdf format file and the picture format file as follows:
firstly, a number taking terminal of a government affair hall uses lodop as a web printing component, and a pdf.js rendering tool is used for analyzing a pdf output file and calling the lodop into canvas to realize silent printing;
secondly, the mobile terminal obtains the pdf format file or the picture format file and directly displays the pdf format file or the picture format file.
6. The method for realizing the printing of the tickets in the government affairs hall according to claim 4, wherein the number taking terminals comprise an Electron terminal and a WinFrom terminal; the printer on the number taking terminal is a thermal printer, and the sizes of the thermal paper with different models are different, and the thermal printer is specifically as follows:
setting the size of a printing receipt template, dragging or clicking provided component patterns to a template area according to requirements, wherein each component pattern has a configuration rule, modifying the configuration rule to complete the configuration of the template, and randomly changing the positions of components in the template through dragging the component domain of the configured template;
the standard codes corresponding to each component follow the grammar of Freemarker and the grammar of Html, a source code mode is provided for operation and maintenance personnel to change the specific display details of the component at any time, and after all editing is finished, the source codes corresponding to the components are combined into a text in ftl format and stored in a database;
the method provides a real-time preview function, inputs virtual data of all required data in a component to generate a pdf format file or a picture format file, and achieves the effect of printing in a background management system.
7. The method for realizing the printing of the tickets in the government hall according to claim 2, wherein the dynamic rendering data adopts a Java server side rendering mode, and a Freemarker template engine is used for rendering a complete html file, which is as follows:
the backstage management system provides on-line editing of ftl format text to the Freemarker template engine, all data are persisted to the database;
the mode for reading the template provided by the Freemarker template engine comprises a directory loading module on a file system of a disk, a template loading module on a class path and a template loading mode starting from a web application directory
When the service uses a built-in class loader to read the template from the database, the self DataSourceTemplateLoader is realized by utilizing a freemarker, cac he and TemolateLoader interface, different template files are read according to different service scenes, the rendering process of the template files is called again, and dynamic data based on the order is rendered into a complete version of html format text.
8. The method for realizing the printing of the tickets in the government affairs hall according to claim 5, wherein the number taking terminal specifically works as follows:
(1) after the number taking is finished, the number taking terminal requests the server side to print a receipt request;
(2) the server side acquires ftl format files corresponding to the printing templates from a database or a cache, assembles required dynamic data, and renders the data and the templates into standard html format documents by using a Freemarker template engine;
(3) converting the html format document into a pdf format document by using iText, and transmitting the file stream of the pdf document to a number taking terminal;
(4) js processes the pdf file stream and then loads the pdf file stream into a hidden canvas, and an electron development used by the number taking terminal uses an ipcReader to call a lodop printing component to realize silent printing, and the silent printing is realized by changing printing template file data stored by a server.
9. The method for realizing the printing of the tickets in the government affairs hall according to the claim 8, wherein the background management system of the printing templates uses an online template editor of the tickets, the online template editor has the functions of componentization, dragging, real-time preview and online editing, the operation logic is the combination of dragging operation and manual editing, the displayed contents on the tickets are divided into different components according to formats, and various patterns of text fields, lists, two-dimensional codes, header marks, straight lines, dotted lines, simple tables, heightening pads, pictures and bar codes are arranged in the components.
10. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, the computer program being executable by a processor to implement the government hall receipt printing implementation method as claimed in any one of claims 1 to 9.
CN202110746352.1A 2021-07-01 2021-07-01 Method for printing tickets in government affair hall and storage medium Pending CN113608706A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110746352.1A CN113608706A (en) 2021-07-01 2021-07-01 Method for printing tickets in government affair hall and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110746352.1A CN113608706A (en) 2021-07-01 2021-07-01 Method for printing tickets in government affair hall and storage medium

Publications (1)

Publication Number Publication Date
CN113608706A true CN113608706A (en) 2021-11-05

Family

ID=78337140

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110746352.1A Pending CN113608706A (en) 2021-07-01 2021-07-01 Method for printing tickets in government affair hall and storage medium

Country Status (1)

Country Link
CN (1) CN113608706A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114527946A (en) * 2022-01-12 2022-05-24 杭州石原子科技有限公司 Silent print client based on browser
CN117539883A (en) * 2024-01-04 2024-02-09 腾讯科技(深圳)有限公司 Application template updating method, device, storage medium and equipment

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080266403A1 (en) * 2007-04-27 2008-10-30 Shih-Ming Hsu Universal printing method and universal printer driver module for printing out non-image file documents, and electronic device having the driver module
CN106021464A (en) * 2016-05-17 2016-10-12 北京米学科技有限公司 Universal multi-terminal editing and printing method for multimedia document
US20180336195A1 (en) * 2017-05-19 2018-11-22 Xerox Corporation Methods and systems to customize printable information
CN110333856A (en) * 2019-07-08 2019-10-15 政采云有限公司 Serviceization can layout online template generating system and method
CN110363016A (en) * 2019-07-15 2019-10-22 宜春宜联打印设备有限公司 A kind of printing encryption method and device, Method of printing and printing device
CN110851092A (en) * 2019-11-15 2020-02-28 厦门商集网络科技有限责任公司 Customized printing method and system based on printing template under B/S framework
CN110908621A (en) * 2019-11-22 2020-03-24 深圳市印点点科技有限公司 Cloud platform printing method, cloud server and cloud printing system
CN111045615A (en) * 2019-12-19 2020-04-21 厦门商集网络科技有限责任公司 Method and system for printing JS template customized at browser end

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080266403A1 (en) * 2007-04-27 2008-10-30 Shih-Ming Hsu Universal printing method and universal printer driver module for printing out non-image file documents, and electronic device having the driver module
CN106021464A (en) * 2016-05-17 2016-10-12 北京米学科技有限公司 Universal multi-terminal editing and printing method for multimedia document
US20180336195A1 (en) * 2017-05-19 2018-11-22 Xerox Corporation Methods and systems to customize printable information
CN110333856A (en) * 2019-07-08 2019-10-15 政采云有限公司 Serviceization can layout online template generating system and method
CN110363016A (en) * 2019-07-15 2019-10-22 宜春宜联打印设备有限公司 A kind of printing encryption method and device, Method of printing and printing device
CN110851092A (en) * 2019-11-15 2020-02-28 厦门商集网络科技有限责任公司 Customized printing method and system based on printing template under B/S framework
CN110908621A (en) * 2019-11-22 2020-03-24 深圳市印点点科技有限公司 Cloud platform printing method, cloud server and cloud printing system
CN111045615A (en) * 2019-12-19 2020-04-21 厦门商集网络科技有限责任公司 Method and system for printing JS template customized at browser end

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114527946A (en) * 2022-01-12 2022-05-24 杭州石原子科技有限公司 Silent print client based on browser
CN117539883A (en) * 2024-01-04 2024-02-09 腾讯科技(深圳)有限公司 Application template updating method, device, storage medium and equipment
CN117539883B (en) * 2024-01-04 2024-04-12 腾讯科技(深圳)有限公司 Application template updating method, device, storage medium and equipment

Similar Documents

Publication Publication Date Title
CN109408783B (en) Electronic document online editing method and system
CN101183355B (en) Copy and paste processing method, apparatus
CN109933752A (en) A kind of method and apparatus exporting electronic document
CN112100550A (en) Page construction method and device
CN102637264A (en) System and method for name card generating and online printing based on network
CN113608706A (en) Method for printing tickets in government affair hall and storage medium
GB2423387A (en) Application-Generic Sequence Diagram Generator Driven by a Non-Proprietary Language
CN101136978A (en) Printer control device
US20090037801A1 (en) Method and apparatus for automatic user manual generation
US11281849B2 (en) System and method for printable document viewer optimization
CN110244921A (en) Label printing method, device, electronic equipment and system
CN111953709A (en) Multimedia content transmission method, multimedia content display device and electronic equipment
CN115510347A (en) Presentation file conversion method and device, electronic equipment and storage medium
CN113495730A (en) Resource package generation and analysis method and device
CN114415986A (en) Document template customizing and printing method, device and computer readable medium
CN112954030A (en) Web side picture compression method and device and electronic equipment
CN112596688A (en) Web end custom printing method based on TinyMCE rich text
CN107015959A (en) A kind of method that version is closed to pdf document
JP2008310816A (en) System and method for compact representation of multiple markup page data
CN116956845A (en) Method for rapidly configuring form field, page field generation mode and system
WO2001084299A1 (en) Customizing forms based upon parameters in a template
CN111144071B (en) Cross-platform MathType formula conversion method and device
CN112926294A (en) Template file generation method and device
KR20050108677A (en) Method for creating and managing flash automatically and recording medium
CN113377453A (en) Picture processing method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination