Document printing method and device, computer device and storage medium
Patent Information
- Application Number
- CN202611039161.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-10-23
- Estimated Expiration
- 2046-07-14
AI Technical Summary
[0003]相关技术中基于这些软件直接进行打印的方法,通常为直接当前编辑视图进行快照输出,无法识别工业文档的参数特性,导致打印出的文档存在数据丢失、页码错乱以及排版污染等问题
[0006]通过构建独立于原始文档的虚拟沙盒文档,实现了打印数据流与编辑数据流的物理隔离,然后对虚拟沙盒文档进行内存态数据固化,将临时输入内容转换为静态属性,解决了打印数据丢失问题。同时剥离可编辑属性,解决网页打印的排版污染问题。接着对目标沙盒文档进行页码刷新处理,能够根据页面业务类型自动执行双轨制独立页码计算,满足工业文档的页码合规要求,最终通过调用底层打印接口完成最终输出,保证了打印结果的一致性和标准化。整个方案形成完整的全链路处理机制,即使是含有大量动态表单、混合页码和交互控件的复杂文档也能输出完整规范的纸质打印文档,从而提升了工艺文件编制的效率和质量。
Smart Images

Figure CN122547295B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of industrial information technology, and in particular to a document printing method, apparatus, computer equipment, and storage medium. Background Technology
[0002] In related technologies, the preparation of process documents in manufacturing industries (such as machining and electronic assembly) mainly relies on general office software.
[0003] The printing methods based on these software programs in related technologies usually involve taking a snapshot of the current editing view and outputting it directly. This method cannot recognize the parameter characteristics of industrial documents, resulting in problems such as data loss, page number errors, and layout pollution in the printed documents.
[0004] There is a need for a document printing method that can ensure the integrity and standardization of printed output. Summary of the Invention
[0005] This application aims to at least partially solve one of the technical problems in related technologies. To this end, this application proposes a document printing method, apparatus, computer equipment, and storage medium. The main technical solutions adopted in this application include: In a first aspect, this application provides a document printing method, which includes: responding to a target printing instruction of an original document, performing a free sandbox construction process based on the original document to obtain a virtual sandbox document; wherein the virtual sandbox document is a virtual data copy independent of the original document; performing memory-state data solidification and editable attribute stripping on the virtual sandbox document to obtain a target sandbox document; performing page number refresh processing based on the target sandbox document to obtain ordered printing data; and calling a printing interface to perform printing processing based on the ordered printing data to complete the target printing task.
[0006] By constructing a virtual sandbox document independent of the original document, physical isolation between the printing and editing data streams is achieved. Then, the virtual sandbox document undergoes in-memory data solidification, converting temporary input content into static attributes, thus resolving the issue of printed data loss. Simultaneously, editable attributes are removed, addressing the layout pollution problem in web page printing. Next, page numbering of the target sandbox document is refreshed, automatically performing dual-track independent page numbering based on the page's business type, meeting the page numbering compliance requirements of industrial documents. Finally, the final output is completed by calling the underlying printing interface, ensuring the consistency and standardization of the printed results. The entire solution forms a complete end-to-end processing mechanism, enabling the output of complete and standardized paper-printed documents, even for complex documents containing numerous dynamic forms, mixed page numbers, and interactive controls, thereby improving the efficiency and quality of process document preparation.
[0007] Optionally, page number refresh processing is performed based on the target sandbox document to obtain ordered print data; including: page type detection and page number reconstruction processing based on the target sandbox document to obtain intermediate print documents; interactive node removal and physical pagination processing are performed based on the intermediate print documents to obtain ordered print data.
[0008] By employing a dual-track page numbering system based on business type detection, the system achieves automatic and accurate calculation of mixed page numbers for complex industrial documents. Through interactive node removal and forced physical pagination conversion, it completes the final conversion of dynamic web pages into standardized industrial documents. These two processes work together to generate ordered print data with accurate page numbers, clean layout, and standardized formatting, providing a reliable foundation for the final print output and fully meeting the compliance requirements for printing industrial process documents.
[0009] Optionally, the target sandbox document is segmented into at least two types of pages by at least one pagination class tag; at least two independent page number counters are maintained in memory; each page corresponds one-to-one with an independent page number counter; page type sniffing and page number reconstruction processing are performed based on the target sandbox document to obtain an intermediate print document, including: performing pagination class tag detection on the target sandbox document based on a preset matching dictionary to obtain page type results; performing page number increment processing on the independent page number counters based on the page type results to obtain the target page number value of the page in the target sandbox document; and overwriting the original text page number in the target sandbox document using the target page number value of the page based on a preset page number positioning selector to obtain an intermediate print document.
[0010] The aforementioned dual-track page numbering reconstruction process based on business type detection enables independent closed-loop counting of the main document and independent attachments, solving the technical problem that traditional web page printing cannot achieve mixed page numbers, and ensuring that the page numbers of industrial documents meet the enterprise's archiving standards and indexing requirements.
[0011] Optionally, interactive node culling and physical pagination are performed on the intermediate printed document to obtain ordered printed data, including: injecting a node instruction set into the header of the intermediate printed document; wherein the node instruction set includes positioning culling instructions and boundary cutting instructions; performing rendering tree stripping processing on the intermediate printed document based on the positioning culling instructions to obtain a clean printed document; and performing flow layout to physical paper cutting conversion processing on the clean printed document based on the boundary cutting instructions to obtain ordered printed data under the target layout format.
[0012] By injecting node instruction sets and performing render tree stripping and physical cutting transformations, all editing interaction elements are eliminated from the printed layout. At the same time, the flexible web flow layout is converted into a fixed-size industry-standard physical layout, ensuring the consistency of printing results across different devices and browsers.
[0013] Optionally, the virtual sandbox document is subjected to memory-state data solidification and editable attribute stripping to obtain the target sandbox document, including: static dimensionality reduction of data state based on the virtual sandbox document to obtain a static sandbox document; wherein, the static sandbox document is a data solidification document formed by converting temporary input data stored in browser memory into static tags; and attribute removal is performed on the static sandbox document to obtain the target sandbox document.
[0014] Static dimensionality reduction of data state is achieved by using a virtual sandbox document, converting volatile temporary memory data into static physical attributes of HTML tags. This solves the technical challenge of browsers' native printing not being able to capture user input. Subsequently, by globally detecting and removing the editable attributes of all nodes in the static sandbox document, the entire document is converted from an editable state to a read-only archived state. The final target sandbox document ensures the integrity of the printed data while eliminating the pollution of the printed layout by editing controls and editable tags, laying a reliable data foundation for subsequent page number updates and physical output.
[0015] Optionally, static dimensionality reduction of data states is performed based on the virtual sandbox document to obtain a static sandbox document, including: traversing the input class nodes in the virtual sandbox document and obtaining the current memory data of the input class nodes; performing static physical attribute transformation processing on the current memory data to obtain the static sandbox document.
[0016] Through the static dimensionality reduction processing of the data state described above, the memory-state data is forcibly solidified into the static attributes of Hypertext Markup Language (HTML), fundamentally eliminating the problem of lost printing data and ensuring that the final output document contains all the content filled in by the user.
[0017] Optionally, attributes are removed from the static sandbox document to obtain the target sandbox document, including: traversing all available nodes in the static sandbox document to obtain the edit attribute results of all available nodes; and performing node type conversion on all available nodes based on the edit attribute results to obtain the target sandbox document.
[0018] By globally traversing all available nodes and removing editable attributes, the document's editability is frozen. This effectively prevents accidental modifications during print preview and eliminates visual remnants of the user interface (UI) in all editing states, ensuring the purity of the printed layout and the document's tamper-proof nature.
[0019] Secondly, this application provides a document printing apparatus, comprising: a sandbox construction module, configured to perform free sandbox construction processing based on the original document in response to a target printing instruction of the original document, to obtain a virtual sandbox document; wherein the virtual sandbox document is a virtual data copy independent of the original document; a static solidification module, configured to perform memory-state data solidification and editable attribute stripping on the virtual sandbox document to obtain a target sandbox document; a page number refresh module, configured to perform page number refresh processing based on the target sandbox document to obtain ordered printing data; and a printing processing module, configured to call a printing interface to perform printing processing based on the ordered printing data to complete the target printing task.
[0020] Thirdly, this application also provides a computer device including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above methods.
[0021] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any of the methods described above. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0023] Figure 1 This is a flowchart of a document printing method according to an embodiment of this application; Figure 2 This is a flowchart of a method for determining a target sandbox document according to an embodiment of this application; Figure 3 This is a flowchart of a method for determining ordered print data according to an embodiment of this application; Figure 4 This is a structural block diagram of a document printing apparatus according to an embodiment of the present application; Figure 5 This is an internal structural diagram of a computer device provided according to an embodiment of this application. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] It's important to note that, taking web page printing as an example, the information users enter on the front-end page is typically stored in the browser's memory as a value attribute or other dynamic attribute. Traditional printing operations, however, retrieve static HTML source code. Because the value and other attributes in the source code remain in their initial state and are not synchronized to the explicit physical attributes of the HTML tags, the user-entered information may be lost or appear blank in the printed document.
[0026] Furthermore, industrial documents often combine "main processes" (continuous page numbers) with "tracking cards / installation cards" (independent closed-loop page numbers). However, the front-end printing technology in related technologies is inherently globally linear, only able to accumulate from page 1 to page N, unable to execute two completely different sets of page number accumulation logic for cards with different business attributes during physical pagination. In other words, the front-end Document Object Model (DOM) cannot recognize the business type of the page content. Within the same print stream, the browser rendering engine cannot run two independent counting algorithms. If printed directly, the tracking card will incorrectly occupy the page number sequence of the main procedure, causing the index of the entire process document to become invalid.
[0027] Furthermore, to support online editing and interactive operations, web pages often contain numerous controls that assist in editing (such as drag handles, delete buttons, rich text borders, etc.). If these controls are not removed during printing, they will appear directly in the output document, causing serious typesetting pollution and affecting the document's standardization and readability. Therefore, a method is needed that can independently preprocess the printed content outside of the current editing state to simultaneously solve the problems of data loss, page number confusion, and typesetting pollution.
[0028] Based on this, according to the embodiments of this application, a document printing method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0029] This embodiment provides a document printing method, such as... Figure 1 As shown, the method includes the following steps: S110. In response to the target print command of the original document, perform free sandbox construction processing based on the original document to obtain a virtual sandbox document.
[0030] The original document can refer to the original document that needs to be printed out. This document is usually presented in the form of a webpage, containing process information filled in by the user and various interactive controls, allowing users to edit the content, adjust the format, and delete pages online. For example, the original document can be a machining process specification, electronic assembly tracking card, or equipment installation information card used in manufacturing.
[0031] A target print command can be a request signal used to initiate a target print job, which can be triggered by the user or internal system logic. For example, when a user clicks the print button on the system interface or performs other operations that can trigger printing, this target print command is generated so that the corresponding program can perform subsequent processing and printing actions.
[0032] It's important to note that in a browser environment, the content of a webpage is organized using the Document Object Model (DOM), also known as the main document tree. This document tree manages all nodes on the page in a tree structure, including paragraphs, tables, images, input boxes, etc. The browser renders the user-visible interface based on this tree. In related technologies, the printing operation directly intercepts a visual snapshot of the current main document tree, which can cause interference between printing and editing operations, and also prevents targeted preprocessing of the printed content.
[0033] To address the aforementioned issues, this solution introduces the concept of a virtual sandbox container. For example, the system can create an invisible, detached container in memory, and then completely copy all page content of the original document into this container. Subsequently, any modifications to this container will not affect the original page that the user is editing.
[0034] This detached container can serve as a virtual sandbox document, that is, a virtual copy of data independent of the original document, which enables the print data stream of the target print job to be physically separated from the editing data stream of the original document.
[0035] Specifically, in response to the target print command of the original document, the system first retrieves a global page array from memory, which stores the HyperText Markup Language (HTML) string model for each page of the original document. The system iterates through this array, concatenating the HTML strings of all pages into a single giant string using array mapping methods, such as the Array.map() command.
[0036] Subsequently, the system creates a detached DOM container in memory. This container is not mounted to the original document's visible document tree, so any read, write, or destruction operations on it will not trigger the browser to redraw the original document's view. The system calls the container's internal Hypertext Markup Language property (i.e., the inner HTML property) to deserialize the concatenated giant string all at once and inject it into the container, thus completing the construction of the virtual sandbox document.
[0037] It should be noted that the content of this virtual sandbox document is completely identical to the original document, but it exists entirely independently of the original document's main document tree in memory. All subsequent data cleaning, page number calculation, and layout adjustment operations are performed within this virtual sandbox document, without modifying the original document's main document tree, thus achieving physical isolation between the printing data stream and the editing data stream.
[0038] S120. Solidify the virtual sandbox document in memory and strip the editable attributes to obtain the target sandbox document.
[0039] It's important to note that during the printing process, because the original document has online editing capabilities, users can still modify it in real time, causing the original document content to update dynamically. However, these temporary updates are only temporarily stored in the browser's dynamic attributes and have not yet been synchronized to the corresponding HTML string in the global page array, and therefore cannot be synchronized to the virtual sandbox document. If printing is done directly at this point, the printing engine cannot capture this temporary input data that only exists in the browser's memory, resulting in blank pages for the user-entered steps in the final printed document.
[0040] Meanwhile, to support online editing and interactive operations, the original document contains numerous editing aids (such as drag handles, delete buttons, rich text borders, etc.) and editable markers. These elements are not part of the official process document, but they may still appear in the printed output, causing serious typesetting pollution. Furthermore, the presence of these elements may increase the risk of accidental modifications during print preview, severely compromising the accuracy of the printed content.
[0041] Therefore, it is necessary to sequentially perform memory-state data solidification and editable attribute stripping operations on the virtual sandbox document to obtain a target sandbox document with complete data and a clean layout.
[0042] Specifically, the system can traverse all input-type nodes in the virtual sandbox document, read the current memory value of each node, and use the DOM application interface to forcibly convert the memory value into the static physical attributes of the tag. This performs static dimensionality reduction processing on the virtual sandbox document, resulting in a static sandbox document to solve the problem of blank spaces in the user-filled process content in the final printed document. Subsequently, the system traverses all available nodes in the static sandbox document again, removing the editable attributes on each one, thereby converting the node type, which was originally a rich text input source, into a read-only text node, to obtain the target sandbox document containing only the accurate printed content.
[0043] The target sandbox document can be a print preparation document with completely solidified data and in a read-only archive state, which can ensure that the data is not lost and the layout is free from editing pollution during the subsequent printing process.
[0044] S130. Perform page number refresh processing based on the target sandbox document to obtain ordered print data.
[0045] Ordered print data can refer to standardized documents with correct page numbers and proper layout, which can be directly sent to the print engine as a print data stream for the target print job.
[0046] Understandably, because web page printing in related technologies uses a globally linear page numbering logic, it can only count continuously from the first page to the last, and cannot identify the business attributes of the page. However, industrial documents (such as process specifications) often mix main processes with continuous page numbers and attachments (such as tracking cards or installation cards with independent closed-loop page numbers). If printed directly, the page numbers of the attachments will incorrectly occupy the page numbers of the main process, resulting in page number confusion for the entire document and invalid document indexing. Therefore, page number refreshing processing is required for the target sandbox document.
[0047] Specifically, the system can first perform type sniffing on each physical pagination node in the target sandbox document based on a preset business type dictionary, and identify which pages belong to the main process and which pages belong to the attachments.
[0048] Meanwhile, the system can maintain multiple sets of counters (main counter and at least one auxiliary counter) in parallel in memory, and perform incremental processing on the corresponding counters according to the sniffing results to obtain the target page number value that each page should have.
[0049] Then, using the preset page number position selector, the text node displaying the page number on each page is found, and the calculated page number value is forcibly overwritten to replace the original placeholder or incorrect page number, resulting in an intermediate print document.
[0050] Subsequently, the system injects a node instruction set into the header of the intermediate print document. This instruction set includes a positioning culling instruction for hiding interactive controls and a boundary cutting instruction for forcing pagination. Then, based on the positioning culling instruction, all nodes marked as interactive controls in the rendering tree are stripped, and based on the boundary cutting instruction, the full-page flow layout is forcibly converted into physical pagination cut to A4 paper size, ultimately resulting in ordered print data.
[0051] S140. Call the print interface to perform print processing based on ordered print data in order to complete the target print task.
[0052] The target printing task can refer to the operation task corresponding to the target printing instruction that can output the original document as physical paper, and ultimately generate a paper print file with complete data, accurate page numbers and standardized layout, for use in workshop production guidance or archive preservation, etc.
[0053] Specifically, the system can encapsulate ordered print data into a complete standardized data format using common industrial packaging specifications and send it to the system's underlying print interface. The print interface then completes the final rendering and output of the document to fulfill the target print task.
[0054] For example, taking a desktop application environment (such as a process planning system built on the Electron framework) as an example, the system first performs pre-printing verification on the ordered print data.
[0055] Pre-print validation can include static validation, editing validation, page number validation, and pagination validation. Static validation can be achieved by traversing the form nodes in the ordered print data and checking each node to see if it contains static physical attributes. This confirms that all user input data has been completely written into the static attributes through memory-based data storage, thus preventing blank fields from appearing during printing.
[0056] Edit validation can be achieved by checking whether editing interactive controls (such as delete buttons, drag handles, rich text borders, etc.) are no longer present in the ordered print data, in order to avoid typesetting pollution during printing.
[0057] Page number verification can be achieved by checking the page number text nodes of each page in the ordered printed data. It can verify whether the page numbers of the main process and attachments are calculated correctly according to their respective independent counters, thereby confirming whether the binary page number calculation is accurate.
[0058] Page break verification can be achieved by checking whether there are page break marks after independent content blocks in ordered printed data. It can be used to confirm whether the page has been physically paginated according to the preset paper size (such as A4 size).
[0059] Subsequently, the system extracts the nodes corresponding to the ordered print data, encapsulates them into a single string stream, and sends it directly to the underlying printing interface provided by the host environment (such as the native printing interface in the Electron framework). After receiving the string stream, the printing interface calls the operating system to output to the physical printer according to the preset paper size, fixed margins, and other specified parameters, so as to obtain paper process documents that conform to the enterprise's archiving specifications, thereby completing the target printing task.
[0060] It's important to note that the entire printing process adheres to strict timing control. Related technologies using visual snapshot interception capture the current screen content the instant the user triggers print. This method not only fails to modify page numbers but also captures interactive buttons, delete icons, zoom controls, etc., causing severe layout pollution. In this solution, the system establishes a rigorous timing sequence of "sandbox construction and solidification → rendering stage → output stage": First, an independent virtual sandbox document is built the instant the print command is captured, completing the solidification of in-memory data and the stripping of editable attributes. Then, page number refreshing and layout cleaning are performed within this sandbox. Finally, the processed, ordered print data is sent to the underlying print interface. By advancing the data processing actions before the physical printing action, the accuracy of the output is ensured, and the print data stream and editing data stream are completely decoupled. Users continuing to edit on the front end will not interfere with the print task being prepared in the background.
[0061] In the above implementation, by constructing a virtual sandbox document independent of the original document, physical isolation between the printing data stream and the editing data stream is achieved. Then, the virtual sandbox document undergoes memory-based data solidification, converting temporary input content into static attributes, thus resolving the issue of printed data loss. Simultaneously, editable attributes are removed, addressing the layout pollution problem in web page printing. Next, the target sandbox document undergoes page number refresh processing, automatically performing dual-track independent page number calculations based on the page's business type, meeting the page number compliance requirements of industrial documents. Finally, the final output is completed by calling the underlying printing interface, ensuring the consistency and standardization of the printed results. The entire solution forms a complete end-to-end processing mechanism, enabling the output of complete and standardized paper-printed documents even for complex documents containing numerous dynamic forms, mixed page numbers, and interactive controls, thereby improving the efficiency and quality of process document preparation.
[0062] In some implementation methods, please refer to the appendix. Figure 2 The virtual sandbox document undergoes in-memory data persistence and editable attribute stripping to obtain the target sandbox document, including: S210. Staticize and reduce the dimensionality of data states based on the virtual sandbox document to obtain a static sandbox document.
[0063] A static sandbox document can be a data-solidified document formed by converting temporary input data stored in the browser's memory into static tags. In other words, it's a complete printable document that contains dynamically updated temporary input data from the user.
[0064] Specifically, static dimensionality reduction can be achieved by the following method: First, traverse the input class nodes in the virtual sandbox document and obtain the current memory data of the input class nodes; then, perform static physical attribute transformation on the current memory data to obtain the static sandbox document.
[0065] Input nodes can refer to any node that can receive user input and temporarily store its data in the browser's memory, such as... <input> node.
[0066] It's important to understand that in a browser environment, nodes are the basic building blocks of a document. Each node can have several attributes. One type of attribute is a static attribute written in the HTML tag's source code, which is fixed after the page loads. The other type of attribute is a dynamic attribute generated after user interaction. These are only temporarily stored in the scripting language (i.e., JavaScript) engine's memory and are not automatically synchronized to the source code of the corresponding HTML tag for each node. All temporary input data entered by the user in input-type nodes is stored in dynamic attributes by default.
[0067] The current in-memory data refers to temporary input data that the user fills in in real time at input-type nodes, i.e., all text strings that need to be printed, including the latest text entered by the user. This data only exists in memory and may be lost at any time due to page refresh or printing operations.
[0068] Furthermore, the concept of static physical attributes is introduced here. These static physical attributes refer to the content carrier that the printing engine can recognize and read; they can be understood as attribute values directly written into the HTML tag source code, such as... <input value="拧紧螺丝"> The `value` attribute in [the context].
[0069] It is important to reiterate that dynamic data in memory (i.e., current memory data) is not persistent. When generating the print stream, the printing engine only parses the static attributes of HTML tags, not the dynamic data in memory. If the current memory data is not written to the static physical attributes, the printing engine cannot capture this content, ultimately resulting in blank pages in the printed document. Therefore, it is necessary to extract the temporary data in memory and force it to be written to the static physical attributes of the corresponding tags, so that the virtual sandbox document truly becomes a copy of the document containing the fully filled content.
[0070] For example, the system traverses the entire DOM tree of the virtual sandbox document, identifying each input-class node. For each identified input-class node, its value attribute is read through the Document Object Model Programming Interface (DOM API) to obtain the current memory data of the user input. Then, the relevant function is called to force the read memory data into the static value attribute of the corresponding node's HTML tag. The above operation is repeated to complete the traversal and forced writing of all input-class nodes, writing all temporary data of user input into the HTML structure of the virtual sandbox document, thereby completing the static physical attribute conversion and finally forming the static sandbox document.
[0071] Through the static dimensionality reduction processing of the data states described above, the memory-state data is forcibly solidified into HTML static attributes, fundamentally eliminating the problem of lost printing data and ensuring that the final output document contains all the content filled in by the user.
[0072] S220. Remove attributes from the static sandbox document to obtain the target sandbox document.
[0073] Specifically, attribute removal can be performed through the following steps: First, traverse all available nodes in the static sandbox document to obtain the edit attribute results of all available nodes; then, based on the edit attribute results, perform node type conversion on all available nodes to obtain the target sandbox document.
[0074] It should be noted that the reason all available nodes are traversed here, rather than just input-type nodes, is because in complex documents, not only standard nodes are traversed... <input> Nodes containing editable attributes, table cells (td), and custom block-level elements (div) may also be marked as having editable attributes (i.e.,<contenteditable="true"> This allows users to directly click and modify content. If only input nodes are processed, other ordinary nodes with editable attributes will still retain editability. This could lead to residual editing interactions such as the cursor and spell check lines appearing during printing or print preview, severely impacting the document's layout purity. Therefore, it's necessary to iterate through all available nodes and globally remove editable attributes.
[0075] Furthermore, in the HTML standard, the editability of a node is uniformly controlled by the "contenteditable" attribute. The value of this attribute directly determines whether a node allows users to directly modify its content in the browser. The binary determination result of whether each node has editability can be used as the editability attribute result. That is, for each usable node, if it contains the attribute "contenteditable="true" (i.e., the attribute value is true), it is determined to be an editable node, and the editability attribute result is marked as editable; if it does not contain this attribute or the attribute value is false, it is determined to be a non-editable node, and the editability attribute result is marked as non-editable.
[0076] For example, the system iterates through all nodes in the static sandbox document. For each node, it checks if the `contenteditable` attribute exists and is true, generating the corresponding editable attribute result. If the editable attribute result is editable, the DOM API's `removeAttribute` method is called to remove the `contenteditable` attribute from the node. If the editable attribute result is not editable, the node is skipped without any action. After the iteration is complete, all editable attributes of all nodes in the static sandbox document are globally removed, and all previously editable nodes (such as `div` or `td`) are converted to read-only text nodes, ultimately resulting in a clean and functional target sandbox document.
[0077] By globally traversing all available nodes and removing editable attributes, the document's editability is frozen. This effectively prevents accidental modifications during print preview and eliminates UI visual residue in all editing states, ensuring the purity of the printed layout and the document's tamper-proof nature.
[0078] In the above implementation, static dimensionality reduction of data state is performed based on a virtual sandbox document, converting volatile temporary memory data into static physical attributes of HTML tags, thus solving the technical problem that native browser printing cannot capture user input. Subsequently, by globally detecting and removing the editable attributes of all nodes in the static sandbox document, the entire document is converted from an editable state to a read-only archived state. The final generated target sandbox document ensures the integrity of the printed data and eliminates the pollution of the printed page by editing controls and editable tags, laying a reliable data foundation for subsequent page number updates and physical output.
[0079] In some implementation methods, please refer to the appendix. Figure 3 Page number refresh is performed based on the target sandbox document to obtain ordered print data; including: S310. Perform page type sniffing and page number reconstruction processing based on the target sandbox document to obtain the intermediate print document.
[0080] The intermediate print document can refer to a print preparation document with correct page number information, that is, a document that has completed the dual-track page number reconstruction process of the main process and attachments.
[0081] It's important to note that browser-native page number generation relies on the `counter-increment` property of Cascading Style Sheets (CSS). The common browser printing rendering process involves: first, building the DOM tree; then applying CSS styles and initializing the global counter; next, performing layout calculations to generate page frames; and finally, forcibly splitting the page when encountering pagination directives (such as `page-break`). Each new page frame triggers a global counter increment, and the current counter value is displayed during printing. However, this mechanism only performs global linear accumulation within the same document flow, cannot identify page business attributes, and cannot achieve independent and isolated counting for pages with different business types.
[0082] However, most complex industrial documents contain a mix of main process pages and independent attachment pages. These two types of pages need to follow different page numbering rules. Main process pages need to be numbered consecutively starting from page one; independent attachment pages contain various specific types (such as tracking cards, installation cards, etc.), each with its own independent technical loop, requiring each to be renumbered starting from page one. If the browser's native global linear counting method is used directly, the page numbers of all independent attachments will incorrectly occupy the main process's sequence number, leading to page number confusion and index failure throughout the entire process document. Therefore, a dual-track page numbering reconstruction mechanism based on business type detection is required.
[0083] Specifically, the target sandbox document is segmented into at least two types of pages (i.e., the main process page and multiple independent attachment pages) by at least one embedded pagination class tag. At least two independent page number counters are maintained in the system memory, and each type of page corresponds to an independently running page number counter.
[0084] Among them, pagination class tags can refer to tags or specific class names embedded in the document structure to identify the page's business type, such as...<class="tracking-card"> It can represent a tracking card.<class="main-procedure"> These can represent the main workflow page. By recognizing these markers, the system can automatically divide document pages into main workflow pages and different types of attachment pages.
[0085] An independent page number counter refers to a counting unit maintained in memory by the system for pages of different business types. Each counting unit operates in parallel and does not interfere with others, enabling independent closed-loop accumulation for pages of the corresponding business type. Specifically, it includes a main process counter for continuously recording the page numbers of the main process pages, and multiple independent attachment counters for independently recording the page numbers of each type of independent attachment page.
[0086] Specifically, the process of performing page type detection and page number reconstruction based on the target sandbox document to obtain the intermediate print document can include: first, performing pagination class tag detection on the target sandbox document based on a preset matching dictionary to obtain page type results; then, performing page number increment processing on the independent page number counters based on the page type results to obtain the target page number value of the page in the target sandbox document; finally, using a preset page number positioning selector, overwriting the original text page number in the target sandbox document with the target page number value to obtain the intermediate print document.
[0087] The preset matching dictionary refers to a predefined set of mapping relationships between page business types, pagination tags, and counters. It clearly defines which pagination tag corresponds to which business type and which counter, enabling rapid matching of physical pagination nodes to their corresponding counting units. For example, the preset matching dictionary could define a main process tag corresponding to a main process counter, a tracking card tag corresponding to a tracking card accessory counter, and an installation card tag corresponding to an installation card accessory counter. This dictionary can be configured by default by the system or custom-built by the user based on the actual business needs of the industrial documents.
[0088] The page type result can refer to the business type identifier of each physical pagination node, obtained after matching with a preset matching dictionary. Specifically, the system can traverse each physical pagination node, extract its pagination class tag, look up the corresponding counter in the preset matching dictionary, and return the corresponding counter label based on the match result.
[0089] The target page number value of a page in the target sandbox document can refer to the correct page number value that each page should display after being incremented by the corresponding independent counter.
[0090] For example, suppose a process specification contains 5 physical pagination nodes, where pages 1-2 are assembly cards (main process class), pages 3-4 are tracking cards (independent attachment class), and page 5 is installation information card (main process class).
[0091] When performing page type detection and page number reconstruction, the system first traverses all physical pagination nodes in the target sandbox document, detecting their pagination class markers one by one. For example, if the markers for pages 1-2 match the main process type, the page type is determined to be a main process page, and counter A corresponding to the main process is used. If the markers for pages 3-4 match the tracking card type, the page type is determined to be a tracking card-type independent attachment page, and counter B corresponding to the tracking card in the attachment is used. If the markers for page 5 match the main process type, the page type is determined to be a main process page, and counter A corresponding to the main process is also used.
[0092] The system then initializes counters A and B, both counting independently from 1: counter A increments to 1 for page 1, to 2 for page 2; counter B increments to 1 for page 3, to 2 for page 4; and counter A increments to 3 for page 5. The resulting target page numbers are 1, 2, 1, 2, and 3.
[0093] After obtaining the target page number value for each type of page, the original text page numbers in the target sandbox document can be overwritten using the target page number value based on the preset page number positioning selector to obtain the intermediate print document.
[0094] Among them, the preset page number positioning selector can refer to the system's predefined targeted positioning rules, that is, the system assigns a specific CSS class name to the page number display element of each page in the target sandbox document, which can accurately match the page number text node in the footer of each physical pagination node.
[0095] For example, the preset page number positioning selector specifies that different CSS class names are assigned to pages of different business types. For instance, the page number element of a main process page can be marked as page-num-main, and the page number element of a tracking card page can be marked as page-num-tracking.
[0096] The system then iterates through all physical pagination nodes whose target page numbers have been calculated, page by page. Continuing with the previous example: For page 1 (main process type), the system uses the preset page number selector `page-num-main` to locate the page number text node in the footer, reads its current content (which may be a placeholder or an incorrect old page number), and overwrites the node's text content with the target page number value 1 using the `inner Text` attribute. For page 2 (main process type), `page-num-main` is used again to overwrite its page number as 2. For page 3 (tracking card type), `page-num-tracking` is used to overwrite it as 1. For page 4 (tracking card type), it is overwritten as 2. For page 5 (main process type), `page-num-main` is used again to overwrite it as 3. After all physical pagination nodes have been processed, all the original text page numbers in the target sandbox document are replaced with the correct double-track page numbers, thus obtaining the intermediate print document.
[0097] The aforementioned dual-track page numbering reconstruction process based on business type detection enables independent closed-loop counting of the main document and independent attachments, solving the technical problem that traditional web page printing cannot achieve mixed page numbers, and ensuring that the page numbers of industrial documents meet the enterprise's archiving standards and indexing requirements.
[0098] S320. Based on the intermediate print document, interactive node removal and physical pagination are performed to obtain ordered print data.
[0099] It should be noted that although the intermediate printed document has the correct page numbers, it still retains a large number of interactive controls used to assist in viewing and browsing in the original document, such as scroll bars, sidebars, control buttons for various subsets, and selection boxes for images. These controls are not part of the formal process content, and if they are not processed, they may appear directly on the printed paper document, resulting in a messy layout.
[0100] Furthermore, the webpage natively uses a fluid layout, displaying content in a continuous scrolling format without preset physical page boundaries. Direct printing can result in issues such as broken tables across pages or truncated process card content. Therefore, it's necessary to sequentially perform interactive node removal and physical pagination processing on the intermediate print documents. First, a clean print document containing only the official process content is generated, and then it is forcibly converted into ordered print data paginated according to standard physical paper sizes.
[0101] Specifically, interactive node removal and physical pagination can be achieved through the following steps: First, inject a node instruction set into the header of the intermediate print document; then, perform rendering tree stripping on the intermediate print document based on the positioning removal instruction to obtain the net print document; finally, perform flow layout to physical paper cutting conversion on the net print document based on the boundary cutting instruction to obtain ordered print data under the target layout format.
[0102] In this context, the node instruction set can refer to a set of cascading style rules used to control printing and rendering behavior. Specifically, the node instruction set can include positioning culling instructions and boundary trimming instructions.
[0103] Positioning exclusion directives can refer to a class of style rules used to hide interactive UI elements during printing, forcing the rendering engine to ignore specified interactive control nodes when generating the print stream. For example, by writing CSS rules with important weights (e.g., !important) in a media query block (e.g., @media print), the display property of interactive controls such as scrollbars, sidebars, subset control buttons, or image checkboxes can be set to none.
[0104] Boundary breaking directives can refer to a class of style rules used to define physical pagination behavior. They can forcibly intercept the default continuous streaming rendering of web pages, dividing the document content into independent pages according to a preset standard paper size. For example, page rules (such as @page) can be used to fix the paper size to A4 and specify the page margins to preset margins. Page breaks can be forcibly inserted for each independent card (such as process cards or tracking cards) through page break attributes (such as page-break-after: always).
[0105] A clean print document can refer to a pure document that retains only the formal process content, obtained by stripping all interactive control nodes from the intermediate print document.
[0106] For example, the system can inject a complete set of node instructions within the header tag () of the intermediate print document. For the location culling instruction, the system predefines a list of class names for all interactive controls, including delete buttons, drag handles, image selection boxes, scrollbars, and sidebar control buttons, and adds a CSS rule of "display: none !important" to each class name in the media query block (e.g., @mediaprint) for each class name. When generating the print render tree, the rendering engine automatically detaches all nodes that match the above rules and does not draw them into the print result, ultimately resulting in a clean print document without any interactive elements.
[0107] After obtaining the net print document, the net print document can be subjected to forced cutting conversion from flow layout to physical paper based on the boundary cutting command to obtain ordered print data under the target layout format.
[0108] The target layout format can refer to the preset physical paper output specifications, such as A4 portrait or landscape paper size, fixed page margins (20mm on each side), etc.
[0109] Specifically, the boundary breaking command comprises two core rules: the first is a global rule for the page (@page), which forces the printing paper to be set to standard A4 portrait size and locks the top, bottom, left, and right margins to the industry-standard 20mm. The second is a page break-after-always rule, uniformly added to the end of each physical page break node. This command forcibly intercepts the web engine's default waterfall-style infinite streaming rendering. Whenever the rendering engine detects the end of a physical page break node, it immediately stops drawing the current page and starts rendering a new page for subsequent content.
[0110] It should be noted that, since all process cards, tracking cards, and installation cards in this process compilation system adopt a fixed height design, and the content is completely contained within a single physical pagination node, hard pagination operations will not cause continuous content to be split.
[0111] By injecting node instruction sets and performing render tree stripping and physical cutting transformations, all editing interaction elements are eliminated from the printed layout. At the same time, the flexible web flow layout is converted into a fixed-size industry-standard physical layout, ensuring the consistency of printing results across different devices and browsers.
[0112] In the above implementation, a dual-track page numbering system based on business type detection enables automatic and accurate calculation of mixed page numbers for complex industrial documents. Interactive node removal and forced physical pagination conversion complete the final conversion of dynamic web pages into standardized industrial documents. These two processes work together to generate ordered print data with accurate page numbers, clean layout, and standardized formatting, providing a reliable foundation for the final print output and fully meeting the compliance requirements for printing industrial process documents.
[0113] It should be understood that although the steps in the flowchart above are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart above may include multiple steps or stages, which are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0114] This specification also provides a document printing device 400, such as... Figure 4 As shown, it includes: a sandbox building module 410, a static fixing module 420, a page number refresh module 430, and a print processing module 440, wherein: Sandbox building module 410 is used to respond to the target print command of the original document, perform free sandbox building processing based on the original document, and obtain a virtual sandbox document; wherein, the virtual sandbox document is a virtual data copy independent of the original document.
[0115] The static solidification module 420 is used to solidify the virtual sandbox document in memory and strip the editable attributes to obtain the target sandbox document.
[0116] Page number refresh module 430 is used to refresh page numbers based on the target sandbox document in order to obtain ordered print data.
[0117] The print processing module 440 is used to call the print interface to perform print processing based on ordered print data in order to complete the target print task.
[0118] In some implementations, the page number refresh module 430 is also used to perform page type sniffing and page number reconstruction processing based on the target sandbox document to obtain an intermediate print document; and to perform interactive node removal and physical pagination processing based on the intermediate print document to obtain ordered print data.
[0119] In some implementations, the target sandbox document is segmented into at least two types of pages by at least one pagination class tag; at least two independent page number counters are maintained in memory; each page corresponds one-to-one with an independent page number counter; the page number refresh module 430 is further configured to perform pagination class tag detection on the target sandbox document based on a preset matching dictionary to obtain page type results; perform page number increment processing on the independent page number counters based on the page type results to obtain the target page number value of the page in the target sandbox document; and overwrite the original text page number in the target sandbox document using the target page number value of the page based on a preset page number positioning selector to obtain the intermediate print document.
[0120] In some implementations, the page number refresh module 430 is also used to inject a node instruction set into the header of the intermediate printed document; wherein, the node instruction set includes a positioning culling instruction and a boundary cutting instruction; the intermediate printed document is subjected to rendering tree stripping processing based on the positioning culling instruction to obtain a net printed document; the net printed document is subjected to flow layout to physical paper cutting conversion processing based on the boundary cutting instruction to obtain ordered printed data under the target layout format.
[0121] In some implementations, the static solidification module 420 is also used to perform static dimensionality reduction of data state based on the virtual sandbox document to obtain a static sandbox document; wherein, the static sandbox document is a data solidification document formed by converting temporary input data stored in the browser memory into static tags; and attributes are removed from the static sandbox document to obtain the target sandbox document.
[0122] In some implementations, the static solidification module 420 is also used to traverse the input class nodes in the virtual sandbox document and obtain the current memory data of the input class nodes; and to perform static physical attribute conversion processing on the current memory data to obtain the static sandbox document.
[0123] In some implementations, the static solidification module 420 traverses all available nodes in the static sandbox document to obtain the editing attribute results of all available nodes; based on the editing attribute results, it performs node type conversion on all available nodes to obtain the target sandbox document.
[0124] For specific limitations regarding a document printing device, please refer to the limitations regarding a document printing method described above, which will not be repeated here. Each module in the aforementioned document printing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0125] In this embodiment, a document printing device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above-mentioned functions.
[0126] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application, such as... Figure 5As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processor can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on an external input / output device (such as a display device coupled to the interface). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations. Figure 5 Take a processor 10 as an example.
[0127] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.
[0128] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.
[0129] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0130] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0131] The computer device also includes an input device 30 and an output device 40. The processor 10, memory 20, input device 30, and output device 40 can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.
[0132] Input device 30 can receive input numerical or character information, and generate key signal inputs related to user settings and function control of the computer device, such as a touchscreen, keypad, mouse, trackpad, touchpad, joystick, one or more mouse buttons, trackball, joystick, etc. Output device 40 may include display devices, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibration motors). The aforementioned display devices include, but are not limited to, liquid crystal displays, light-emitting diodes, displays, and plasma displays. In some alternative embodiments, the display device may be a touchscreen.
[0133] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the methods shown in the above embodiments are implemented.
[0134] The apparatus, module, or unit described in the above embodiments can be implemented by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0135] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0136] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied 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.
[0137] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0138] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0139] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0140] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0141] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the apparatus embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0142] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
[0143] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A document printing method, characterized in that, The method includes: In response to the target print command of the original document, a free sandbox construction process is performed on the original document to obtain a virtual sandbox document; wherein, the virtual sandbox document is a virtual data copy independent of the original document; The virtual sandbox document is subjected to memory-state data solidification and editable attribute stripping to obtain the target sandbox document; wherein, the target sandbox document is segmented into at least two types of pages by at least one pagination class tag; at least two independent page number counters are maintained in memory; each page corresponds one-to-one with the independent page number counter; Based on a preset matching dictionary, pagination class tag detection is performed on the target sandbox document to obtain page type results; Based on the page type result, the independent page number counters are incremented to obtain the target page number value of the page in the target sandbox document; Based on the preset page number positioning selector, the original text page number in the target sandbox document is overwritten using the target page number value of the page to obtain the intermediate print document; Based on the intermediate print document, interactive node removal and physical pagination are performed to obtain ordered print data; The printing interface is invoked to perform printing processing based on the ordered printing data in order to complete the target printing task.
2. The method according to claim 1, characterized in that, The process of removing interactive nodes and performing physical pagination based on the intermediate printed document to obtain the ordered printed data includes: A set of node instructions is injected into the header of the intermediate printed document; wherein the set of node instructions includes positioning and culling instructions and boundary cutting instructions. The intermediate printed document is stripped of its rendering tree based on the location and culling instructions to obtain the clean printed document. Based on the boundary cutting instructions, the net printed document is converted from a flowing layout to physical paper to obtain the ordered printed data under the target layout format.
3. The method according to claim 1, characterized in that, The process of solidifying memory-state data and stripping editable attributes from the virtual sandbox document to obtain the target sandbox document includes: Based on the virtual sandbox document, static dimensionality reduction of data state is performed to obtain a static sandbox document; wherein, the static sandbox document is a data solidification document formed by converting temporary input data stored in browser memory into static tags; The static sandbox document is modified by removing its attributes to obtain the target sandbox document.
4. The method according to claim 3, characterized in that, The step of statically reducing the dimensionality of data states based on the virtual sandbox document to obtain a static sandbox document includes: Traverse the input class nodes in the virtual sandbox document and obtain the current memory data of the input class nodes; The current memory data is subjected to static physical attribute transformation processing to obtain a static sandbox document.
5. The method according to claim 3, characterized in that, The step of removing attributes from the static sandbox document to obtain the target sandbox document includes: Traverse all available nodes in the static sandbox document to obtain the edit attribute results of all available nodes; Based on the edit attribute results, all available nodes are converted to different node types to obtain the target sandbox document.
6. A document printing device, characterized in that, The device includes: A sandbox construction module is used to respond to the target print command of the original document and perform free sandbox construction processing on the original document to obtain a virtual sandbox document; wherein, the virtual sandbox document is a virtual data copy independent of the original document; A static data solidification module is used to solidify the virtual sandbox document in memory and strip editable attributes to obtain a target sandbox document; wherein, the target sandbox document is cut into at least two types of pages by at least one pagination class tag; at least two independent page number counters are maintained in memory; each page corresponds one-to-one with the independent page number counter; The page number refresh module is used to perform pagination category marker detection on the target sandbox document based on a preset matching dictionary to obtain page type results; perform page number increment processing on the independent page number counters based on the page type results to obtain the target page number value of the page in the target sandbox document; overwrite the original text page numbers in the target sandbox document using the target page number value of the page based on a preset page number positioning selector to obtain an intermediate print document; and perform interactive node removal and physical pagination processing on the intermediate print document to obtain ordered print data. The printing processing module is used to call the printing interface to perform printing processing based on the ordered printing data in order to complete the target printing task.
7. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the document printing method of any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the document printing method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Browser multi-engine adaptive printing method, system, equipment and medium
CN121255116A