Printing template generation method and device based on form engine, equipment and medium
Through the form engine-based printing template generation method, dynamically process and display data, the problems of long maintenance cycle and high error rate in traditional document processing are solved, and fast and efficient document generation and simplified maintenance process are achieved.
Patent Information
- Application Number
- CN202411382980.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-30
- Publication Date
- 2025-01-07
AI Technical Summary
In the traditional document processing mode, the printing template has a long maintenance cycle, a high error rate, and low work efficiency. Especially when the data volume is large, manual data entry requires a lot of time and is prone to errors.
Using the form engine-based printing template generation method, metadata modeling is performed by obtaining the data to be printed, printing model and custom interface are established, printing templates are created using the template designer, and combining metadata and templates through the print rendering engine to dynamically Generate print pages to reduce manual input and maintenance work.
It improves the speed and efficiency of document generation, reduces the cumbersomeness and error rate of manual updates, simplifies maintenance work, and only needs to modify the data source to update the printing template, avoiding repeated opening of typesetting software editing.
Smart Images

Figure CN119271159A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer information processing, and in particular to a form engine-based printing template generation method, device, equipment and medium. Background Art
[0002] In business management, in order to ensure that different documents (such as invoices, contracts, reports, etc.) remain consistent in format, layout, and design, maintain brand image, and quickly generate a large number of identical or similar documents, reduce manual creation and typesetting time, and improve work efficiency, a large number of printing templates are often created to help improve the standardization and efficiency of document processing.
[0003] However, the traditional document processing model has many disadvantages. The text information of the template is fixed, and each information update requires manual maintenance. When the amount of data is large, manual data entry or handwriting requires a lot of time to complete, and the error rate is high. Users need to manually create or modify existing templates, which wastes manpower and has low work efficiency. Summary of the invention
[0004] In view of this, it is necessary to provide a printing template generation method, device, equipment and medium based on a form engine to solve the technical problems of long maintenance cycle, high error rate and low work efficiency when processing documents with printing templates.
[0005] In order to solve the above problems, the present invention provides a method for generating a printing template based on a form engine, comprising: Acquire data to be printed, perform metadata modeling on the data to be printed, and obtain metadata and a metadata interface; Based on the metadata, a printing model is established through a form engine, and a custom interface is generated; Creating a plurality of printing templates corresponding to the printing model through a template designer, and generating a printing button; A print rendering engine is called based on the print button, and the print rendering engine combines the data to be printed obtained based on the metadata interface and the custom interface with the print template to render a print page.
[0006] In a possible implementation, the acquiring the data to be printed and performing metadata modeling on the data to be printed includes: The data to be printed are acquired, metadata modeling is performed on the data to be printed to construct a database of the printing data, and metadata and a metadata interface are obtained, wherein the data to be printed include user-filled data and external data.
[0007] In a possible implementation, establishing a printing model by a form engine based on the metadata includes: Based on the metadata, a printing model is established through a form engine to obtain user-filled data corresponding to the metadata, and the user-filled data is saved in a database.
[0008] In a possible implementation, the creating a plurality of printing templates corresponding to the printing model by a template designer and generating a printing button includes: Components are acquired, and after associating the components with the metadata, the components are arranged through a template designer to obtain a plurality of printing templates corresponding to the printing model, and a printing button is generated.
[0009] In one possible implementation, the components include at least text, picture, rich text, page body, print container, form, text input box, amount input box, text field, custom archive, cascading selection, advanced cascading selection, date selection, electronic signature, data table, editable table, description list and description list item.
[0010] In a possible implementation, calling a print rendering engine based on the print button, combining the to-be-printed data obtained based on the metadata interface and the custom interface with the print template through the print rendering engine to render a print page, includes: The print template is selected according to user needs, and after binding the print template to the print button, a print rendering engine is called based on the print button. The metadata interface and the custom interface are called through the print rendering engine. After obtaining the data to be printed, the data to be printed is combined with the print template, and a UI corresponding to the print template is rendered to dynamically generate a print page.
[0011] In a possible implementation, the obtaining the to-be-printed data based on the metadata interface and the custom interface includes: Calling the metadata based on the metadata interface to obtain user reported data corresponding to the metadata; Obtaining external data based on the custom interface; The data to be printed is obtained based on the user-filled data and external data.
[0012] On the other hand, the present invention also provides a printing template generating device based on a form engine, comprising: A metadata module, used to obtain the data to be printed, perform metadata modeling on the data to be printed, and obtain metadata and a metadata interface; A printing model building module, used to build a printing model through a form engine based on the metadata and generate a custom interface; A printing template creation module, used to create a plurality of printing templates corresponding to the printing model through a template designer, and generate a printing button; The print page generation module is used to call a print rendering engine based on the print button, and after the print rendering engine combines the data to be printed obtained based on the metadata interface and the custom interface with the print template, render a print page corresponding to the print template.
[0013] In another aspect, the present invention further provides an electronic device, comprising: a processor and a memory; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, the steps in the method for generating a printing template based on a form engine as described above are implemented.
[0014] On the other hand, the present invention also provides a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the print template generation method based on the form engine as described above.
[0015] The beneficial effects of the present invention are as follows: based on metadata, a printing model is established through a form engine, data is dynamically processed and displayed through the form engine, thereby avoiding the tediousness of manual updating, and multiple printing templates corresponding to the printing model are created through a template designer, so that document generation becomes fast and efficient, and there is no need to manually create or modify documents one by one, thereby improving work efficiency. After the printing template is completed, updating the data only requires modifying the data source, and there is no need to repeatedly open the typesetting software for editing, thereby simplifying maintenance work. After the print rendering engine combines the data to be printed obtained based on the metadata interface and the custom interface with the printing template, a print page is rendered, and errors caused by manual input are reduced by automatically extracting information from the data source and filling it into the printing template. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flowchart of an embodiment of a method for generating a printing template based on a form engine provided by the present invention; Figure 2 A schematic diagram of metadata modeling of a printing template generation method based on a form engine provided by the present invention; Figure 3 A schematic diagram of a printing model of a printing template generating method based on a form engine provided by the present invention; Figure 4A schematic diagram of a printing template for the printing template generation method based on a form engine provided by the present invention; Figure 5 A schematic diagram of the structure of an embodiment of a printing template generating device based on a form engine provided by the present invention; Figure 6 The present invention is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0018] The present invention discloses a form engine-based printing template generation method, device, equipment and medium, which can be used in a computer. The method, device or computer-readable storage medium involved in the present invention can be integrated with the above-mentioned device or can be relatively independent.
[0019] A specific embodiment of the present invention discloses a method for generating a printing template based on a form engine, which can be executed by a computer, and specifically by one or more processors of the computer. Figure 1 is a flowchart of a method for generating a print template based on a form engine provided by an embodiment of the present invention. Figure 1 , the printing template generation method based on the form engine includes: S101, obtaining data to be printed, performing metadata modeling on the data to be printed, and obtaining metadata and a metadata interface; S102, based on the metadata, a printing model is established through a form engine, and a custom interface is generated; S103, creating multiple printing templates corresponding to the printing model through the template designer, and generating a printing button; S104: Calling a print rendering engine based on the print button, and combining the to-be-printed data obtained based on the metadata interface and the custom interface with the print template through the print rendering engine to render a print page.
[0020] Among them, through metadata modeling, a database of printing data is established to determine the corresponding relationship between the data to be printed and the metadata. The data to be printed includes user-filled data and external data.
[0021] Compared with the prior art, the printing template generation method based on the form engine provided in this embodiment obtains the data to be printed, performs metadata modeling on the data to be printed, obtains metadata and a metadata interface, establishes a printing model based on the metadata through the form engine, and generates a custom interface. The data is dynamically processed and displayed through the form engine, avoiding the tedious manual update. A plurality of printing templates corresponding to the printing model are created through a template designer, and a print button is generated, so that the generation of documents becomes fast and efficient, and there is no need to manually create or modify documents one by one, thereby improving work efficiency. After the printing template is completed, updating the data only requires modifying the data source, and there is no need to repeatedly open the typesetting software for editing, thereby simplifying maintenance work. After the data to be printed obtained based on the metadata interface and the custom interface is combined with the printing template through the printing rendering engine, a printing page is rendered, and the data to be printed is filled into the printing template, thereby reducing errors caused by manual input.
[0022] In some embodiments, in step S101, the data to be printed is obtained, the data required for printing is entered into the system, metadata modeling is performed on the data to be printed to build a database of printing data, and metadata and metadata interface are obtained, wherein the data to be printed includes user-filled data and external data, and a database of printing data is established through metadata modeling, and the corresponding relationship between the data to be printed and the metadata is determined. For a schematic diagram of metadata modeling, please refer to Figure 2 .
[0023] In some embodiments, in step S102, based on the metadata, a printing model is established through a form engine to obtain user-filled data corresponding to the metadata, and the user-filled data is saved in a database to establish a printing model, that is, to establish a custom user-filled model to facilitate user data filling. After the user data is filled in, it corresponds to the metadata one by one, and the user data is stored according to the corresponding relationship between the user data and the metadata. For a schematic diagram of the printing model, please refer to Figure 3 .
[0024] In some embodiments, in step S103, after obtaining the data required for printing through the printing model, multiple printing templates corresponding to the printing model are created through the template designer, and a print button is generated. The specific process is: obtain components, associate the components with metadata, arrange the components through the template designer, generate multiple printing templates corresponding to the printing model, drag the components to the template designer, and arrange different components in the template designer to form multiple printing templates, that is, one printing model corresponds to multiple printing templates, and users can select different printing templates according to actual needs. The print button can be bound to different printing templates to achieve different printing effects; please refer to the schematic diagram of the printing template. Figure 4, components are associated with metadata, which is convenient for users to use the print template. The backend will directly return data and fill the returned data into the print template. Its components include at least text, picture, rich text, page body, print container, form, text input box, amount input box, text field, custom archive, cascade selection, advanced cascade selection, date selection, electronic signature, data table, editable table, description list and description list item. Among them, when the print template is multiple pages, use the print container in the component to create multiple pages for the print template. The print container is created in the case of manual paging, which can be understood as a sheets of paper. In the case of automatic paging, it is understood that a lot of content is printed on multiple sheets of paper. Through the print container, configure the paper size, paper orientation, paging mode, print margins, mixed horizontal and vertical printing, and page repeat printing. Configure the paper size according to the needs, set the paper to A4 or A3, etc., and set the paper orientation to horizontal or vertical; configure the paging mode to set the paging mode to manual or automatic. If it is automatic, the page will be automatically paginated according to the content when printing. If it is manual paging, you can always create new pages. Each page is printed as one sheet of paper. You need to manually control the page content not to be too long, otherwise It will be truncated when printing. If there is an overlap that is not truncated, you need to manually set the overflow: hidden of the style, and mixed horizontal and vertical printing is not possible in automatic mode; by configuring the print margin, set the distance between the content inside the paper and the edge of the paper, the unit is centimeters; when configuring mixed horizontal and vertical printing, if you print multiple sheets of paper, the direction of one or several sheets of paper is different from the main direction (the direction of the first sheet of paper is taken as the main direction by default), you need to manually set the paper direction of these papers, and set the orientationMix of these papers with different directions to true; when configuring page repeat printing, if there are multiple identical data that need to be printed on multiple sheets of paper, you need to set this property to true and provide a unique identifier, such as repeatPage. The value corresponding to this page is an array, which contains an object containing all the values of this page. The repeatPage object is: repeatPage: [{key1: value1, key2: value2}{key1: value3, key2: value4}]; set a unique name for the print container, such as printpage1, request When returning data, you need to set the value of this name to an array, such as printpage1: [{xxx}, {xxx}]. All elements in this page will take values from the object in printpage1. The object must contain the values of all elements in this page. If the server returns empty, you need to add it manually.The body content Key specifies the data of the page as the body data. If the body data does not exist, this page will be hidden. It is mainly used for table / text content paging. If the content is less than or equal to 3 pages, a 3-page template needs to be created. The second and third pages can be hidden when there is no content. ;
[0025] In some embodiments, in step S104, after obtaining the print template, the corresponding print template is selected according to user needs, and the print template is bound to the print button in the print model to obtain the print template selected by the user, and the selected print template ID is determined. After binding the print button to the ID of the print template, the print rendering engine is called based on the print button, and the metadata interface and the custom interface are called by the print rendering engine to obtain the data to be printed, that is, metadata is called based on the metadata interface to obtain the user-filled data corresponding to the metadata; external data is obtained based on the custom interface, and the external data is data not in the metadata, and the data to be printed is obtained based on the user-filled data and the external data. After combining the data to be printed with the print template, the UI corresponding to the print template is rendered to dynamically generate a print page; after obtaining the data and the print template, the print rendering engine combines the two, matches the components corresponding to the data according to different input data, renders the corresponding UI, and constructs a dynamically generated print interface. The workflow of the print rendering engine is as follows: const renderDom=({ uiTree, uiProps, components, appMode, checkPerm}: IDomTreeProps)=>{, const tmpSchemaData=Array.isArray(uiTree) ? uiTree:[uiTree]; return tmpSchemaData.map((schema)=>{; const { type, children}=schema; let childView: ReactChild | ReactChild[] | null = null; if (children&&Array.isArray(children)) {; childView=isTextNode(children)? children: renderDom({uiTree: children, uiProps, components, appMode, checkPerm}); Among them, renderDom is a constant function that accepts an object containing multiple properties as a parameter. These properties include uiTree: an object or array that describes the component structure. Each object represents the definition of a component, including the component type, properties, and subcomponents; uiProps: a collection of component properties that can provide specific properties for each component; components: an available component map, which obtains specific React components through the component type; appMode: the mode of the application, such as design mode or runtime mode; checkPerm: a permission check function used to verify whether the user has permission to access a component; Convert uiTree to an array If uiTree is an array, use it directly; otherwise, wrap it in an array; The specific process is: use the map method to traverse the tmpSchemaData array, generate a React element for each schema (each component definition), extract type (component type) and children (subcomponents) from the current schema, initialize childView to null to store the rendering results of subcomponents, check whether children exists and is an array, if children is a text node, assign it directly to childView, otherwise, recursively call the renderDom function to render the subcomponent, call the getWidgetKey function to get the unique identifier widgetKey of the current component, get widgetId from the current schema, which is the unique key of the component, get the actual React component of the current component according to the schema and components mapping, get the properties of the current component from uiProps, and if the current component is an HTML tag, create one An htmlProps object containing the tag name; otherwise, it is an empty object. A design object is created. The design object contains the design-related properties of the component, such as widgetKey and widgetId. In design mode and runtime mode, check whether the current component is of Button type, and check the permission through the checkPerm function. If there is no permission, it returns null and does not render the component. Check whether the current component type is NO_OBSERVER_COMPONENTS, which means that these components in the array do not require observers. If it is a non-observable component, render the component directly and pass in the corresponding properties and subcomponents. If it is a component that needs to be observed, wrap the component with Observer so that it can be automatically updated when the state changes, pass in the corresponding properties and subcomponents, and after the map function ends, return a React element (or element array) that corresponds to the component definition in the original uiTree. The final element structure will reflect the required UI component hierarchy.
[0026] After selecting a print template, there will be a print button on the front page of the corresponding print model. Click the print button to print out the information the user wants according to the bound print template and unify the format.
[0027] In order to better implement the printing template generation method based on the form engine in the embodiment of the present invention, based on the printing template generation method based on the form engine, correspondingly, Figure 5 As shown, the embodiment of the present invention further provides a printing template generating device based on a form engine. The printing template generating device 500 based on a form engine includes: The metadata module 501 is used to obtain the data to be printed, perform metadata modeling on the data to be printed, and obtain metadata and metadata interface; The printing model building module 502 is used to build a printing model through a form engine based on metadata and generate a custom interface; The printing template creation module 503 is used to create a plurality of printing templates corresponding to the printing model through a template designer, and generate a printing button; The print page generation module 504 is used to call the print rendering engine based on the print button, and after the print rendering engine combines the data to be printed obtained based on the metadata interface and the custom interface with the print template, it renders a print page corresponding to the print template.
[0028] like Figure 6 As shown, the printing template generation method based on the form engine, the present invention also provides an electronic device 600, which can be a computing device such as a mobile terminal, a desktop computer, a notebook, a palm computer and a server. The electronic device 600 includes a processor 601, a memory 602 and a display 603. Figure 6 Only some components of the electronic device 600 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0029] In some embodiments, the memory 602 may be an internal storage unit of the electronic device 600, such as a hard disk or memory of the electronic device 600. In other embodiments, the memory 602 may also be an external storage device of the electronic device 600, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 600. Further, the memory 602 may also include both an internal storage unit of the electronic device 600 and an external storage device. The memory 602 is used to store application software and various types of data installed in the electronic device 600, such as program codes installed in the electronic device 600. The memory 602 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a print template generation program based on a form engine is stored on the memory 602, and the print template generation program based on the form engine can be executed by the processor 601, thereby realizing the print template generation method based on the form engine of each embodiment of the present invention.
[0030] In some embodiments, the processor 601 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 602, such as a printing template generation method based on a form engine.
[0031] In some embodiments, the display 603 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 603 is used to display identification information of a print template generation program based on a form engine and to display a visual user interface. The components 601-603 of the electronic device 600 communicate with each other via a system bus.
[0032] In some embodiments, when the processor 601 executes the print template generation program based on the form engine in the memory 602, the various steps in the print template generation method based on the form engine as described in the above embodiments are implemented. Since the print template generation method based on the form engine has been described in detail above, it will not be repeated here.
[0033] Accordingly, an embodiment of the present application also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, it can implement the steps or functions of the form engine-based printing template generation method provided in the above-mentioned method embodiments.
[0034] In summary, the method, device, equipment and medium for generating a printing template based on a form engine provided by the present invention obtain the data to be printed, perform metadata modeling on the data to be printed, and obtain metadata and a metadata interface; based on the metadata, a printing model is established through a form engine, and a custom interface is generated; a plurality of printing templates corresponding to the printing model are created through a template designer, and a print button is generated; based on the print button, a printing rendering engine is called, and after the data to be printed obtained based on the metadata interface and the custom interface is combined with the printing template through the printing rendering engine, a printing page is rendered, thereby improving work efficiency.
[0035] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0036] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. A method for generating a printing template based on a form engine, characterized in that: include: Acquire data to be printed, perform metadata modeling on the data to be printed, and obtain metadata and a metadata interface; Based on the metadata, a printing model is established through a form engine, and a custom interface is generated; Creating a plurality of printing templates corresponding to the printing model through a template designer, and generating a printing button; A print rendering engine is called based on the print button, and the print rendering engine combines the data to be printed obtained based on the metadata interface and the custom interface with the print template to render a print page.
2. The method for generating a printing template based on a form engine according to claim 1, characterized in that: The step of obtaining the data to be printed and performing metadata modeling on the data to be printed includes: The data to be printed are acquired, metadata modeling is performed on the data to be printed to construct a database of the printing data, and metadata and a metadata interface are obtained, wherein the data to be printed include user-filled data and external data.
3. The method for generating a printing template based on a form engine according to claim 2, characterized in that: The step of establishing a printing model through a form engine based on the metadata includes: Based on the metadata, a printing model is established through a form engine to obtain user-filled data corresponding to the metadata, and the user-filled data is saved in a database.
4. The method for generating a printing template based on a form engine according to claim 3, characterized in that: The step of creating a plurality of printing templates corresponding to the printing model through a template designer and generating a printing button comprises: Components are acquired, and after associating the components with the metadata, the components are arranged through a template designer to obtain a plurality of printing templates corresponding to the printing model, and a printing button is generated.
5. The method for generating a printing template based on a form engine according to claim 4, characterized in that: The components include at least text, image, rich text, page body, print container, form, text input box, amount input box, text field, custom archive, cascade selection, advanced cascade selection, date selection, electronic signature, data table, editable table, description list and description list item.
6. The method for generating a printing template based on a form engine according to claim 4, characterized in that: The calling of a print rendering engine based on the print button, combining the to-be-printed data obtained based on the metadata interface and the custom interface with the print template through the print rendering engine, and rendering a print page, comprises: The print template is selected according to user needs, and after binding the print template to the print button, a print rendering engine is called based on the print button. The metadata interface and the custom interface are called through the print rendering engine. After obtaining the data to be printed, the data to be printed is combined with the print template, and a UI corresponding to the print template is rendered to dynamically generate a print page.
7. The method for generating a printing template based on a form engine according to claim 6, characterized in that: The obtaining the data to be printed based on the metadata interface and the custom interface includes: Calling the metadata based on the metadata interface to obtain user reported data corresponding to the metadata; Obtaining external data based on the custom interface; The data to be printed is obtained based on the user-filled data and external data.
8. A printing template generating device based on a form engine, characterized in that: include: A metadata module, used to obtain the data to be printed, perform metadata modeling on the data to be printed, and obtain metadata and a metadata interface; A printing model building module, used to build a printing model through a form engine based on the metadata and generate a custom interface; A printing template creation module, used to create a plurality of printing templates corresponding to the printing model through a template designer, and generate a printing button; The print page generation module is used to call a print rendering engine based on the print button, and after the print rendering engine combines the data to be printed obtained based on the metadata interface and the custom interface with the print template, render a print page corresponding to the print template.
9. An electronic device, characterized in that: including memory and processor; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, the steps in the form engine-based printing template generation method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the form engine-based printing template generation method as described in any one of claims 1-7.