Print template-based document output method and device, computer device and medium

By using a browser-based vector graphics printing template design platform and data rendering engine, the problem of HTML DOM document templates being unable to be flexibly adjusted is solved, achieving consistency between printing effects and design state, as well as efficient rendering, making it suitable for various business scenarios.

CN115357201BActive Publication Date: 2026-04-17WINNING HEALTH TECHNOLOGY GROUP CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WINNING HEALTH TECHNOLOGY GROUP CO LTD
Filing Date
2022-08-22
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

In existing technologies, HTML DOM document templates cannot be flexibly adjusted, resulting in a discrepancy between the printed output and the design state. Furthermore, reliance on third-party plugins leads to the loss of design details during the conversion process, excessive server load, and low efficiency.

Method used

It adopts a browser-based vector graphics printing template design platform, which uses a data rendering engine to perform data rendering on the browser side to generate vector graphics documents that can be printed directly without PDF conversion. The combination of the template design platform and the data rendering engine enables flexible adjustment and efficient rendering.

Benefits of technology

It ensures that the printed results are consistent with the design state, reduces the burden on the server, improves printing efficiency and system performance, and is suitable for a variety of business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115357201B_ABST
    Figure CN115357201B_ABST
Patent Text Reader

Abstract

The application provides a printing template-based document output method and device, computer equipment and medium, and relates to the technical field of computers. The method comprises the following steps: obtaining a printing template document from a template document database according to a printing request for preset business data, wherein the printing request comprises a template identifier, the template document database comprises at least one candidate printing template document generated in advance, and the candidate printing template document is a vector template document; matching the business data and the printing template document according to the format of the preset business data and the format of the printing template document, binding corresponding business data to each node object in the printing template document, and obtaining a to-be-printed document object model with bound business data; and rendering the to-be-printed document object model to obtain a preliminary output vector graphics document. The application can flexibly adjust the printing template according to the business data, and the vector graphics document can be directly printed, thereby ensuring that the printing effect is consistent with the design state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and more specifically, to a document output method, apparatus, computer device, and medium based on a printed template. Background Technology

[0002] In many industry business scenarios, it is necessary to print various business data generated by the business system. Filling the business data into a preset template can realize the automated printing process.

[0003] In existing technologies, HTML DOM document templates are usually designed using Canvas or Div elements. However, these document templates are usually not scalable and cannot be flexibly adjusted according to business data during printing. Furthermore, converting HTML DOM document templates to PDF documents requires the use of third-party plugins, which may cause some design details in the document template to be overlooked, resulting in the final printed effect not matching the design state. Summary of the Invention

[0004] The purpose of this invention is to address the shortcomings of the prior art by providing a document output method, apparatus, computer equipment, and medium based on a print template, so that the print template can be flexibly adjusted according to business data during printing, and vector graphic documents can be printed directly, ensuring that the printing effect matches the design state.

