Plug-in-free document table printing processing method and device
By generating PDF files on the server and printing using browser native functions, the complexity and security problems caused by plug-in dependence in the existing technology are solved, and efficient, stable and compatible document form printing without plug-ins is achieved, which is suitable for complex application scenarios of enterprise-level systems.
Patent Information
- Application Number
- CN202510759370.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-09
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2045-06-09
AI Technical Summary
In the prior art, the printing of business documents or table files depends on the printing plug-ins installed by the client, resulting in complex operations, high resource utilization, high security risks, and limited compatibility, and lack of efficient and stable printing solutions without plug-ins.
Generate PDF files on the server and convert them to file stream format. Printing is completed through the browser's native PDF preview and printing functions. It supports text adaptive layout and multiple table row types. It combines with the visual printing template design interface to realize plug-in-free document table printing.
It realizes high compatibility, high security and efficient document form printing without installing plug-ins, supports intelligent paging and data-driven batch printing in complex formats, improving user experience and system stability.
Smart Images

Figure CN120276691A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a printing method, and more particularly, to a plug - in - free method and device for processing the printing of document forms. Background Art
[0002] In existing information systems, users often need to print various business documents or form data to meet the needs of archiving, approval, or circulation. Currently, the printing of business document or form - type files usually relies on printing plugins installed on the client side to complete. Such printing plugins are generally installed on user terminals as browser extensions or stand - alone software to support the printing output and preview control of complex formats.
[0003] However, this approach has many problems. First, plugins usually require users to manually install and configure, increasing the operation complexity. Second, plugins consume system resources during operation, which may affect the performance of the terminal. In addition, plugins are prone to becoming an entry point for security vulnerabilities, especially when the source is unknown or the update is lagging behind, the risk is even higher. At the same time, the compatibility of plugins is limited, and they may not run properly between different operating systems or browser versions. And plugins need to be updated and maintained regularly, increasing the user management burden.
[0004] Therefore, the prior art lacks a technical solution that does not rely on client - side printing plugins and can stably and efficiently implement the printing of document forms. Summary of the Invention
[0005] In order to solve at least one of the above - mentioned technical problems in the background art, the present invention proposes a plug - in - free method and device for processing the printing of document forms.
[0006] To achieve the above object, according to one aspect of the present invention, there is provided a plug - in - free method for processing the printing of document forms. The method is applied to a server, and the method includes:
[0007] When receiving a printing request sent by a Web front - end, generating a corresponding PDF file according to the printing request. The printing request includes: a printing template identifier and a data resource identifier. Among them, during the process of generating the PDF file, parsing the settings of the table row type from the printing template design information corresponding to the printing template identifier, and then controlling the pagination presentation mode of various table rows in the generated PDF file according to the settings of the table row type, and performing typesetting processing on the text content in the cell based on a preset text adaptive layout algorithm. The table row types include: single - page printing, per - page printing, floating row, per - page end - row printing, and last - page printing;
[0008] Convert the PDF file into a file stream format and return it to the Web front end, so that the Web front end can perform print preview on the PDF file through the native PDF preview function of the browser and complete the printing of the PDF file through the native printing function of the browser.
[0009] Optionally, the step of converting the PDF file into a file stream format and returning it to the Web front end, so that the Web front end can perform print preview on the PDF file through the native PDF preview function of the browser and complete the printing of the PDF file through the native printing function of the browser, includes:
[0010] Return the file stream of the PDF file and a print policy identifier to the Web front end, so that the Web front end can perform print preview and printing according to the corresponding policy based on the print policy identifier. Among them, the print policy identifier includes: a first identifier for indicating the use of the native PDF preview and printing functions of the browser and a second identifier for indicating the use of WebAssembly for PDF rendering and preview and the native printing function of the browser for printing; when the print policy identifier is the first identifier, the Web front end performs print preview on the PDF file through the native PDF preview function of the browser and completes the printing of the PDF file through the native printing function of the browser; when the print policy identifier is the second identifier, the Web front end loads a PDF rendering module based on WebAssembly technology. The PDF rendering module is used to parse the file stream of the PDF file and render the decoded PDF content into a Canvas element or a DOM container in the browser for preview, and complete the printing through the native printing function of the browser.
[0011] Optionally, the plugin-free bill form printing processing method further includes:
[0012] Obtain the front-end running environment metric data collected by the Web front end. Among them, the front-end running environment metric data includes: network latency, downstream bandwidth, browser type, browser version, network type, memory size, and the number of current user queued printing tasks;
[0013] Determine a print policy and generate the print policy identifier according to the front-end running environment metric data and a preset print policy prediction model. The print policy prediction model is obtained by training a classification model based on training samples.
[0014] Optionally, the step of performing typesetting processing on the text content in the cell based on a preset text adaptive layout algorithm includes:
[0015] When automatic line height is not enabled, according to the column width of the cell and the set fixed line height, text wrapping typesetting is preferentially performed on the text. If the text still cannot be fully displayed after wrapping, the font size is automatically reduced by decreasing the font size until the text is fully displayed;
[0016] When automatic line height is enabled, the text content is wrapped according to the column width, and the line height of the cell is dynamically calculated based on the number of lines after wrapping and the line spacing. The final height of each line takes the line height of the tallest cell in the line as the reference line height.
[0017] Optionally, generating the corresponding PDF file according to the printing request includes:
[0018] During the process of generating the PDF file, parse the calculation formula bound to the cell from the printing template design information corresponding to the printing template identifier, and execute the calculation formula, filling the calculation result of the formula to the corresponding cell position to generate PDF content containing the calculation result of the formula.
[0019] Optionally, generating the corresponding PDF file according to the printing request includes:
[0020] During the process of generating the PDF file, parse the configuration content of the extended table component from the printing template design information corresponding to the printing template identifier, and perform structured processing on the approval process track data based on the configuration content, rendering the approval node information to the corresponding cell of the table component. The configuration content includes the bound approval process track field and the signature field, and the signature field is bound to the floating row area of the table for displaying the electronic signature image of the operator of each approval node in the PDF file to fully present the approval process and signing information.
[0021] Optionally, when the Web front-end receives the file stream of the PDF file, it dynamically generates an iframe tag in the browser page and embeds the file stream into the iframe tag for loading to call the native PDF preview function of the browser to complete the print preview of the PDF file.
[0022] Optionally, the plug-in-free bill table printing processing method further includes:
[0023] Display a preset visual printing template design interface to the user through the Web front-end, and then convert the printing template designed by the user on the visual printing template design interface into structured printing template design information, and generate a printing template identifier corresponding to the printing template design information.
[0024] Optionally, the functions implemented by the visual printing template design interface include: supporting the user to layout various component elements in a drag-and-drop manner through a graphical interface, where the component elements include: form components, table components, and picture components; supporting the configuration of various form design parameters, where the form design parameters include: row height, column width, background color, border, alignment, and font style; supporting the setting of cells and binding cells to business fields or calculation formulas executed by the server; supporting connecting the table component to an extended data set to meet the personalized printing requirements of table data; supporting the setting of the table row type in the table component, where the table row type is used to control the pagination presentation method of different table rows during printing, and the table row type includes: single print, print per page, floating row, print at the end of each page, and print on the last page; supporting the configuration of the table component to display approval process track data, and supporting binding approval node fields and signature fields to corresponding cells, where the signature field is bound to the floating row area to display the electronic signature image of the approval node operator during printing to fully display the approval process and signing information.
[0025] To achieve the above object, according to another aspect of the present invention, there is provided a plug-in-free document table printing processing device, which is applied to the server, and the device includes:
[0026] A PDF file generation unit, configured to generate a corresponding PDF file when receiving a printing request sent by the Web front end, where the printing request includes: a printing template identifier and a data resource identifier. During the process of generating the PDF file, the setting of the table row type is parsed from the printing template design information corresponding to the printing template identifier, and then the pagination presentation method of various table rows in the generated PDF file is controlled according to the setting of the table row type, and the text content in the cell is typeset based on a preset text adaptive layout algorithm. The table row type includes: single print, print per page, floating row, print at the end of each page, and print on the last page;
[0027] A file stream sending unit, configured to convert the PDF file into a file stream format and return it to the Web front end, so that the Web front end can perform a print preview of the PDF file through the native PDF preview function of the browser and complete the printing of the PDF file through the native printing function of the browser.
[0028] To achieve the above object, according to another aspect of the present invention, there is also provided a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the steps of the above plug-in-free document table printing processing method are implemented.
[0029] To achieve the above object, according to another aspect of the present invention, there is also provided a computer-readable storage medium, on which a computer program / instructions are stored, and when the computer program / instructions are executed by a processor, the steps of the above-mentioned plug-in-free document form printing processing method are implemented.
[0030] To achieve the above object, according to another aspect of the present invention, there is also provided a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the above-mentioned plug-in-free document form printing processing method are implemented.
[0031] The beneficial effects of the present invention are as follows:
[0032] In the present invention, by receiving a printing request sent by a Web front-end at the server side and generating a corresponding PDF file, unified rendering and format control of business printing content can be achieved. The generated PDF file is converted into a file stream format and returned to the Web front-end. The Web front-end running in the browser environment calls the native PDF preview function of the browser to display the PDF file, and uses the built-in printing function of the browser to complete the printing operation. The above processing process of the present invention does not rely on any client plug-ins, avoiding problems in aspects such as plug-in installation, compatibility, and security, and realizing a plug-in-free, highly compatible, simply deployable, and highly secure document form printing method. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. In the drawings:
[0034] Figure 1 is a flowchart of the plug-in-free document form printing processing method according to an embodiment of the present invention;
[0035] Figure 2 is a flowchart of typesetting the text content in a cell according to an embodiment of the present invention;
[0036] Figure 3 is a schematic diagram of an application scenario of the present invention;
[0037] Figure 4 is a schematic diagram of the plug-in-free printing process of the present invention;
[0038] Figure 5 is a block diagram of the structure of the plug-in-free document form printing processing device according to an embodiment of the present invention;
[0039] Figure 6 It is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed implementation manners
[0040] In order to enable those skilled in the art of the present technology to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0041] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0042] It should be noted that the terms "including" and "having" and any variations thereof in the description and claims of the present invention and the above-mentioned accompanying drawings are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device including a series of steps or units does not necessarily have to be limited to those clearly listed steps or units, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0043] It should be noted that, without conflict, the embodiments in the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
[0044] The present invention aims to provide a bill form printing and processing method without plugins, with high compatibility and high flexibility, to achieve the following purposes:
[0045] 1. Eliminate plugin dependencies and enhance security and compatibility:
[0046] Overcome the dependencies on plugins such as ActiveX and NPAPI in traditional printing solutions, and avoid deployment difficulties caused by plugin installation, permission management, and version compatibility. Solve the security risks brought by plugins (such as CVE vulnerabilities, malicious code injection), and meet the security requirements of the zero trust architecture (ZTA).
[0047] 2. Support intelligent paging and complex form printing:
[0048] Break through the limitations of the browser's native printing (window.print) in paginating large data volume tables, and implement dynamic pagination logic (such as avoiding line breaks across pages, repeating table headers, and customizing pagination rules). Solve the problem of style disorder caused by incomplete support for CSS print media queries (@page, page-break-inside), and ensure that the pagination accuracy reaches more than 99.9%.
[0049] 3. Implement efficient batch printing driven by data:
[0050] Provide a templated printing interface that supports JSON data binding, avoid manual DOM operations, and can process more than 100,000 lines of data at a time (the measured memory occupancy is <500MB).
[0051] The present invention provides a plug-in-free bill table printing system, such as Figure 3 shown, the plug-in-free bill table printing system of the present invention includes: a server and a Web front-end, and the Web front-end is set to run in a browser.
[0052] The server is used to receive a printing request from the Web front-end, parse the printing template design information, generate a corresponding PDF file in combination with business data, and return the PDF file in the form of a file stream to the Web front-end. The server can be a back-end service system deployed on a cloud server, a local server, or an enterprise internal network, and can be composed of a Web application server, a PDF generation module, a template parsing engine, and a data processing component.
[0053] The Web front-end is set in the user's browser, responsible for initiating a printing request and carrying a printing template identifier and a data resource identifier. After receiving the PDF file stream returned by the server, it dynamically generates an iframe tag in the browser page and embeds the PDF file therein for display to achieve a print preview. The Web front-end can also provide a visual printing template design interface for users to customize printing templates. In an embodiment of the present invention, the Web front-end can be built based on HTML5 and Canvas technologies.
[0054] The browser is used to host and run the Web front-end, and provide native PDF preview and printing functions. Without installing any plug-ins, the browser can call the built-in rendering and printing modules of the system to perform preview display and printing operations on the PDF file. The browser can be Chrome, Edge, Firefox, Safari, etc.
[0055] Figure 4 is a schematic diagram of the process of plug-in-free printing of the present invention, such as Figure 4As shown, in an embodiment of the present invention, the process of plugin-free printing of the present invention may be as follows: After the user initiates a printing request on the front-end interface (i.e., the Web front-end), the request is sent to the server. The server first parses the printing template design information corresponding to the printing template identifier and the data resource identifier carried in the request, then generates a corresponding PDF file through a PDF generator, and then converts the PDF content into a PDF file stream and sends it to the browser side. After receiving the file stream, the browser uses the iframe embedding method for native PDF preview, and the user can perform printing operations through the printing API provided by the browser. The entire process can achieve structured and standardized printing output without installing any plugins.
[0056] It should be noted that the plugin-free bill form printing processing method in the following embodiments of the present invention is applied to the server, that is, the implementation entity of the plugin-free bill form printing processing method in the following embodiments of the present invention is the server.
[0057] Figure 1 is the flowchart of the plugin-free bill form printing processing method in an embodiment of the present invention, as Figure 1 As shown, in an embodiment of the present invention, the plugin-free bill form printing processing method of the present invention includes step S101 and step S102.
[0058] Step S101, when receiving a printing request sent by the Web front-end, generate a corresponding PDF file according to the printing request, where the printing request includes: a printing template identifier and a data resource identifier.
[0059] In the present invention, during the process of generating the PDF file, the setting of the table row type is parsed from the printing template design information corresponding to the printing template identifier, and then the pagination presentation method of various table rows in the generated PDF file is controlled according to the setting of the table row type, and the text content in the cell is typeset based on a preset text adaptive layout algorithm. The table row types include: single-page printing, per-page printing, floating row, per-page end-row printing, and last-page printing.
[0060] In the present invention, the printing template identifier is used to identify the printing template design information, and the printing template identifier corresponds one-to-one with the printing template design information. The server can obtain the corresponding specific printing template design information according to the printing template identifier. The data resource identifier is used to identify the specific data filled into the printing template. For example, in a bill system, the data resource identifier may refer to a bill number.
[0061] In the present invention, the printing request is initiated by the Web front-end and includes a printing template identifier and a data resource identifier. The printing template identifier corresponds one-to-one with the printing template design information, and the printing template design information can be structured data (such as in JSON format), which records information such as the layout structure of the document form, style settings, bound fields, and pagination control. After receiving this request, the server parses and extracts the layout information according to the printing template design information corresponding to the printing template identifier, and thus generates a standardized PDF file in combination with the background business data determined according to the data resource identifier. This process is completed centrally on the server, ensuring the unity of the output format and the consistency of the logic, and avoiding printing problems caused by front-end layout deviation or browser differences.
[0062] In an embodiment of the present invention, the printing template design information is specifically generated after the Web front-end displays a preset visual printing template design interface to the user, and the user designs the printing template through graphical operations on this interface, and the server converts the designed printing template into structured template description data. The present invention also generates a printing template identifier corresponding to the printing template design information. The printing template design information can be stored on the server.
[0063] In an embodiment of the present invention, the server can implement the rendering and output of the printing content based on existing PDF generation components. For example, open-source or commercial PDF processing libraries such as iText and PDFBox can be used to generate the corresponding PDF file.
[0064] Step S102, convert the PDF file into a file stream format and return it to the Web front-end, so that the Web front-end can perform a print preview of the PDF file through the native PDF preview function of the browser and complete the printing of the PDF file through the native printing function of the browser.
[0065] In the present invention, after the PDF file is generated, it is converted by the server into a standard file stream format (such as Blob data based on an HTTP response) and returned to the Web front-end. After receiving the file stream, the front-end dynamically creates an iframe element in the browser page and embeds the PDF file therein for display. Since browsers generally have a built-in PDF rendering module, the native preview and printing capabilities of the browser can be directly called without installing any plugins or external dependent software. This solution simplifies the user operation process, improves system compatibility and security, and is particularly suitable for business system environments that require batch deployment and cross-platform use.
[0066] In an embodiment of the present invention, when the Web front-end receives the file stream of the PDF file, it dynamically generates an iframe tag in the browser page and embeds the file stream into the iframe tag for loading, so as to call the native PDF preview function of the browser to complete the print preview of the PDF file.
[0067] In the present invention, the parsing of the print template and the generation of the PDF file are completed on the server side, and the generated PDF file is returned to the Web front-end in the form of a file stream. The front-end displays and outputs the file based on the native PDF preview and printing functions of the browser. Throughout the process, there is no need to rely on any client plug-ins, such as ActiveX controls, PDF extension components, or independent printing software, fundamentally avoiding the compatibility, security, and maintenance cost problems brought by plug-in installation, and realizing true plug-in-free printing.
[0068] In an embodiment of the present invention, the plug-in-free document form printing processing method of the present invention further includes:
[0069] The Web front-end is used to display a preset visual print template design interface to the user, and then convert the print template designed by the user on the visual print template design interface into structured print template design information.
[0070] In an embodiment of the present invention, the visual print template design interface can be presented in a graphical manner, usually constructed based on HTML5 and Canvas technologies, and can run directly in the browser without installing plug-ins. The interface is preset with draggable control components (such as tables, forms, pictures, etc.). Users can intuitively complete the template layout and style settings through mouse operations, greatly improving the convenience and visual experience of template design. After the user completes the print template on the design interface, the system will automatically convert the content of the print template into structured print template design information. The print template design information usually adopts data formats such as JSON and includes information such as control types, layout information, style parameters, data binding fields, pagination rules, and signature fields. The print template identifier corresponding to the print template design information will be sent to the server as the core parameter of the print request to drive the unified generation of the PDF file, ensuring the consistency of the front-end and back-end print logics and the accuracy of typesetting.
[0071] In an embodiment of the present invention, the functions implemented by the visual print template design interface include:
[0072] 1. Support users to layout various component elements in a drag-and-drop manner through a graphical interface. The component elements include: form components, table components, and picture components;
[0073] 2. Support the configuration of various form design parameters, including: row height, column width, background color, border, alignment, and font style;
[0074] 3. Support the setting of cells and binding cells to business fields or calculation formulas executed by the server;
[0075] 4. Support connecting the table component to an extended data set to meet the personalized table data printing requirements;
[0076] 5. Support the setting of table row types in the table component. The table row types are used to control the paging presentation methods of different table rows during printing, including: single printing, per-page printing, floating row, per-page end-row printing, and last-page printing;
[0077] 6. Support configuring the table component to display approval process track data, and support binding approval node fields and signature fields to corresponding cells. Among them, the signature field is bound to the floating row area to display the electronic signature image of the approval node operator during printing, so as to fully display the approval process and signing information.
[0078] Regarding Function 1, in the present invention, users can freely layout component elements such as forms, tables, and pictures in the template area in a drag-and-drop manner through the visual printing template design interface provided by the Web front-end, and complete the construction of the template structure without writing code. This method reduces the technical threshold and improves the template design efficiency, and is suitable for the personalized document design requirements of various business scenarios.
[0079] Regarding Function 2, in the present invention, users can perform refined style configuration on the table component through the visual interface, including setting parameters such as the size, color, border style, font thickness, and position alignment of each row and column to meet professional typesetting requirements. This configuration item allows users to control the aesthetics and readability of printing.
[0080] Regarding Function 3, in the present invention, during the template design process, users can set each cell of the table one by one, and support setting merging, font size, type, color, italic, margin, background color, etc. In the present invention, users can bind cells to specific business data fields, such as customer name, order number, amount, etc. At the same time, calculation formulas that can be parsed by the server can also be configured to generate dynamic data such as automatic summation and formatted amount, meeting the data expression requirements in complex scenarios.
[0081] For Function 4, in the present invention, the user is allowed to connect a table component to an extended data set in a business system, such as a detail table, a sub-table, or a nested structure, to achieve structured printing of batch data. Through this function, the user can flexibly embed multi-line and multi-page data content in a print template to meet the needs of personalized and high-density data printing. Typical applications include payment detail tables, order item lists, etc.
[0082] For Function 5, in the present invention, the user can configure the paging behavior for each type of table row according to business requirements. For example, the table header can be set to print on each page, the detail data can be set as floating rows, the subtotal row can be set to print at the end of each page, and the total row can be set to print on the last page. The system supports differential rendering and paging control for these row types to achieve intelligent paging and precise typesetting, which is especially suitable for complex document scenarios that require paging statistics or large data printing.
[0083] For Function 6, in the present invention, an extended query table control is built into the visual print template design interface to support structured printing of approval tracks. The user can bind fields such as node names, approval times, and approvers in the approval process to table rows and columns through the interface, and at the same time drag and drop the electronic signature field to a floating row cell. The server will dynamically render the signature image when generating a PDF to ensure the integrity and legal evidentiary force of the approval process. This function is widely applicable to business process printing requirements such as contract approval and expense reimbursement.
[0084] In an embodiment of the present invention, generating a corresponding PDF file according to the print request in step S101 specifically includes:
[0085] Parsing the settings of the table row types from the print template design information corresponding to the print template identifier, and then controlling the paging presentation methods of various table rows in the generated PDF file according to the settings of the table row types. The table row types include: single print, print on each page, floating row, print at the end of each page, and print on the last page.
[0086] In an embodiment of the present invention, the present invention supports setting the table row types in the table component. The table row types are used to control the paging presentation methods of different table rows during printing, which is convenient for flexibly adjusting the table printing format to meet the needs of different scenarios.
[0087] In an embodiment of the present invention, the specific application scenarios of each table row type can be seen in Table 1 below:
[0088] Table 1
[0089]
[0090] In an embodiment of the present invention, the specific application of single print (table title) can be seen in Table 2 below:
[0091] Table 2
[0092]
[0093] In an embodiment of the present invention, the specific application of printing (header) per page can be seen in Table 3 below:
[0094] Table 3
[0095]
[0096] In an embodiment of the present invention, the specific application of floating rows (detail data) can be seen in Table 4 below:
[0097] Table 4
[0098]
[0099] In an embodiment of the present invention, the specific application of the last row per page (subtotal) can be seen in Table 5 below:
[0100] Table 5
[0101]
[0102] In an embodiment of the present invention, the specific application of printing at the end of the last page (total) can be seen in Table 6 below:
[0103] Table 6
[0104]
[0105] In an embodiment of the present invention, the combined application of each table row type can be seen in Table 7 below:
[0106] Table 7
[0107]
[0108] Based on the multiple table row type setting mechanisms provided by the present invention, users can flexibly configure different types of data rows in the printing template, such as single printing, printing per page, floating rows, printing of the last row per page, and printing at the end of the last page, etc., to achieve refined control of the table content during pagination. This mechanism enables the server to efficiently process the pagination and layout logic of a large volume of data when generating PDF, significantly reducing memory occupancy and rendering pressure, thereby supporting high-performance printing tasks with more than 100,000 rows of data processed at a time, meeting the stability and efficiency requirements of enterprise-level systems in large-scale data output scenarios.
[0109] In an embodiment of the present invention, generating a corresponding PDF file according to the printing request in step S101 specifically includes:
[0110] During the process of generating the PDF file, the text content in the cell is typeset based on a preset text adaptive layout algorithm.
[0111] As Figure 2 shown, in an embodiment of the present invention, the typesetting process of the text content in the cell based on the preset text adaptive layout algorithm includes step S201 and step S202.
[0112] Step S201, when automatic row height is not enabled, according to the column width of the cell and the set fixed row height, the text is preferentially line-wrapped. If the text still cannot be completely displayed after line-wrapping, the font size is automatically reduced by decreasing the font size until the text is completely displayed.
[0113] Step S201, when automatic row height is enabled, the text content is line-wrapped according to the column width, and the row height of the cell is dynamically calculated based on the number of lines after line-wrapping and the line spacing. The final height of each row takes the row height of the highest cell in the current row as the reference row height.
[0114] In an embodiment of the present invention, in order to improve the typesetting accuracy and readability of the printed output content, during the process of generating the PDF file, the server adopts a text adaptive layout algorithm for dynamically typesetting the text content in the cell. This algorithm adapts different typesetting strategies according to whether automatic row height is enabled.
[0115] When automatic row height is not enabled, the text adaptive algorithm first performs a preliminary line-wrapping process on the text content according to the set column width and fixed row height of the cell, so that it can be displayed in multiple lines as much as possible within the set row height range. If there is still text that exceeds the cell boundary after line-wrapping, the system will gradually reduce the font size by automatically reducing the font size until the text content can be completely adapted to the cell range. This processing method ensures the integrity and visibility of the text under the constraint of a fixed height.
[0116] When automatic row height setting is enabled, the algorithm will perform a line-wrapping process on the text content according to the column width of the cell, and dynamically calculate the required cell height based on the number of lines after line-wrapping and the set line spacing. The system will compare the actual heights of all cells in the current row and take the highest cell row height as the final row height of the entire row, so as to ensure that the typesetting of each cell is aligned and avoid problems such as typesetting disorder or visual unevenness.
[0117] This text adaptive layout algorithm effectively balances the flexibility and content integrity of typesetting, and is especially suitable for printing scenarios where the length of table fields is uncertain and the content changes dynamically, which can significantly improve the typesetting quality of the output document.
[0118] In one embodiment of the present invention, generating a corresponding PDF file according to the printing request in step S101 specifically includes:
[0119] During the process of generating the PDF file, parse the calculation formula bound to the cell from the printing template design information corresponding to the printing template identifier, and execute the calculation formula to fill the formula calculation result into the corresponding cell position to generate PDF content containing the formula calculation result.
[0120] In the present invention, during the process of generating a PDF file, the server parses the calculation formula bound to the specified cell position from the printing template design information. The formula can include field operations, format conversions, conditional judgments, string concatenations, etc., supports standard functions and custom expressions, and can meet the needs of various business data calculations and conversions. After the server completes the formula parsing, it will execute the formula logic based on the business data corresponding to the current request to obtain the calculation result. The calculation process is uniformly processed on the server, which can avoid front-end errors and ensure the stability of the printing result and data accuracy. The executed calculation result will be dynamically filled into the corresponding template cell to form a visual actual value.
[0121] In one embodiment of the present invention, generating a corresponding PDF file according to the printing request in step S101 specifically includes:
[0122] During the process of generating the PDF file, parse the configuration content of the extended table component from the printing template design information corresponding to the printing template identifier, and perform structured processing on the approval process track data based on the configuration content, and render the approval node information to the corresponding cell of the table component, where the configuration content includes the bound approval process track field and the signature field, and the signature field is bound to the floating row area of the table for displaying the electronic signature image of the operator of each approval node in the PDF file to completely present the approval process and signing information.
[0123] In one embodiment of the present invention, to meet the requirement of displaying the complete approval process when the business document is printed and output, an extended table component is preset in the printing template design information, and this component supports binding fields related to the approval process track and electronic signature fields. During the process of generating a PDF file by the server, first parse the structure and field binding information of this component from the printing template design information corresponding to the printing template identifier, and then perform structured processing according to the configuration based on the process track data associated with the corresponding document number in the business system, and fill the information of each approval node (such as node name, approver, approval time, operation status, etc.) into the corresponding cell position in the table item by item.
[0124] For the signature field, the system supports binding it to the floating row area of the form, so that the electronic signature images of the signers at each approval node can correspond one by one with the node information and be accurately embedded in the printed page. In the finally generated PDF file, the approval process track is fully displayed in a structured table manner, and all signature images are automatically presented under the corresponding approval nodes, ensuring that the document has legal evidentiary force and complete traceability when printed and output.
[0125] In an embodiment of the present invention, step S102 specifically converts the PDF file into a file stream format and returns it to the Web front end, and the Web front end completes the print preview and print operation of the PDF file through the following steps:
[0126] (1) Receive the PDF file stream returned by the server and construct it into a Blob object recognizable by the browser for subsequent URL mapping;
[0127] (2) Call the URL.createObjectURL interface provided by the browser to generate a corresponding temporary access URL for the Blob object;
[0128] (3) Dynamically create an iframe tag in the current Web page and set the temporary URL as the src attribute of the iframe tag;
[0129] (4) Insert the iframe tag into the DOM structure of the current page, so that the browser automatically loads and displays the content of the PDF file through its built-in PDF rendering engine;
[0130] (5) The user completes the print operation of the PDF file through the print interface provided natively by the browser, and no additional plugins or third-party software need to be installed during the whole process.
[0131] In an alternative embodiment of the present invention, step S102 of converting the PDF file into a file stream format and returning it to the Web front end, so that the Web front end performs print preview on the PDF file through the native PDF preview function of the browser and completes the printing of the PDF file through the native printing function of the browser, specifically includes:
[0132] Return the file stream of the PDF file and the print policy identifier to the Web front end, so that the Web front end can perform print preview and printing according to the corresponding policy based on the print policy identifier. The print policy identifier includes: a first identifier for indicating to use the native PDF preview and printing functions of the browser, and a second identifier for indicating to use WebAssembly for PDF rendering and preview and the native printing function of the browser for printing. When the print policy identifier is the first identifier, the Web front end performs print preview on the PDF file through the native PDF preview function of the browser and completes the printing of the PDF file through the native printing function of the browser. When the print policy identifier is the second identifier, the Web front end loads a PDF rendering module based on WebAssembly technology. The PDF rendering module is used to parse the file stream of the PDF file, render the decoded PDF content into a Canvas element or a DOM container in the browser for preview, and complete the printing through the native printing function of the browser.
[0133] In an embodiment of the present invention, in order to adapt to different terminal operating environments and network conditions and improve the response ability and user experience of the system in a weak network environment or a large-scale concurrent printing scenario, after generating a PDF file on the server side, the present invention not only returns the file stream of the PDF file to the Web front end, but also returns a print policy identifier at the same time. The print policy identifier is used to indicate to the Web front end how to perform PDF preview and printing.
[0134] The print policy identifier may include the following two types: First identifier: used to indicate that the Web front end uses the native PDF preview and printing functions of the browser; Second identifier: used to indicate that the Web front end enables a PDF rendering module based on WebAssembly technology to decode and preview the PDF file and perform print output through the native printing function of the browser.
[0135] In a specific implementation, when the print policy identifier is the first identifier, the Web front end processes the received PDF file stream into a Blob object and previews and displays the PDF content through the built-in PDF preview function of the browser. Subsequently, the user can directly click the built-in print button in the browser to complete the printing.
[0136] When the printing policy identifier is the second identifier, the Web front-end loads a pre-set PDF rendering module built based on WebAssembly technology. This module can be built based on open-source projects (such as the WASM version of pdf.js) and has the ability to parse, decode, and render PDF content page by page in a browser. The rendering module receives the PDF file stream data (such as in ArrayBuffer format) returned by the server, and after decoding, draws the content of each page of the PDF in the Canvas element or HTML DOM container on the front-end page. The rendered content supports user interaction operations such as page number jumping, zooming, and dragging. When printing, the user can directly use the web printing function of the browser (such as calling window.print()) to print the rendered view on the current page.
[0137] In a preferred embodiment, the PDF rendering module can also automatically adapt typesetting information such as paper size and margin settings according to the rendered Canvas area to ensure that the final printing effect is consistent with the original PDF content and avoid problems such as content cropping or scale distortion.
[0138] Through this implementation, the system can select the optimal PDF preview and printing path according to different environmental conditions, not only improving the overall processing performance but also reducing the server resource consumption. It has good scalability and practicality, and is especially suitable for complex application scenarios such as batch document output.
[0139] In an embodiment of the present invention, the plug-in-free bill form printing processing method of the present invention further includes:
[0140] Obtain the front-end running environment metric data collected by the Web front-end, where the front-end running environment metric data includes: network latency, downstream bandwidth, browser type, browser version, network type, memory size, and the number of current user queued printing tasks;
[0141] Determine the printing policy and generate the printing policy identifier according to the front-end running environment metric data and a pre-set printing policy prediction model, where the printing policy prediction model is obtained by training a classification model using training samples.
[0142] In an embodiment of the present invention, to dynamically select the printing policy according to the running environment and thus improve the adaptability of the system under different terminal and network conditions, the plug-in-free bill form printing processing method of the present invention further includes the following steps:
[0143] First, before the Web front-end initiates a printing request, it executes the running environment metric collection module to monitor and collect the key running parameters of the current terminal, forming a set of running environment metric data. Specifically, the running environment metric data may include, but is not limited to, the following information: network latency, downstream bandwidth, network type, browser type and version, memory capacity, the number of current user queued printing tasks, and the number of CPU cores.
[0144] After the above environment metrics are collected, the front-end sends the metric data to the server in a structured format (such as JSON) as the input feature for policy determination. After receiving the front-end metric data, the server calls a preset printing policy prediction model to classify and judge the current environment and generate a printing policy identifier.
[0145] In an embodiment of the present invention, the printing policy prediction model can be constructed based on a supervised learning method, and the model can adopt classification models such as decision trees, random forests, logistic regression, support vector machines (SVMs), or lightweight neural networks.
[0146] In an embodiment of the present invention, the process of model training includes the following steps:
[0147] 1. Data collection and sample construction: In the initial stage of actual system deployment, collect the running environment metrics of multiple terminal users under different network environments, device configurations, and printing task densities, as well as the policy methods adopted by users to successfully complete printing, to form a labeled training sample set.
[0148] 2. Feature engineering: Perform standardization, normalization, or One-hot encoding processing on the original metric data. For example, encode categorical data such as browser type to improve the discriminative ability of the model.
[0149] 3. Model training: Based on the training samples, select a suitable classification algorithm for training. For example, if the model pursues interpretability, the CART decision tree can be used; if high accuracy is pursued, a random forest or neural network model can be used.
[0150] 4. Model verification and tuning: Use cross-validation or the holdout method to evaluate the model accuracy, adjust unreasonable features or overfitting phenomena, and tune the model parameters (such as tree depth, learning rate).
[0151] 5. Deployment and online update: The trained model is deployed on the server as an interface for providing policy prediction services. During actual operation, the system can continuously collect user operation feedback data for model retraining and performance update.
[0152] Through the above mechanism for predicting the printing strategy based on the running environment, the system can implement on-demand selection of rendering methods, reduce the server pressure, improve the printing efficiency and experience of end users, and is particularly suitable for mobile printing or high-concurrency business systems in a weak network environment. The strategy prediction of the present invention has an intelligent judgment ability and has better effects than static configuration rules or fixed judgment conditions.
[0153] In an alternative embodiment of the present invention, in the above step S102, when the printing strategy identifier is the second identifier, the Web front end can load and run a PDF rendering module based on WebAssembly technology. The PDF rendering module is used to parse the compressed PDF data stream returned by the server, and render the decoded PDF content into the Canvas element or DOM container in the browser, and complete printing through the native printing function of the browser. Among them, the rendering process supports operations such as page number jumping, zooming, and dragging.
[0154] In an alternative embodiment of the present invention, to further improve the response efficiency of the system in large-scale concurrent printing or weak network environments, the plugin-free bill form printing processing method of the present invention can also introduce a client PDF rendering module based on WebAssembly for loading, decoding, and displaying the original PDF content returned by the server on the browser side.
[0155] The specific implementation steps are as follows:
[0156] 1. The server generates a compressed PDF data stream: After receiving the printing request sent by the Web front end, the server generates a standard PDF file. In this embodiment, the server can use tools such as iText and PDFBox to compress the generated PDF content and convert it into a lightweight binary data stream (such as Uint8Array or ArrayBuffer format), and return it to the front end in a response manner.
[0157] 2. The front end loads the WebAssembly PDF rendering module: The Web front end page pre-loads a PDF rendering module. The PDF rendering module is built based on WebAssembly technology, for example, using the open-source project [pdf.js + wasm compilation module], and has the ability to decode and render PDF files in the browser. This module combines JavaScript with HTML5 Canvas to directly draw the PDF content into the Canvas element or DOM container on the page.
[0158] 3. Local rendering and preview using WebAssembly: After the front end receives the PDF data stream returned by the server, it uses JavaScript to transfer it to the WebAssembly module for parsing and decoding. The module renders the content page by page according to the pagination structure, supporting basic operations such as page number jumping, zooming, and dragging, to achieve high-performance PDF preview without plugins. Compared with the iframe loading method, WebAssembly rendering can provide more flexible control capabilities, such as preloading a certain page and loading on demand.
[0159] 4. Integration of browser native printing function: After rendering is completed, the user can print the current rendered view through the print button provided by the browser. To achieve accurate output, the system can automatically adjust the rendered view to the standard size and disable non-printable areas before printing, so as to ensure that the page layout is consistent with the PDF file.
[0160] In the embodiment of the present invention, by moving part of the PDF rendering operations to the Web front end, the CPU and memory loads of the server are significantly reduced, and it has good scalability especially in the scenarios of multi-user concurrent printing or large document loading; in addition, the front-end rendering realizes loading and displaying simultaneously, reducing the waiting time and improving the user interaction experience. This method is also applicable to the offline printing scenario in an unstable network environment, and the rendering module can be used in combination with the cached PDF data.
[0161] The following further illustrates the solution of the present invention in combination with a specific embodiment of salary business bill printing.
[0162] In an embodiment of the present invention, for the typical salary business bill printing scenario, the present invention adopts a plugin-free method for printing and processing bill forms, and realizes a complete printing process including template visual design, complex table typesetting, pagination statistics, subtotal and total processing, and display of approval process signatures.
[0163] The salary bill form includes three core information modules: basic bill information (such as bill number, filler, filling date), payment details (such as payee name, amount composition), and approval records (such as approver, signed opinion, signature). To ensure the standardization and integrity of the print output, the system supports designing a dedicated print template through a visual method. The user can freely layout components such as tables, forms, and pictures in the Web front-end interface by dragging and dropping to construct a personalized print style.
[0164] Among them, the table component supports setting various table style parameters such as row height, column width, background color, font style, border, alignment, etc., and supports cell merging and fine style configuration. Each cell can also be bound to specific business fields or set calculation formulas executable on the server side to achieve dynamic data filling and format conversion. The system further supports configuring extended data sets for displaying detailed list data and allows users to divide the printing logic by row type, including single printing, per-page printing, floating rows, per-page footer row printing, and last-page printing, to achieve paging control of complex-structured data.
[0165] In the display of payment details, the detailed data can be set to be displayed as floating rows, and a subtotal formula (such as PrintTablePageSum(...)) can be configured at the end of each page to automatically output the statistical results of the current page; at the same time, a total row is appended to the last page to display the overall summary results. This mechanism effectively solves problems such as statistical interruption and information omission in paged printing, and significantly improves the readability and business adaptability of printed documents.
[0166] In the display part of the approval process, the system provides an extended query table control that supports binding approval node data and signature fields. Users can drag and bind approval node fields (such as approver, approval time, operation status) to the table and bind the electronic signature field to the floating row area. When generating a PDF, the system will automatically display the approval process data in a structured manner and render the signature image of the operator to the corresponding position to achieve a visual presentation of process compliance and legal effect.
[0167] After the user completes the template design, they can click the print preview button to trigger the printing process. The Web front-end submits the identification information of the designed template to the server side. The server side generates a corresponding PDF file based on the printing template design information corresponding to the printing template identification and the data resource identification, and returns it to the front-end in the form of a file stream. The front-end dynamically creates an iframe tag to embed the PDF file by constructing a Blob object and generating a temporary URL, and uses the native PDF rendering ability of the browser to achieve print preview. Finally, the end user can complete the printing operation through the browser's printing function. The whole process does not rely on any plug-ins or additional extension components, and has good compatibility, security, and user experience.
[0168] It can be seen from the above embodiments that the plug-in-free document table printing processing method of the present invention at least achieves the following beneficial effects:
[0169] 1. Improve security: The present invention adopts a plug-in-free printing solution, and the entire printing process is completed under the control of the browser's native functions and the server side, avoiding security vulnerabilities introduced by installing ActiveX controls, third-party plug-ins, etc. in traditional printing solutions, thereby effectively reducing the system security risk and improving the credibility and operation and maintenance efficiency of the overall system.
[0170] 2. Improve user experience: Through the visual printing template design interface provided by the Web front-end, users can quickly construct the required printing templates by dragging and dropping. What you see is what you get. Without having to master complex typesetting languages or configuration logics, users can complete the design of personalized printing styles and achieve one-key printing, significantly improving the usability and interaction experience.
[0171] 3. Enhance flexibility: The present invention supports setting multiple table row types (such as single-page printing, per-page printing, floating rows, etc.) in the template, achieving fine control over the pagination logic, adapting to the requirements of data pagination display in different business scenarios, and meeting the different users' differentiated requirements in terms of format control.
[0172] 4. Improve compatibility: The Web front-end interface of the present invention is built based on HTML5 and Canvas technologies. Without relying on any specific browser plug-ins or operating system components, it can run stably in various mainstream browsers and cross-platform environments, effectively improving the system's compatibility and deployable scope.
[0173] 5. Flexible expansion and personalized customization: The printing controls in the system support modular design. Users can freely combine and configure functional components such as forms, tables, and signatures according to actual business needs; at the same time, it supports binding with business fields, formulas, or extended data sets, realizing highly customized data printing capabilities, and having good scalability and maintainability.
[0174] 6. Suitable for complex and enterprise-level scenarios: The present invention centrally processes the printing logic on the server side to achieve unified typesetting rendering and PDF output, ensuring the stability and professionalism of the printing results; it is particularly suitable for complex application scenarios such as processing diverse templates, fusing multiple data sources, and printing large volumes of data in enterprise-level systems.
[0175] It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0176] Based on the same inventive concept, an embodiment of the present invention further provides a plug-in-free document form printing processing device, which can be used to implement the plug-in-free document form printing processing method described in the above embodiments, as described in the following embodiments. Since the principle of the plug-in-free document form printing processing device for solving problems is similar to that of the plug-in-free document form printing processing method, the embodiments of the plug-in-free document form printing processing device can refer to the embodiments of the plug-in-free document form printing processing method, and the repeated parts will not be described again. As used hereinafter, the term "unit" or "module" may be a combination of software and / or hardware that can achieve a predetermined function. Although the device described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0177] It should be noted that the plug-in-free document form printing processing device of the present invention is applied to the server side, that is, the plug-in-free document form printing processing device of the present invention is set in the server side.
[0178] Figure 5 is the structural block diagram of the plug-in-free document form printing processing device according to the embodiment of the present invention, as Figure 5 shown, in an embodiment of the present invention, the plug-in-free document form printing processing device of the present invention includes:
[0179] A PDF file generation unit 1, configured to generate a corresponding PDF file according to the print request when receiving the print request sent by the Web front end, where the print request includes: a print template identifier and a data resource identifier. Among them, in the process of generating the PDF file, the setting of the table row type is parsed from the print template design information corresponding to the print template identifier, and then the pagination presentation method of various table rows in the generated PDF file is controlled according to the setting of the table row type, and the text content in the cell is typeset based on a preset text adaptive layout algorithm. The table row types include: single print, per-page print, floating row, per-page end row print, and last-page print;
[0180] A file stream sending unit 2, configured to convert the PDF file into a file stream format and return it to the Web front end, so that the Web front end can perform print preview on the PDF file through the native PDF preview function of the browser, and complete the printing of the PDF file through the native printing function of the browser.
[0181] In an embodiment of the present invention, the file stream sending unit 2 is specifically configured to: return the file stream of the PDF file and the print policy identifier to the Web front end, so that the Web front end uses the corresponding policy for print preview and printing according to the print policy identifier, where the print policy identifier includes: a first identifier for indicating the use of the native PDF preview and printing function of the browser and a second identifier for indicating the use of WebAssembly for PDF rendering and preview and the native printing function of the browser for printing; when the print policy identifier is the first identifier, the Web front end performs a print preview of the PDF file through the native PDF preview function of the browser and completes the printing of the PDF file through the native printing function of the browser; when the print policy identifier is the second identifier, the Web front end loads a PDF rendering module based on WebAssembly technology, and the PDF rendering module is used to parse the file stream of the PDF file and render the decoded PDF content into a Canvas element or a DOM container in the browser for preview, and completes the printing through the native printing function of the browser.
[0182] In an embodiment of the present invention, the plug-in-free document form printing processing device further includes:
[0183] a front-end running environment index data acquisition unit, configured to acquire front-end running environment index data collected by the Web front end, where the front-end running environment index data includes: network latency, downstream bandwidth, browser type, browser version, network type, memory size, and the number of current user queued printing tasks;
[0184] a print policy identifier generation unit, configured to determine a print policy and generate the print policy identifier according to the front-end running environment index data and a preset print policy prediction model, where the print policy prediction model is obtained by training a classification model according to training samples.
[0185] In an embodiment of the present invention, the PDF file generation unit 1 includes:
[0186] a first processing module, configured to, when automatic line height is not enabled, perform line wrapping on the text preferentially according to the column width of the cell and the set fixed line height, and if the text still cannot be completely displayed after line wrapping, automatically reduce the font size by decreasing the font size until the text is completely displayed; when automatic line height is enabled, perform line wrapping on the text content according to the column width, and dynamically calculate the line height of the cell according to the number of lines after line wrapping and the line spacing, and the final height of each line takes the line height of the highest cell in the line as the reference line height.
[0187] In an embodiment of the present invention, the PDF file generation unit 1 includes:
[0188] A second processing module, configured to, during the process of generating the PDF file, parse calculation formulas bound to cells from the print template design information corresponding to the print template identifier, execute the calculation formulas, and fill the formula calculation results to the corresponding cell positions, so as to generate PDF content containing the formula calculation results.
[0189] In an embodiment of the present invention, the PDF file generation unit 1 includes:
[0190] A third processing module, configured to, during the process of generating the PDF file, parse the configuration content of the extended table component from the print template design information corresponding to the print template identifier, perform structured processing on the approval process track data based on the configuration content, and render the approval node information to the cells corresponding to the table component, where the configuration content includes bound approval process track fields and signature fields, and the signature fields are bound to the floating row area of the table for displaying the electronic signature images of the operators of each approval node in the PDF file, so as to completely present the approval process and signing information.
[0191] In an embodiment of the present invention, when receiving the file stream of the PDF file, the Web front end dynamically generates an iframe tag in the browser page, embeds the file stream into the iframe tag for loading, so as to call the native PDF preview function of the browser to complete the print preview of the PDF file.
[0192] In an embodiment of the present invention, the plug - in - free document form printing processing device of the present invention further includes:
[0193] A visual print template design interface display unit, configured to display a preset visual print template design interface to the user through the Web front end, and then convert the print template designed by the user on the visual print template design interface into structured print template design information, and generate a print template identifier corresponding to the print template design information.
[0194] In an embodiment of the present invention, the functions implemented by the visual print template design interface include:
[0195] Supporting the user to layout various component elements in a drag - and - drop manner through a graphical interface, where the component elements include: form components, table components, and picture components;
[0196] Supporting the configuration of various table style design parameters, where the table style design parameters include: row height, column width, background color, border, alignment mode, and font style;
[0197] Supports setting cells and binding cells to business fields or calculation formulas executed by the server side;
[0198] Supports connecting the table component to an extended data set to meet personalized table data printing requirements;
[0199] Supports setting the table row types in the table component, where the table row types are used to control the pagination presentation methods of different table rows during printing, and the table row types include: single print, print per page, floating row, print at the end of each page, and print on the last page;
[0200] Supports configuring the table component to display approval process track data, and supports binding approval node fields and signature fields to corresponding cells, where the signature field is bound to the floating row area to display the electronic signature image of the approval node operator during printing to fully display the approval process and signing information.
[0201] To achieve the above object, according to another aspect of the present application, a computer device is further provided. As Figure 6 shown, the computer device includes a memory, a processor, a communication interface, and a communication bus. A computer program that can run on the processor is stored on the memory. When the processor executes the computer program, the steps in the method of the above embodiment are implemented.
[0202] The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. chips, or combinations of the above types of chips.
[0203] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs, non-transitory computer-executable programs, and units, such as the corresponding program units in the method embodiment of the present invention above. The processor executes various functional applications and data processing of works by running the non-transitory software programs, instructions, and modules stored in the memory, that is, the method in the above method embodiment is implemented.
[0204] The memory may include a program storage area and a data storage area. The program storage area may store an operating system and application programs required for at least one function. The data storage area may store data created by the processor and the like. In addition, the memory may include a high-speed random access memory, and may also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely provided with respect to the processor, and these remote memories may be connected to the processor through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0205] The one or more units are stored in the memory and, when executed by the processor, execute the method in the above embodiments.
[0206] Specific details of the above computer device can be understood by referring to the corresponding relevant descriptions and effects in the above embodiments, and will not be elaborated here.
[0207] To achieve the above object, according to another aspect of the present application, there is also provided a computer-readable storage medium storing a computer program, and the computer program, when executed in a computer processor, implements the steps in the above plug-in-free document form printing processing method. Those skilled in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, it may include the processes of the embodiments of the above methods. Among them, the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD), etc.; the storage medium may also include a combination of the above types of memories.
[0208] To achieve the above object, according to another aspect of the present application, there is also provided a computer program product including a computer program / instructions, and the computer program / instructions, when executed by a processor, implement the steps of the above plug-in-free document form printing processing method.
[0209] Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by program codes executable by the computing device. Thus, they can be stored in a storage device and executed by the computing device, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module to be implemented. In this way, the present invention is not limited to any specific combination of hardware and software.
[0210] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for processing document form printing without plug-ins, characterized in that The method is applied to a server, and the method includes: When receiving a printing request sent by a Web front end, generating a corresponding PDF file according to the printing request, where the printing request includes: a printing template identifier and a data resource identifier. Among them, in the process of generating the PDF file, the settings of the table row type are parsed from the printing template design information corresponding to the printing template identifier, and then, according to the settings of the table row type, the pagination presentation methods of various table rows in the generated PDF file are controlled, and the text content in the cells is typeset based on a preset text adaptive typesetting algorithm. The table row types include: single-page printing, per-page printing, floating row, per-page end-row printing, and last-page printing; Converting the PDF file into a file stream format and returning it to the Web front end, so that the Web front end can perform a printing preview on the PDF file through the native PDF preview function of the browser and complete the printing of the PDF file through the native printing function of the browser.
2. The method for processing and printing a document form without plug-ins according to claim 1, characterized in that, The converting the PDF file into a file stream format and returning it to the Web front end, so that the Web front end can perform a printing preview on the PDF file through the native PDF preview function of the browser and complete the printing of the PDF file through the native printing function of the browser includes: Returning the file stream of the PDF file and a printing policy identifier to the Web front end, so that the Web front end can perform a printing preview and printing according to the corresponding policy based on the printing policy identifier. Among them, the printing policy identifier includes: a first identifier for indicating the use of the native PDF preview and printing functions of the browser and a second identifier for indicating the use of WebAssembly for PDF rendering and preview and the use of the native printing function of the browser for printing; when the printing policy identifier is the first identifier, the Web front end performs a printing preview on the PDF file through the native PDF preview function of the browser and completes the printing of the PDF file through the native printing function of the browser; when the printing policy identifier is the second identifier, the Web front end loads a PDF rendering module based on WebAssembly technology, and the PDF rendering module is used to parse the file stream of the PDF file and render the decoded PDF content into a Canvas element or a DOM container in the browser for preview, and complete the printing through the native printing function of the browser.
3. The method for processing and printing a document form without plug-ins according to claim 2, wherein It also includes: Obtaining the front-end running environment metric data collected by the Web front end, where the front-end running environment metric data includes: network latency, downstream bandwidth, browser type, browser version, network type, memory size, and the number of current user queued printing tasks; Determining a printing policy and generating the printing policy identifier according to the front-end running environment metric data and a preset printing policy prediction model, where the printing policy prediction model is obtained by training a classification model according to training samples.
4. The method for processing the printing of a document form without plug-ins according to claim 1, characterized in that Performing typesetting processing on the text content in the cell based on a preset text adaptive layout algorithm, including: When automatic row height is not enabled, according to the column width of the cell and the set fixed row height, first perform line breaking typesetting on the text. If the text still cannot be fully displayed after line breaking, automatically reduce the font size by decreasing the font size until the text is fully displayed; When automatic row height is enabled, perform line breaking on the text content according to the column width, and dynamically calculate the row height of the cell based on the number of lines after line breaking and the line spacing. The final height of each line takes the row height of the highest cell in the row as the reference row height.
5. The method for processing the printing of a document form without plug-ins according to claim 1, wherein Generating a corresponding PDF file according to the print request, including: During the process of generating the PDF file, parse the calculation formula bound to the cell from the print template design information corresponding to the print template identifier, and execute the calculation formula to fill the formula calculation result to the corresponding cell position to generate PDF content containing the formula calculation result.
6. The method for processing the printing of a document form without plugins according to claim 1, characterized in that, Generating a corresponding PDF file according to the print request, including: During the process of generating the PDF file, parse the configuration content of the extended table component from the print template design information corresponding to the print template identifier, and perform structured processing on the approval process track data based on the configuration content, and render the approval node information to the corresponding cell of the table component. The configuration content includes the bound approval process track field and signature field. The signature field is bound to the floating row area of the table and is used to display the electronic signature image of the operator of each approval node in the PDF file to fully present the approval process and signing information.
7. The method for processing the printing of a document form without plugins according to claim 1, characterized in that, When the Web front-end receives the file stream of the PDF file, dynamically generate an iframe tag in the browser page, and embed the file stream into the iframe tag for loading to call the native PDF preview function of the browser to complete the print preview of the PDF file.
8. The method for processing and printing a document form without plug-ins according to claim 1, characterized in that, Also including: Displaying a preset visual print template design interface to the user through the Web front-end, and then converting the print template designed by the user on the visual print template design interface into structured print template design information, and generating a print template identifier corresponding to the print template design information.
9. The method for processing the printing of a document form without plug-ins according to claim 8, characterized in that, The functions implemented by the visual print template design interface include: Supporting the user to layout various component elements in a drag-and-drop manner through a graphical interface. The component elements include: form components, table components, and picture components; Supporting the configuration of various table style design parameters. The table style design parameters include: row height, column width, background color, border, alignment method, and font style; Supporting the setting of cells and binding cells to business fields or calculation formulas executed by the server; Supporting the access of the table component to an extended data set to meet the personalized table data printing requirements; Support the setting of the table row types in the table component, where the table row types are used to control the pagination presentation methods of different table rows during printing. The table row types include: single print, print per page, floating row, print at the end of each page, and print on the last page; Support configuring the table component to display approval process track data, and support binding approval node fields and signature fields to corresponding cells. Among them, the signature field is bound to the floating row area to display the electronic signature image of the approval node operator during printing, so as to fully display the approval process and signing information.
10. A document form printing and processing device without plug-ins, characterized in that, The device is applied to the server, and the device includes: A PDF file generation unit, which is used to generate a corresponding PDF file when receiving a printing request sent by the Web front-end. The printing request includes: a printing template identifier and a data resource identifier. Among them, during the generation of the PDF file, the setting of the table row type is parsed from the printing template design information corresponding to the printing template identifier, and then the pagination presentation methods of various table rows in the generated PDF file are controlled according to the setting of the table row type, and the text content in the cells is typeset based on a preset text adaptive layout algorithm. The table row types include: single print, print per page, floating row, print at the end of each page, and print on the last page; A file stream sending unit, which is used to convert the PDF file into a file stream format and return it to the Web front-end, so that the Web front-end can perform a print preview of the PDF file through the native PDF preview function of the browser, and complete the printing of the PDF file through the native printing function of the browser.
11. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method described in any one of claims 1 to 9.
12. A computer-readable storage medium having computer programs / instructions stored thereon, characterized in that, When the computer program / instructions are executed by the processor, it implements the steps of the method described in any one of claims 1 to 9.
13. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, it implements the steps of the method described in any one of claims 1 to 9.
Citation Information
Patent Citations
Method and system for realizing Web end self-defined format printing on basis of B / S framework
CN107463348A
Printing method for carrying out online design and preview based on WEB
CN110865775A
Method and device for printing table data based on line printing style
CN112230870A
File printing method and device, electronic equipment and computer readable medium
CN114721609A
Revit-based Excel file generation document method and equipment
CN115544980A