[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:

[0006] In a first aspect, embodiments of this application provide a document output method based on a print template, the method comprising:

[0007] Based on the print request for the preset business data input, the corresponding print template document is obtained from the template document database. The print request includes a template identifier. The template document database includes at least one pre-generated candidate print template document, and all candidate print template documents are vector template documents.

[0008] Based on the format of the preset business data and the format of the print template document, the business data and the print template document are matched, and the corresponding business data is bound to each node object in the print template document to obtain a printable document object model with bound business data.

[0009] The document object model to be printed is rendered to obtain the vector graphics document to be output.

[0010] Optionally, before retrieving the corresponding print template document from the template document database based on the print request input for preset business data, the method further includes:

[0011] Based on user-created instructions, an empty object template is created in the print template design platform;

[0012] In response to at least one control selected on the print template design platform, at least one node object corresponding to the at least one control is generated in the empty object template, and attribute information and behavior information customized for the node object are obtained to obtain at least one node object after setting, wherein the object is a vector graphic object;

[0013] Based on at least one node object after the settings, the candidate print template document is generated.

[0014] Optionally, after generating the candidate print template document based on at least one node object after the settings, the method further includes:

[0015] The serialization storage recursive algorithm of the candidate print template document is invoked to determine whether each attribute name in the candidate print template document is registered in the object factory;

[0016] If already registered, the attribute information of the node object corresponding to the attribute name will be serialized and saved in a preset language format to obtain a serialized printable template document.

[0017] Optionally, the step of retrieving the corresponding print template document from the template document database based on the print request input for preset business data includes:

[0018] Based on the print request for the preset business data input, obtain the serialized print template document;

[0019] The deserialization recursive algorithm of the serialized print template document is invoked to determine whether each attribute name in the serialized print template document is registered in the object factory;

[0020] If the attribute name is registered in the object factory, the corresponding conversion method is called to convert the attribute name into a node object corresponding to the attribute name based on the attribute information of the preset language format. The print template document includes multiple converted node objects.

[0021] Optionally, the method further includes:

[0022] If not registered, the attribute information of the node object corresponding to the attribute name is saved as a string to obtain the serialized candidate print template document.

[0023] Optionally, the step of retrieving the corresponding print template document from the template document database based on the print request input for preset business data further includes:

[0024] If the attribute name is not registered in the object factory, the string corresponding to the attribute name is assigned to the parent node object of the node object corresponding to the attribute name.

[0025] Optionally, matching the business data and the print template document according to the format of the preset business data and the format of the print template document includes:

[0026] Bind the node objects in the current level of the print template document to the data in the same level of the business data;

[0027] If the node object in the current level contains child objects, bind the child objects to the data of the corresponding level in the business data.

[0028] Optionally, rendering the document object model to be printed to obtain the vector graphics document to be output includes:

[0029] The document object model to be printed is divided into at least one unit, and the unit includes at least one of the following: template document header, template document body and template document footer;

[0030] Render multiple node objects in each of the aforementioned units to obtain a vector graphics document for output.

[0031] Optionally, rendering multiple node objects in each of the units includes:

[0032] Execute the pre-rendering event scripts from the corresponding behavior information for the multiple node objects;

[0033] Perform data rendering on the multiple node objects;

[0034] Execute the post-rendering event scripts in the corresponding behavior information on the multiple node objects to obtain the vector graphics document to be output.

[0035] Optionally, if the node object is a table object, the data rendering of the plurality of node objects includes:

[0036] If the table contains row panels, then the business data corresponding to the row panels in the table object is rendered horizontally, and multiple rows of business data are rendered in the table object.

[0037] If the table object contains column panels, then the business data corresponding to the column panels in the table object is rendered vertically, resulting in multiple columns of business data in the table object.

[0038] Secondly, embodiments of this application also provide a document output device based on a print template, the device comprising:

[0039] The template acquisition module is used to retrieve the corresponding print template document from the template document database based on the print request input for preset business data. The print request includes a template identifier, and the template document database includes at least one pre-generated candidate print template document, all of which are vector template documents.

[0040] The data matching module is used to match the business data and the print template document according to the format of the preset business data and the format of the print template document, bind the corresponding business data to each node object in the print template document, and obtain the printable document object model with bound business data.

[0041] The document rendering module is used to render the document object model to be printed to obtain a vector graphics document to be output.

[0042] Optionally, before the template acquisition module acquires the print template document, the device further includes:

[0043] The template creation module is used to create empty object templates in the print template design platform based on user creation instructions.

[0044] An object generation module is used to generate at least one node object corresponding to the at least one control in the empty object template in response to at least one control selected in the print template design platform, and to obtain attribute information and behavior information customized for the node object to obtain at least one node object after setting, wherein the object is a vector graphic object;

[0045] The template generation module is used to generate the candidate print template document based on at least one node object after the settings.

[0046] Optionally, after the template generation module generates the candidate print template document, the apparatus further includes:

[0047] The attribute name judgment module is used to call the serialization storage recursive algorithm of the candidate print template document to determine whether each attribute name in the candidate print template document is registered in the object factory;

[0048] The node object saving module is used to serialize and save the attribute information of the node object corresponding to the attribute name into a preset language format if it has been registered, so as to obtain a serialized candidate print template document.

[0049] Optionally, the template acquisition module includes:

[0050] The template acquisition unit is used to acquire a serialized print template document based on the print request input for preset business data.

[0051] The attribute name judgment unit is used to call the deserialization recursive algorithm of the serialized print template document to determine whether each attribute name in the serialized print template document is registered in the object factory;

[0052] The node object conversion unit is used to call the corresponding conversion method if the attribute name has been registered in the object factory, and convert the attribute name to the node object corresponding to the attribute name according to the attribute information of the preset language format. The print template document includes: multiple converted node objects.

[0053] Optionally, the node object saving module is further configured to save the attribute information of the node object corresponding to the attribute name as a string if it is not registered, thereby obtaining the serialized candidate print template document.

[0054] Optionally, the node object conversion unit is further configured to assign the string corresponding to the attribute name to the parent node object of the node object corresponding to the attribute name if the attribute name is not registered in the object factory.

[0055] Optionally, the data matching module includes:

[0056] The current-level data matching unit is used to bind node objects in the current level of the print template document to data of the same level in the business data;

[0057] The child data matching unit is used to bind the child object and the corresponding level of data in the business data if the node object in the current level contains a child object.

[0058] Optionally, the document rendering module includes:

[0059] A document splitting unit is used to divide the document object model to be printed into at least one unit, the unit including at least one of the following: template document header, template document body and template document footer;

[0060] The document rendering unit is used to render multiple node objects in each of the units to obtain a vector graphics document to be output.

[0061] Optionally, the document rendering unit includes:

[0062] The pre-rendering event script subunit is used to execute the pre-rendering event script in the corresponding behavior information on the multiple node objects.

[0063] The document rendering subunit is used to render data on the multiple node objects;

[0064] The post-rendering event script subunit is used to execute the post-rendering event script in the corresponding behavior information on the multiple node objects to obtain the vector graphics document to be output.

[0065] Optionally, if the node object is a table object, the document rendering subunit includes:

[0066] The row panel rendering subunit is used to render the business data corresponding to the row panel in the table object horizontally if the table contains row panels, and to render multiple rows of business data in the table object.

[0067] The column panel rendering subunit is used to render the business data corresponding to the column panel in the table object vertically if the table object contains a column panel, thereby rendering multiple columns of business data in the table object.

[0068] Thirdly, embodiments of this application also provide a computer device, including: a processor, a storage medium, and a bus, wherein the storage medium stores program instructions executable by the processor, and when the computer device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the document output method based on a print template as described in any of the first aspects.

[0069] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the document output method based on a print template as described in any of the first aspects.

[0070] The beneficial effects of this application are:

[0071] This application provides a document output method, apparatus, computer device, and medium based on print templates. According to a print request inputting preset business data, a corresponding print template document is retrieved from a template document database. The print request includes a template identifier. The template document database includes at least one pre-generated candidate print template document, all of which are vector template documents. The business data and print template documents are matched according to their formats. Each node object in the print template document is bound to corresponding business data, resulting in a printable document object model with bound business data. The printable document object model is then rendered to obtain a vector graphic document ready for output. The pre-designed vector template document can be flexibly adjusted to generate a vector graphic document based on business data, ensuring compatibility with business data from more business scenarios. Furthermore, by directly printing the vector graphic document, the printing effect is guaranteed to match the design state, improving printing quality. Attached Figure Description

[0072] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0073] Figure 1 A schematic diagram of the structure of a document printing system provided in an embodiment of this application;

[0074] Figure 2 A schematic diagram of a document printing system provided in this application embodiment;

[0075] Figure 3 A flowchart illustrating a document output method based on a print template, provided for an embodiment of this application;

[0076] Figure 4 A flowchart illustrating a browser-based print template document generation process provided for an embodiment of this application;

[0077] Figure 5 A flowchart illustrating another browser-based print template document generation process provided for an embodiment of this application;

[0078] Figure 6 A flowchart illustrating another document output method based on a print template provided in this application embodiment;

[0079] Figure 7A flowchart illustrating yet another document output method based on a print template provided in this application embodiment;

[0080] Figure 8 A flowchart illustrating another document output method based on a print template provided in this application embodiment;

[0081] Figure 9 A flowchart illustrating yet another document output method based on a print template provided in this application embodiment;

[0082] Figure 10 A schematic diagram of a rendering process provided in an embodiment of this application;

[0083] Figure 11 A schematic diagram of a document output device based on a printing template provided in an embodiment of this application;

[0084] Figure 12 A schematic diagram of a computer device provided in an embodiment of this application. Detailed Implementation

[0085] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of the present invention, but not all embodiments.

[0086] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0087] Furthermore, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Additionally, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0088] It should be noted that, where there is no conflict, the features in the embodiments of this application can be combined with each other.

[0089] To better understand this application, before discussing the document output method, apparatus, computer equipment, and media based on print templates involved in this application, the prior art involved in this application will be explained in detail.

[0090] In some existing document output methods based on print templates, the print template design platform is usually implemented through HTML (HyperText Markup Language) or Canvas technology on the browser side. After the print template is designed on the browser side using the Div or Canvas element of the print template design platform, the business data is transmitted to the JavaScript processing logic and then a network I / O request is sent to the server. The server renders the print template data and converts it into a PDF (Portable Document Format) document. The server then sends the converted PDF document to the front-end business system, which can preview the PDF document or send it to the printer for printing.

[0091] While this technology can automate the printing process, it also presents several significant challenges: Firstly, HTML DOM (Document Object Model) print templates designed using Div or Canvas elements cannot be resized locally during printing and suffer from distortion. Secondly, server-side rendering of data and obtaining the PDF document relies on third-party plugins, which lack effective control during the conversion process and may result in nodes or elements in the HTML DOM print template being unrecognized or unconverted, leading to discrepancies between the final print result and the design. Thirdly, after designing the print template on the browser side, the server needs to convert the PDF document before sending it to the browser for preview or printing. When server workloads are concentrated and print templates are complex, this can cause excessive server load and low performance, resulting in inefficient use of server computing resources.

[0092] Other existing document output methods based on print templates employ print template design platforms based on SVG (Scalable Vector Graphics) document templates. These design platforms require separate deployment and installation, and may even require the installation of associated software or a Java Virtual Machine (JVM). When outputting documents based on print templates, the web application on the browser side sends a request to the server. The server completes the data request and template rendering, and then returns the rendered document to the browser side via network I / O for model conversion to obtain an SVG document for display. While the printing templates designed through this platform can resolve issues such as potential distortion and inflexibility in both design and runtime states, as well as dependencies on third-party plugins, the C / S (client / server) architecture makes the entire process inconvenient and inefficient. Server-side data requests and template rendering are intertwined, resulting in unclear responsibilities, chaotic logic, and significant GPU and CPU consumption for server-side template rendering. This places extremely high demands on server capabilities when dealing with complex templates or concentrated tasks, while conversely, a large amount of computing resources remain idle during off-peak hours, leading to wasted computing power. Furthermore, business integration presents challenges, including high integration difficulty, significant network I / O requirements, and numerous unnecessary document conversions.

[0093] It should be noted that the document output method, apparatus, computer equipment and medium based on printing templates provided by this invention are mainly applied in the medical industry, but can also be extended to the entire industry according to business needs.

[0094] Please refer to Figure 1 The image below is a schematic diagram of the structure of a document printing system provided in an embodiment of this application. Please refer to the provided diagram. Figure 2 This is a schematic diagram of a document printing system provided in an embodiment of this application, such as... Figure 1 and Figure 2 As shown, the document printing system includes: a print template design platform 11, an application server 12, a data rendering engine 13, and a business system 14.

[0095] Among them, the print template design platform 11, the data rendering engine 13 and the business system 14 are located in the user layer, and the application server 12 is located in the resource layer. The server used to store and provide print template documents in the resource layer can be Windows Servers, Linux Servers, Databases, or Physical PCs. Between the user layer and the resource layer, there is also an access layer, which is used to provide network I / O, namely the gateway and firewall.

[0096] The document printing system in this embodiment is mainly characterized by a B / S (Browser / Server) architecture. The printing template design platform 11 is a visual vector graphics printing template design platform implemented in JavaScript based on a browser. The printing template design platform is in design mode. By creating an empty template on the printing template design platform 11, designers can design a printing template that matches the structure of the business data in the canvas of the empty template according to the actual business needs and the structure of the business data. After that, the printing template is saved to the application server 12 through network I / O, firewall, gateway, etc. The server-side printing template service deployed on the application server 12 will serialize and persist the printing template sent by the browser to various types of databases for storage.

[0097] Business system 14 is a browser-based business application. Data rendering engine 13 is installed as a dependency in business system 14. Business system 14 sends a print request for business data that needs to be printed, thereby calling data rendering engine 13. Data rendering engine 13 is in runtime and is a JavaScript API, an API plugin designed based on the JavaScript language that can be executed on the browser side. By calling the PangoPrint.previewByCode method exposed by data rendering engine 13, template identifier and business data are input into data rendering engine 13. Data rendering engine 13 obtains the print template from application server 12 through network I / O interface according to the template identifier in the print request. After parsing the print template, data rendering engine 13 binds the business data to the print template and then performs loop rendering of the print template. The rendered print template is converted into a vector graphic document and sent to business system 14. Business system 14 previews the vector graphic document for printing and then sends the vector graphic document to the printer for printing.

[0098] Based on the aforementioned document printing system, a vector graphics printing template is designed by a printing template design platform. This allows the printing template to be flexibly adjusted according to business data. Furthermore, the data rendering engine renders the printing template data, resulting in a vector graphics document that can be directly printed by the printer without converting the document to PDF format. This avoids the loss of design details during the conversion process, ensuring complete consistency between the design state and the printed result. In addition, the data rendering engine on the browser side renders the printing template data, avoiding the business pressure of data rendering on the server side and improving printing efficiency.

[0099] Based on the above document printing system, this application provides a document output method based on a printing template. Please refer to [link / reference]. Figure 3 This is a flowchart illustrating a document output method based on a print template provided in an embodiment of this application. Figure 3 As shown, the method includes:

[0100] S20: Based on the print request for the preset business data input, retrieve the corresponding print template document from the template document database. The print request includes a template identifier. The template document database includes at least one pre-generated candidate print template document, and all candidate print template documents are vector template documents.

[0101] In this embodiment, the business system can be various browser-based web systems. A data rendering engine is integrated into the business system. The business system contains business data corresponding to different business scenarios. After the print template is created, the correspondence between different types of business data and the print template is defined in the business system.

[0102] After a user inputs a print request for preset business data through the business system, the business system determines the template identifier of the print template based on the print template bound to the preset business data, and calls the data rendering engine, sending the business data and template identifier as input parameters to the data rendering engine. The data rendering engine sends the print request to the application server through the network I / O interface based on the template identifier. After receiving the request, the application server retrieves the print template document corresponding to the template identifier from the template document database based on the template identifier, and sends the print template document to the data rendering engine through network I / O.

[0103] S30: Match the business data and the print template document according to the preset business data format and the print template document format, bind the corresponding business data to each node object in the print template document, and obtain the printable document object model with bound business data.

[0104] In this embodiment, the data rendering engine parses the print template document to determine the hierarchical structure of multiple node objects in the print template document, and binds corresponding business data to each node object according to the hierarchical structure of the multiple node objects and the hierarchical structure of the business data, that is, assigning values ​​to each node according to the business data to obtain the document object model to be printed.

[0105] S40: Render the object model of the document to be printed to obtain the vector graphics document to be output.

[0106] In this embodiment, the document object model to be printed includes: multiple node objects and business data filled in each node object. Each node object includes an event script defined when designing the print template document. During the rendering process, the event script needs to be executed, the event corresponding to the event script is executed on the node object, and then the node object and the business data filled in each node object are rendered, rendering them into a scalable vector graphic form that can be displayed in the business system, thus obtaining a vector graphic document.

[0107] After the data rendering engine renders the vector graphics document, it sends the vector graphics document to the business system. The business system's page allows for print preview. Since the document format is scalable vector graphics, the vector graphics document can be scaled freely in the business system. After confirming that the content in the vector graphics document is correct, it can be directly sent to the printer for printing.

[0108] The document output method based on the above printing templates is cross-platform compatible because the printing templates are all vector templates. Without sacrificing image quality, vector graphics documents can be scaled and can be directly previewed or printed without PDF conversion. This avoids the problem of losing details or distortion when converting Canvas or Div elements to PDF, ensuring that the printing of vector graphics documents is exactly what you see.

[0109] Furthermore, the aforementioned document output method based on print templates migrates the rendering function, originally performed by the server, to the data rendering engine on the browser side. The data acquisition and rendering are handled by the data rendering engine integrated into the business system, requiring virtually no computational power from the server. When printing tasks are highly concentrated and print template documents are very complex, the strong GPU capabilities of the computers hosting the business system, and the fact that the business system is distributed across different computers, maximize the rendering advantages of the data rendering engine, reducing the rendering burden on the server. This means that the server does not need to process multiple rendering requests in parallel, nor does it need to convert the print documents to PDF format, thus improving rendering efficiency, leveraging the advantages of each component of the system, and enhancing the overall system performance.

[0110] The document output method based on print templates provided in the above embodiments retrieves corresponding print template documents from a template document database based on a print request input for preset business data. The print request includes a template identifier. The template document database includes at least one pre-generated candidate print template document, all of which are vector template documents. The business data and print template documents are matched according to the format of the preset business data and the format of the print template documents. Corresponding business data is bound to each node object in the print template document, resulting in a printable document object model bound with the business data. The printable document object model is then rendered to obtain a vector graphic document ready for output. In the above embodiments, the pre-designed vector template document can be flexibly adjusted to generate a vector graphic document based on business data, ensuring that the vector template document is compatible with business data in more business scenarios. Furthermore, by directly printing the vector graphic document, the printing effect can be guaranteed to match the design state, improving the printing quality.

[0111] Based on the above embodiments, this application also provides another document output method based on a print template. Please refer to... Figure 4 This is a flowchart illustrating a browser-based print template document generation process provided in an embodiment of this application. Figure 4 As shown, before step S20, which retrieves the corresponding print template document from the template document database based on the print request input for preset business data, the method further includes:

[0112] S11: Create an empty object template in the print template design platform based on user creation instructions.

[0113] In this embodiment, the print template design platform is a browser-based B / S architecture platform deployed on the server side. Users can access the print template design platform through their browser by entering its service address. The print template design platform includes functions such as querying print templates, creating print templates, modifying print templates, deleting print templates, deleting print template categories, uploading print templates, and downloading print templates.

[0114] Specifically, users input creation instructions into the print template design platform displayed in the browser. Based on these instructions, the print template design platform creates an empty object template, which is located in the middle of the platform and serves as a print template design canvas.

[0115] S12: In response to at least one control selected in the print template design platform, generate at least one node object corresponding to at least one control in the empty object template, and obtain the attribute information and behavior information of the node object with custom settings, so as to obtain at least one node object after setting, wherein the object is a vector graphic object.

[0116] In this embodiment, the print template design platform includes: a top toolbar, a left-side control tree, a middle canvas, a right-side attribute area, and a bottom breadcrumb navigation. When a user operates or drags controls in the left-side control tree, the canvas generates corresponding node objects based on the user's operation response. By selecting a node object in the canvas, the attribute and behavior information of the node object can be customized in the right-side attribute area. The attribute information may include, for example, the size of the node object, the font and color of the text information in the node object, etc. The behavior information includes: pre-rendering event scripts and post-rendering event scripts. The pre-rendering event script may be used to assign values ​​to parameters in the node object, and the post-rendering event script may be used to adjust the attribute information of the node object.

[0117] It should be noted that when designing the print template document, users need to design the print template document according to the format of the business data to be printed, and ensure that the format of the business data to be printed matches the format of the print template document.

[0118] S13: Generate a candidate print template document based on at least one node object after the settings.

[0119] In this embodiment, after all node objects in the canvas are set, all node objects in the canvas constitute a candidate print template object. Users can customize the template identifier for the candidate print template document and store the candidate print template document in the template document database of the application server.

[0120] It should be noted that the aforementioned browser-based print template design platform and business system can run on the same computer device or on different computer devices, and this embodiment does not impose any restrictions on this.

[0121] The document output method based on print templates provided in the above embodiments allows for the design of vector print template documents through a print template design platform. Customized design behavior events can be created for node objects in the print template document, enabling the print template document to meet and be compatible with various business scenarios. Since the designed vector print template document does not need to be converted to PDF format during printing, it avoids the problem of losing details or distortion during the conversion of Canvas or Div elements to PDF. Furthermore, the print template design platform is very smooth and easy to operate, improving its usability and versatility.

[0122] Based on the above embodiments, this application also provides another document output method based on a print template. Please refer to... Figure 5 This is a flowchart illustrating another browser-based print template document generation process provided in an embodiment of this application, as shown below. Figure 5 As shown, after step S13, which generates a candidate print template document based on at least one set node object, the method further includes:

[0123] S14: Call the serialization storage recursive algorithm of the candidate print template document to determine whether each attribute name in the candidate print template document is registered in the object factory.

[0124] In this embodiment, to ensure that the selected print template is compatible with different applications, platforms, or systems, it needs to be saved in a preset language format. This preset language format is a standard language format compatible with different applications, platforms, or systems. Specifically, the preset language format can be XML. XML not only ensures compatibility with different applications, platforms, or systems, but also stores the node objects in the print template document in XML format. Compared to storing in SVG format, this reduces storage size, and XML is also more readable.

[0125] In one optional embodiment, after the user designs the candidate print template document through the print template design platform, the candidate print template is saved. During the saving process, the serialization storage recursive algorithm is called to determine whether the attribute names of the node objects in the candidate print template document have been registered in the object factory XMLNodeFactory. The object factory includes the attribute names corresponding to multiple node objects.

[0126] It should be noted that, in addition to the node objects generated on the canvas based on the controls on the design platform when designing the candidate print template document, the entire candidate print template document is also a large node object. The property name of this node object is the Page property, and the property names of the other node objects are the control names corresponding to the node objects.

[0127] A recursive algorithm refers to determining whether a node object corresponding to a given attribute name can contain other node objects. If so, the node object needs to be recursively processed to check if the node objects it contains have already been registered in the object project. For example, the entire candidate print template document corresponding to the Page attribute is considered as a node object, which will inevitably contain other node objects generated by controls. Therefore, given that the attribute name is Page, this node object needs to be traversed. In this embodiment, besides the Page attribute containing other node objects, some container node objects generated by container controls can also contain other node objects.

[0128] S15: If already registered, the attribute information of the node object corresponding to the attribute name will be serialized and saved in a preset language format to obtain a serialized printable template document.

[0129] In this embodiment, if the attribute name of a node object is registered in the object factory, the attribute information of the node object is saved as program code in a preset language format. The program code represents the attribute name and attribute information of the node object in the preset language format.

[0130] For example, the node object is a text box with the property name Text. The property information includes: font name, font size, font color, and font style. If the property name Text has been registered in the object factory, the font name, font size, font color, and font style will be converted to the preset language format.

[0131] S16: If not registered, the attribute information of the node object corresponding to the attribute name will be saved as a string.

[0132] In this embodiment, if the attribute name of a node object is not registered in the object factory, the attribute information of the node object is directly saved as a string, which can also be recognized by different applications, platforms or systems.

[0133] It should be noted that, yes, S15 and S16 above are in Figure 5 Although there are sequential steps, they are actually parallel steps and there is no order of precedence in the actual execution process.

[0134] After steps S14-S16, all node objects in the candidate print template document are serialized and saved. The attribute information of node objects whose attribute names are registered in the object factory is converted into a preset language format, and the attribute information of node objects whose attribute names are not registered in the object factory is converted into strings. The serialized candidate print template document is then sent to the application server via network I / O. After verifying the candidate print template document, the application server persists the data in the template document database so that the data rendering engine can query and call it.

[0135] For example, as shown in formula (1), by calling the self-developed ToXML recursive processing logic, when the attribute name of the node object has been registered in the object factory XMLNodeFactory, the ToXML recursive processing logic is called to convert the attribute information of the node object into XML format, and the next recursion continues to determine whether the attribute names of other node objects contained in the node object have been registered in the object factory; when the attribute name of the node object has not been registered in the object factory XMLNodeFactory, the attribute information of the node object is directly saved as a string, and no further recursion is performed.

[0136]

[0137] The document output method based on the print template provided in the above embodiments determines whether the attribute name of the node object has been registered in the object factory, so as to save the attribute information corresponding to the attribute name in a preset language format or string format, so that the serialized print template document can be compatible with different applications, platforms or systems.

[0138] Based on the above embodiments, this application also provides another document output method based on a print template. Please refer to... Figure 6 This is a flowchart illustrating another document output method based on a print template provided in an embodiment of this application, as shown below. Figure 6 As shown, the step S20 above, which involves retrieving the corresponding print template document from the template document database based on a print request for preset business data input, may include:

[0139] S21: Obtain a serialized print template document based on the print request for the preset business data input.

[0140] In this embodiment, after the user inputs a print request for preset business data through the business system, the business system determines the template identifier of the corresponding print template based on the preset business data, calls the data rendering engine, and sends the business data and template identifier as input parameters to the data rendering engine. The data rendering engine sends the print request to the application server through the network I / O interface based on the template identifier. After receiving the request, the application server retrieves the serialized print template document corresponding to the template identifier from the template document database based on the template identifier, and sends the print template document to the data rendering engine through network I / O. Here, the serialized print template document refers to storing the node objects in the print template document using the preset language format and string format described in S14-S16 above.

[0141] S22: Call the deserialization recursive algorithm of the serialized print template document to determine whether each attribute name in the serialized print template document is registered in the object factory.

[0142] In this embodiment, the print template document is saved using a serialization recursive algorithm. During deserialization, a deserialization recursive algorithm, which is the opposite of the serialization recursive algorithm, is used to determine whether the attribute names of the node objects in the serialized print template document have been registered in the object factory XMLNodeFactory.

[0143] S23: If the attribute name has been registered in the object factory, call the corresponding conversion method to convert the attribute information in the preset language format corresponding to the attribute name to obtain the node object corresponding to the attribute name. The printed template document includes: multiple converted node objects.

[0144] In this embodiment, the attribute name of the node object is judged. If the attribute name has been registered in the object factory, it is determined that the attribute information of the node object is stored in the serialized printing template document in a preset language format. The corresponding conversion method needs to be called to generate the corresponding vectorized node object according to the attribute information in the preset language format.

[0145] S24: If the attribute name is not registered in the object factory, assign the string corresponding to the attribute name to the parent node object of the node object corresponding to the attribute name.

[0146] In this embodiment, if the attribute name is not registered in the object factory, it is determined that the attribute information corresponding to the attribute name is stored in the serialized printing template document in string format. The string is directly converted into the corresponding character and assigned to the parent node object.

[0147] For example, if a text box node object or table node object contains a text node object that is not registered in the object factory, the text in the text node object will be converted into a string. Since a recursive algorithm is used during serialization, after judging the text box node object or table node object, the text node object will be judged recursively. There is a hierarchy between the text box node object or table node object and the text node object. During deserialization, the deserialized text box node object or table node object and the text node object will be associated according to this hierarchy. After the string is converted into the corresponding character, it will be assigned to the text box node object or table node object above the text node object. This ensures that the format of the deserialized print template document is consistent with the print template document designed on the design platform, that is, the design state and runtime state of the print template document are consistent.

[0148] For example, as shown in formula (2), by calling the self-developed FromXML recursive processing logic, if the attribute name XML(DOM) of the node object has been registered in the object factory XMLNodeFactory, the FromXML method of the instance registered in the object factory XMLNodeFactory of the node object is recursively called to generate the corresponding vectorized node object according to the attribute information of the preset language format; if the attribute name XML(DOM) of the node object has not been registered in the object factory XMLNodeFactory, the text corresponding to the attribute information is directly assigned to the node object of the previous level. This process is repeated recursively until the deserialized print template document is finally obtained.

[0149]

[0150] The document output method based on the printing template provided in the above embodiments determines whether the attribute name of the node object is registered in the object factory, and deserializes the printing template document according to the attribute information in the preset language format and the attribute information in the string format. This demonstrates that the serialized and saved printing template document can be compatible with different applications, platforms or systems, so that the designed printing template document can be used flexibly across platforms.

[0151] Based on the above embodiments, this application also provides another document output method based on a print template. Please refer to... Figure 7 This is a flowchart illustrating another document output method based on a print template provided in this application embodiment, as shown below. Figure 7 As shown, the process of matching business data and print template documents according to the preset business data format and print template document format in S30 above may include:

[0152] S31: Bind the node objects in the current level of the print template document to the data in the same level of the business data.

[0153] In this embodiment, since the design format of the print template document and the format of the business data are matched, that is, the level of multiple node objects in the print template document corresponds to the level of the business data. The business data is passed into the data rendering engine in a tree format. For example, if a node object contains at least one child node object, then there is also at least one data in a dataset in the business data. By synchronously traversing the print template document and the business data, the node objects in the current level of the print template document and the data in the same level of the business data are bound together.

[0154] S32: If a node object in the current level contains child objects, bind the child objects to the corresponding level of data in the business data.

[0155] In this embodiment, after binding the node object in the current level of the print template document with the data of the same level in the business data, it is determined whether the node object in the current level contains child objects. If it does, the data of the corresponding level of the child object is determined from the dataset corresponding to the node object in the current level, and the child object and the data of the corresponding level in the business data are bound.

[0156] For example, as shown in formula (3), the self-developed AssignData recursive algorithm is used. If the node object has child objects, the AssignData algorithm of the node is recursively called after assigning a value to the current node object to continue assigning real business data to the child objects. If the node object does not have child objects, the current node object is directly assigned a value.

[0157]

[0158] The document output method based on print templates provided in the above embodiments binds business data to node objects according to the level of the node objects, ensuring that the node objects and business data are consistent.

[0159] Based on the above embodiments, this application also provides another document output method based on a print template. Please refer to... Figure 8 This is a flowchart illustrating another document output method based on a print template provided in an embodiment of this application, as shown below. Figure 8 As shown, the step in S40 above, which renders the object model of the document to be printed to obtain the vector graphics document to be output, may include:

[0160] S41: Divide the document object model to be printed into at least one unit, the unit including at least one of the following: template document header, template document body and template document footer.

[0161] In this embodiment, in order to ensure the smooth progress of the rendering process, the template document to be printed is split into the template document header (pageHeader), the template document body (pageBody), and / or the template document footer (pageFooter) before rendering. The existence of each unit depends on whether each unit was designed during the template design process.

[0162] S42: Render multiple node objects in each unit to obtain the vector graphics document to be output.

[0163] In this embodiment, after the document object model to be printed is split, the self-developed DynamicBuilder algorithm is called to recursively render the multiple node objects contained in each unit to obtain the vector graphics document to be output. If the node object is a container object, then the node object has child objects. After executing the DynamicBuilder algorithm on the node object, the DynamicBuilder algorithm is then executed on each child object until all child objects have been rendered and the recursion ends. Alternatively, if there are no child objects, the recursion ends directly. For example, the container object is a table object or a panel object.

[0164] The document output method based on printing templates provided in the above embodiments divides the document object model to be printed into at least one unit, and obtains a vector graphics document by rendering multiple node objects in each unit. This makes the rendering process more organized and ensures the efficiency of the rendering process.

[0165] Based on the above embodiments, this application also provides another document output method based on a print template. Please refer to... Figure 9 This is a flowchart illustrating yet another document output method based on a print template provided in this application embodiment, as shown below. Figure 9 As shown, the step of rendering multiple node objects in each unit in S42 above may include:

[0166] S421: Execute the pre-rendering event script in the corresponding behavior information for multiple node objects.

[0167] In this embodiment, based on the definition of the behavior information of the node objects when creating the print template document, the pre-print event script included in the behavior information is executed on the node objects. For example, the pre-print event script assigns values ​​to variables in the node objects.

[0168] S422: Render data for multiple node objects.

[0169] In this embodiment, after the execution of the pre-rendering event script is completed, data rendering is performed on the node object and the business data bound to the node object to convert the node object and business data into a scalable vector graphic form that can be displayed in the business system.

[0170] S423: Execute the post-rendering event scripts in the corresponding behavior information for multiple node objects to obtain the vector graphics document to be output.

[0171] In this embodiment, after data rendering is completed on the node object, the post-rendering event script (afterPrint) is executed on the node object according to the definition of the node object's behavior information when creating the print template document. For example, the post-rendering event script might be used to adjust the node object's border properties.

[0172] In one alternative embodiment, if the node object is a table object, the table object may include: row panel objects and column panel objects. The row panel is a designer component that binds business data and performs horizontal loop rendering based on the business data format, and the column panel is a designer component that binds business data and performs vertical loop rendering based on the business data format.

[0173] If the table object contains row panels, the business data corresponding to the row panels in the table object is rendered horizontally, resulting in multiple rows of business data in the table object; if the table object contains column panels, the business data corresponding to the column panels in the table object is rendered vertically, resulting in multiple columns of business data in the table object.

[0174] In this embodiment, if the table object contains RowPanel objects, the pre-rendering event script is executed on the RowPanel objects first, and then horizontal loop rendering is performed based on the business data bound to the RowPanel objects in the table object. During the horizontal loop rendering process, multiple rows of business data are rendered in the table object according to the number of rows of business data. After that, the post-rendering event script is executed on the RowPanel objects. If the table object contains ColumnPanel objects, the pre-rendering event script is executed on the ColumnPanel objects first, and then vertical loop rendering is performed based on the business data bound to the ColumnPanel objects in the table object. During the vertical loop rendering process, multiple columns of business data are rendered in the table object according to the number of columns of business data. After that, the post-rendering event script is executed on the ColumnPanel objects.

[0175] For example, please refer to Figure 10 This is a schematic diagram of a rendering process provided in an embodiment of this application, such as... Figure 10As shown, the document root element is rendered first. The document root element includes: template document header, template document body, and / or template document footer. During the rendering of each root element, pre-rendering script events, data rendering, and post-rendering script events need to be executed on the node objects in the root element. The node objects include: Line, Text, Symbol, Checkbox, Image, Barcode, Panel, Label, CodeGroup, and Table. The container object is either a Table or a Panel object. Table and Panel objects may contain other node objects.

[0176] For table objects, if the table object contains row panels, the row panels are looped, and the event scripts for the row panel rendering before, rendering, and rendering after the row panel are executed. If the table object contains column panels, the column panels are looped, and the event scripts for the column panels rendering before, rendering, and rendering after the column panels are executed. When all node objects have been rendered, a vector graphics document is output.

[0177] It should be noted that, since pre-rendering event scripts and post-rendering event scripts are defined for each object, unlike existing vector graphics templates which cannot add event scripts, this embodiment can achieve dynamic processing of script events.

[0178] The document output method based on printing templates provided in the above embodiments enables dynamic processing and rendering of each node object in the template according to business data by executing pre-rendering event scripts, data rendering, and post-rendering event scripts for each node object. This makes the embodiment more flexible and can be applied to various business data scenarios.

[0179] Based on the above embodiments, this application also provides a document output device based on a print template. Please refer to... Figure 11 This is a schematic diagram of a document output device based on a printing template provided in an embodiment of this application. Figure 11 As shown, the device includes:

[0180] The template acquisition module 101 is used to acquire the corresponding print template document from the template document database according to the print request input for preset business data. The print request includes: template identifier, and the template document database includes at least one pre-generated candidate print template document, all of which are vector template documents.

[0181] The data matching module 102 is used to match the business data and the print template document according to the preset business data format and the print template document format, bind the corresponding business data to each node object in the print template document, and obtain the print document object model with bound business data.

[0182] The document rendering module 103 is used to render the object model of the document to be printed, so as to obtain the vector graphics document to be output.

[0183] Optionally, before the template acquisition module 101 acquires the print template document, the device further includes:

[0184] The template creation module is used to create empty object templates in the print template design platform based on user creation instructions.

[0185] The object generation module is used to generate at least one node object corresponding to at least one control in an empty object template in response to at least one control selected in the print template design platform, and to obtain the attribute information and behavior information of the node object after custom settings, so as to obtain at least one node object after settings, wherein the object is a vector graphic object;

[0186] The template generation module is used to generate a candidate print template document based on at least one node object after the settings.

[0187] Optionally, after the template generation module generates the candidate print template document, the device further includes:

[0188] The attribute name judgment module is used to call the serialization storage recursive algorithm of the candidate print template document to determine whether each attribute name in the candidate print template document is registered in the object factory;

[0189] The node object saving module is used to serialize and save the attribute information of the node object corresponding to the attribute name into a preset language format if it has been registered, so as to obtain a serialized printable template document.

[0190] Optionally, the template acquisition module 101 includes:

[0191] The template acquisition unit is used to acquire a serialized print template document based on the print request input for preset business data.

[0192] The attribute name judgment unit is used to call the deserialization recursive algorithm of the serialized print template document to determine whether each attribute name in the serialized print template document is registered in the object factory.

[0193] The node object conversion unit is used to call the corresponding conversion method if the attribute name has been registered in the object factory, and convert the attribute information in the preset language format corresponding to the attribute name to obtain the node object corresponding to the attribute name. The printed template document includes: multiple converted node objects.

[0194] Optionally, the node object saving module, if not registered, will save the attribute information of the node object corresponding to the attribute name as a string, and obtain the serialized candidate print template document.

[0195] Optionally, the node object conversion unit is also used to assign the string corresponding to the attribute name to the parent node object of the node object corresponding to the attribute name if the attribute name is not registered in the object factory.

[0196] Optionally, the data matching module 102 includes:

[0197] The current-level data matching unit is used to bind node objects in the current level of the print template document to data of the same level in the business data;

[0198] The child data matching unit is used to bind the child objects and the corresponding level of data in the business data if the node objects in the current level contain child objects.

[0199] Optionally, the document rendering module 103 includes:

[0200] A document splitting unit is used to divide a document object model to be printed into at least one unit, the unit including at least one of the following: template document header, template document body and template document footer;

[0201] The document rendering unit is used to render multiple node objects in each unit to obtain the vector graphics document to be output.

[0202] Optional, document rendering units include:

[0203] The pre-rendering event script subunit is used to execute the pre-rendering event scripts in the corresponding behavior information for multiple node objects.

[0204] The document rendering subunit is used to render data from multiple node objects;

[0205] The post-rendering event script subunit is used to execute the post-rendering event scripts in the corresponding behavior information for multiple node objects to obtain the vector graphics document to be output.

[0206] Optionally, if the node object is a table object, the document rendering sub-unit includes:

[0207] The row panel rendering subunit is used to render the business data corresponding to the row panel in the table object horizontally if the table contains row panels, and to render multiple rows of business data in the table object.

[0208] The column panel rendering subunit is used to vertically render the business data corresponding to the column panels in the table object if the table object contains column panels, thereby rendering multiple columns of business data in the table object.

[0209] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.

[0210] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).

[0211] Please refer to Figure 12 This is a schematic diagram of a computer device provided in an embodiment of this application, such as... Figure 12 As shown, the computer device 200 includes a processor 201, a storage medium 202, and a bus. The storage medium 202 stores program instructions executable by the processor 201. When the computer device 200 is running, the processor 201 communicates with the storage medium 202 via the bus, and the processor 201 executes the program instructions to perform the above-described method embodiment. The specific implementation and technical effects are similar and will not be described in detail here.

[0212] Optionally, the present invention also provides a program product, such as a computer-readable storage medium, including a program that, when executed by a processor, is used to perform the above-described method embodiments.

[0213] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0214] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0215] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0216] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0217] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A print template-based document output method characterized by, The method includes: Based on the print request for the preset business data input, the corresponding print template document is obtained from the template document database. The print request includes a template identifier. The template document database includes at least one pre-generated candidate print template document, and all candidate print template documents are vector template documents. Based on the format of the preset business data and the format of the print template document, the business data and the print template document are matched, and the corresponding business data is bound to each node object in the print template document to obtain a printable document object model with bound business data. The document object model to be printed is rendered to obtain a vector graphics document to be output; Before retrieving the corresponding print template document from the template document database based on the print request input for preset business data, the method further includes: Based on user-created instructions, an empty object template is created in the print template design platform; In response to at least one control selected on the print template design platform, at least one node object corresponding to the at least one control is generated in the empty object template, and attribute information and behavior information customized for the node object are obtained to obtain at least one node object after setting, wherein the object is a vector graphic object; The candidate print template document is generated based on at least one node object after the settings are configured. The process of rendering the document object model to be printed to obtain the vector graphics document to be output includes: Execute the pre-rendering event scripts in the corresponding behavior information for multiple node objects in the document object model to be printed; Perform data rendering on the multiple node objects; Execute the post-rendering event scripts in the corresponding behavior information on the multiple node objects to obtain the vector graphics document to be output.

2. The method of claim 1, wherein, After generating the candidate print template document based on at least one node object after the settings, the method further includes: The serialization storage recursive algorithm of the candidate print template document is invoked to determine whether each attribute name in the candidate print template document is registered in the object factory; If already registered, the attribute information of the node object corresponding to the attribute name will be serialized and saved in a preset language format to obtain a serialized print template document.

3. The method of claim 2, wherein, The step of retrieving the corresponding print template document from the template document database based on the print request input for preset business data includes: Based on the print request for the preset business data input, obtain the serialized print template document; The deserialization recursive algorithm of the serialized print template document is invoked to determine whether each attribute name in the serialized print template document is registered in the object factory; If the attribute name is registered in the object factory, the corresponding conversion method is called to convert the attribute name into a node object corresponding to the attribute name based on the attribute information of the preset language format. The print template document includes multiple converted node objects.

4. The method of claim 2, wherein, The method further includes: If not registered, the attribute information of the node object corresponding to the attribute name is saved as a string to obtain the serialized candidate print template document.

5. The method of claim 4, wherein, The step of retrieving the corresponding print template document from the template document database based on the print request input for preset business data also includes: If the attribute name is not registered in the object factory, the string corresponding to the attribute name is assigned to the parent node object of the node object corresponding to the attribute name.

6. The method of claim 1, wherein, The step of matching the business data and the print template document according to the format of the preset business data and the format of the print template document includes: Bind the node objects in the current level of the print template document to the data in the same level of the business data; If the node object in the current level contains child objects, bind the child objects to the data of the corresponding level in the business data.

7. The method of claim 1, wherein, The process of rendering the document object model to be printed to obtain the vector graphics document to be output includes: The document object model to be printed is divided into at least one unit, and the unit includes at least one of the following: template document header, template document body and template document footer; Render multiple node objects in each of the aforementioned units to obtain a vector graphics document for output.

8. The method as described in claim 1, characterized in that, If the node object is a table object, the data rendering of the multiple node objects includes: If the table contains row panels, then the business data corresponding to the row panels in the table object is rendered horizontally, and multiple rows of business data are rendered in the table object. If the table object contains column panels, then the business data corresponding to the column panels in the table object is rendered vertically, resulting in multiple columns of business data in the table object.

9. A document output device based on a print template, characterized in that, The apparatus for implementing the document output method based on a print template as described in claim 1 includes: The template acquisition module is used to retrieve the corresponding print template document from the template document database based on the print request input for preset business data. The print request includes a template identifier, and the template document database includes at least one pre-generated candidate print template document, all of which are vector template documents. The data matching module is used to match the business data and the print template document according to the format of the preset business data and the format of the print template document, bind the corresponding business data to each node object in the print template document, and obtain the printable document object model with bound business data. The document rendering module is used to render the document object model to be printed to obtain a vector graphics document to be output.

10. A computer device, characterized in that, include: The computer device includes a processor, a storage medium, and a bus, wherein the storage medium stores program instructions executable by the processor, and when the computer device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the document output method based on a print template as described in any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, performs the steps of the document output method based on a print template as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Local express sheet printing method, device and equipment and storage medium

    CN111324317A

  • Certificate vector printing method

    CN112486434A