Dynamic setting method and system for OFD document text watermark method

CN123013851APending Publication Date: 2026-10-30WIN THE BID HUIKANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611159788.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-02
Publication Date
2026-10-30

AI Technical Summary

Technical Problem

当采用Canvas绘制方式时,文档页面中的文本、图形和水印等元素均被绘制为图形内容,导致水印内容无法单独控制或动态更新

Benefits of technology

[0047]第一,通过HTML5的text元素实现水印展示,无需依赖Canvas绘制方式,避免重新绘制整个页面内容;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123013851A_ABST
    Figure CN123013851A_ABST
Patent Text Reader

Abstract

The application discloses an OFD document text watermark method, a dynamic setting method and a system. An OFD document is loaded in a browser environment, and document page structure information is extracted from the OFD document. According to the document page structure information, an HTML page element set is generated. According to a document object model of the OFD document and the HTML page element set, an HTML5 text element for displaying a watermark is constructed. Configuration parameters are set, and elements are superimposed and displayed on an OFD document page, so that a text watermark is formed. According to a watermark change request, target content of the watermark change is determined. According to the target content of the watermark change, an HTML5 text element attribute is modified, so that the text watermark is changed. The HTML5 text element is dynamically generated as a basis for dynamically updating the text watermark, so that the OFD document dynamic text watermark change in the browser environment is realized, the flexibility of the text watermark update is improved, and the browser resource consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of document processing, and in particular to a method and system for dynamically setting text watermarks in OFD documents. Background Technology

[0002] Open Fixed-layout Documents (OFDs), as a national standard document format, are primarily used in formal settings such as electronic documents. OFD documents are displayed in two main ways: First, the server pre-parses the OFD document and converts it into images or graphic formats such as Canvas and SVG, then loads and displays it page by page over the network. Second, the browser parses the OFD document and displays its content on the browser page using Canvas rendering. When parsing and loading page by page via the server, the browser needs to frequently interact with the network during the user's browsing process, making it highly dependent on the network environment. When using Canvas rendering, text, graphics, and watermarks on the document page are all rendered as graphic content, making it impossible to control or dynamically update watermark content independently. In Canvas rendering mode, modifying watermark content usually requires redrawing the entire page, resulting in significant performance overhead. Furthermore, the existing OFD document standard does not define a dedicated watermark element, making it difficult to implement flexible watermark control in the browser. Therefore, how to dynamically set text watermarks for OFD documents in the browser environment and avoid redrawing the entire page content has become a pressing technical problem that needs to be solved in the early stages. Summary of the Invention

[0003] Considering that the existing OFD document display method requires a complete redraw of the page content to dynamically set the text watermark in the browser environment, the text watermark update efficiency is reduced and the browser resource consumption is increased.

[0004] In view of the above problems, the present invention provides a method for dynamically setting OFD document text watermarks, including:

[0005] Load the OFD document in the browser environment and extract the document page structure information from the OFD document; generate an HTML page element set based on the document page structure information;

[0006] Based on the document object model of the OFD document and the set of HTML page elements, construct an HTML5 text element for displaying the watermark;

[0007] Configure the HTML5 text element to overlay the HTML5 text element onto the OFD document page, thereby forming a text watermark;

[0008] Based on the watermark change request, determine the target content for watermark change; based on the target content for watermark change, modify the attributes of the HTML5 text element to change the text watermark.

[0009] Optionally, an OFD document is loaded in a browser environment, and document page structure information is extracted from the OFD document; based on the document page structure information, an HTML page element set is generated, including:

[0010] Obtain the current loading task execution process in the browser environment; determine the timing of loading task changes in the browser environment based on the loading task execution process; and add the OFD document to the loading task queue after converting it into a loading task based on the loading task change timing.

[0011] The OFD document is subjected to page structure recognition to obtain page structure element mapping information; wherein, the page structure element mapping information includes the mapping relationship of all structural element types and their positions in each page of the OFD document;

[0012] Construct a document object model for the OFD document, and generate an HTML page element set in the document object model based on the page structure element mapping information; wherein, the HTML page element set includes the element set corresponding to each structure element under the OFD document after the HTML page scene transformation.

[0013] Optionally, based on the document object model of the OFD document and the set of HTML page elements, an HTML5 text element for displaying the watermark is constructed, including:

[0014] The set of HTML page elements is extracted from the document object model of the OFD document, and the set of HTML page elements is distinguished by element type to obtain several subsets of HTML page elements; wherein all HTML page elements under each subset of HTML page elements have the same element type attribute.

[0015] Based on the element type attribute corresponding to each subset of HTML page elements, the text of all HTML page elements under each subset of HTML page elements is converted and edited to generate HTML5 text elements for displaying watermarks.

[0016] Optionally, the configuration parameters of the HTML5 text element are set to overlay the HTML5 text element onto the OFD document page, thereby forming a text watermark, including:

[0017] Based on the visual requirements parameters of the watermark, the configuration parameters of the HTML5 text element are set synchronously; wherein, the visual requirements parameters of the watermark include the font size, font color, font transparency, font rotation angle, and watermark spacing of the watermark text content; the configuration parameters include the text content, font style, transparency, rotation angle, and arrangement of the HTML5 text element;

[0018] The coordinates of the text watermark formation position are marked on the OFD document page. Based on the coordinates, the HTML5 text element is aligned with the corresponding grid lines on the OFD document page, and thus overlaid on the OFD document page to form a text watermark.

[0019] Optionally, based on the watermark change request, the target content for watermark change is determined; based on the target content for watermark change, the attributes of the HTML5 text element are modified to change the text watermark, including:

[0020] The watermark change request is parsed to extract the target value of the watermark visual requirement parameter change for the text watermark; based on the target value of the watermark visual requirement parameter change, the target content of the watermark change is determined; wherein, the target content of the watermark change includes the category of the watermark configuration parameter to be changed and its target value.

[0021] Based on the target content of the watermark change, a new element attribute value is generated to overwrite the original attribute value of the HTML5 text element, thereby changing the text watermark.

[0022] As one aspect of the present invention, embodiments of the present invention also provide a dynamic setting system for OFD document text watermarking, including:

[0023] The document loading and parsing module is used to load OFD documents in the browser environment and parse and extract document page structure information from the OFD documents;

[0024] The page element generation module is used to generate a set of HTML page elements based on the document page structure information;

[0025] The text element construction module is used to construct an HTML5 text element for displaying the watermark based on the document object model of the OFD document and the set of HTML page elements.

[0026] The configuration parameter setting module is used to set the configuration parameters of the HTML5 text element;

[0027] A watermark display module is used to overlay the HTML5 text element onto the OFD document page to form a text watermark.

[0028] The watermark changing module is used to determine the target content for watermark changing based on the watermark changing request; and to modify the attributes of the HTML5 text element based on the target content for watermark changing, thereby changing the text watermark.

[0029] Optionally, the document loading and parsing module is used to load an OFD document in a browser environment and parse and extract document page structure information from the OFD document, including:

[0030] Obtain the current loading task execution process in the browser environment; determine the timing of loading task changes in the browser environment based on the loading task execution process; and add the OFD document to the loading task queue after converting it into a loading task based on the loading task change timing.

[0031] The OFD document is subjected to page structure recognition to obtain page structure element mapping information; wherein, the page structure element mapping information includes the mapping relationship of all structural element types and their positions in each page of the OFD document;

[0032] The page element generation module is used to generate a set of HTML page elements based on the document page structure information, including:

[0033] Construct a document object model for the OFD document, and generate an HTML page element set in the document object model based on the page structure element mapping information; wherein, the HTML page element set includes the element set corresponding to each structure element under the OFD document after the HTML page scene transformation.

[0034] Optionally, the text element construction module is used to construct an HTML5 text element for displaying the watermark based on the document object model of the OFD document and the set of HTML page elements, including:

[0035] The set of HTML page elements is extracted from the document object model of the OFD document, and the set of HTML page elements is distinguished by element type to obtain several subsets of HTML page elements; wherein all HTML page elements under each subset of HTML page elements have the same element type attribute.

[0036] Based on the element type attribute corresponding to each subset of HTML page elements, the text of all HTML page elements under each subset of HTML page elements is converted and edited to generate HTML5 text elements for displaying watermarks.

[0037] Optionally, the configuration parameter setting module is used to set the configuration parameters of the HTML5 text element, including:

[0038] Based on the visual requirements parameters of the watermark, the configuration parameters of the HTML5 text element are set synchronously; wherein, the visual requirements parameters of the watermark include the font size, font color, font transparency, font rotation angle, and watermark spacing of the watermark text content; the configuration parameters include the text content, font style, transparency, rotation angle, and arrangement of the HTML5 text element;

[0039] The watermark display module is used to overlay the HTML5 text element onto the OFD document page to form a text watermark, including:

[0040] The coordinates of the text watermark formation position are marked on the OFD document page. Based on the coordinates, the HTML5 text element is aligned with the corresponding grid lines on the OFD document page, and thus overlaid on the OFD document page to form a text watermark.

[0041] Optionally, the watermark changing module is used to determine the target content for watermark changing based on the watermark changing request; and to modify the attributes of the HTML5 text element according to the target content for watermark changing, thereby changing the text watermark, including:

[0042] The watermark change request is parsed to extract the target value of the watermark visual requirement parameter change for the text watermark; based on the target value of the watermark visual requirement parameter change, the target content of the watermark change is determined; wherein, the target content of the watermark change includes the category of the watermark configuration parameter to be changed and its target value.

[0043] Based on the target content of the watermark change, a new element attribute value is generated to overwrite the original attribute value of the HTML5 text element, thereby changing the text watermark.

[0044] The beneficial effects of the above-mentioned technical solutions provided in the embodiments of the present invention include at least the following:

[0045] This invention provides a method and system for dynamically setting text watermarks in OFD documents. The system loads an OFD document in a browser environment and extracts its page structure information through parsing. Based on this information, it generates a set of HTML page elements. Using the OFD document's document object model and the set of HTML page elements, it constructs an HTML5 text element for displaying the watermark. It sets the configuration parameters of the HTML5 text element and overlays it onto the OFD document page to form the text watermark. Based on a watermark change request, it determines the target content for the watermark change. Then, based on the target content, it modifies the attributes of the HTML5 text element to change the watermark. By dynamically generating HTML5 text elements as the basis for dynamically updating the text watermark, it achieves dynamic text watermark changes in OFD documents within a browser environment, improving the flexibility of watermark updates and reducing browser resource consumption.

[0046] The OFD document text watermarking method and system of the present invention have the following advantages:

[0047] First, the watermark is displayed using the HTML5 text element, without relying on the Canvas drawing method, thus avoiding the need to redraw the entire page content.

[0048] Second, by managing the watermark as an independent HTML element, the watermark content can be dynamically updated without affecting the original content of the OFD document.

[0049] Third, it supports generating watermark effects directly in the browser without server-side involvement, thereby reducing network data interaction and improving system response speed;

[0050] Fourth, it can run and be implemented in browser environments on both PC and mobile devices, demonstrating good cross-platform compatibility;

[0051] Fifth, the watermark content can be modified by dynamically updating the attributes of the text element, thereby improving the watermark update efficiency and reducing browser resource consumption.

[0052] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.

[0053] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0054] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0055] Figure 1 This is a flowchart illustrating the dynamic setting method for OFD document text watermarking provided in this embodiment of the invention.

[0056] Figure 2 This is a schematic diagram of the structure of the OFD document text watermarking method dynamic setting system provided in this embodiment of the invention. Detailed Implementation

[0057] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0058] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," "outer," "far," "near," "front," and "rear," etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the accompanying drawings and are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0059] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0060] Please see Figure 1 As shown, an embodiment of this application provides a method for dynamically setting OFD document text watermarks. This method includes:

[0061] Load the OFD document in the browser environment and parse it to extract the document page structure information; generate a set of HTML page elements based on the document page structure information.

[0062] Based on the document object model of the OFD document and the set of HTML page elements, construct an HTML5 text element for displaying the watermark;

[0063] Configure the HTML5 text element to overlay the HTML5 text element onto the OFD document page, thereby creating a text watermark;

[0064] Based on the watermark change request, determine the target content for the watermark change; based on the target content for the watermark change, modify the attributes of the HTML5 text element to change the text watermark.

[0065] The beneficial effects of the above embodiments are that the OFD document text watermarking method dynamically sets the text watermark by dynamically generating HTML5 text elements as the basis for dynamically updating the text watermark, thereby realizing dynamic text watermark changes in OFD documents in the browser environment, improving the flexibility of text watermark updates and reducing browser resource consumption.

[0066] In another embodiment, an OFD document is loaded in a browser environment, and document page structure information is extracted from the OFD document through parsing; based on the document page structure information, a set of HTML page elements is generated, including:

[0067] Get the current loading task execution process in the browser environment, determine the timing of loading task changes based on the loading task execution process, and add the OFD document to the loading task queue after converting it into a loading task based on the loading task change timing.

[0068] Page structure recognition is performed on OFD documents to obtain page structure element mapping information; the page structure element mapping information includes the mapping relationship of all types of structure elements and their locations in each page of the OFD document;

[0069] Construct a document object model for the OFD document, and generate an HTML page element set in the document object model based on the page structure element mapping information; wherein, the HTML page element set includes the element set corresponding to each structural element under the OFD document after transformation in the HTML page scene.

[0070] The beneficial effects of the above embodiments are that OFD documents contain a large amount of heterogeneous data such as text and images. Loading these documents in a browser environment requires the browser to call corresponding resources. Furthermore, the browser itself loads other documents during its operation, meaning it forms a corresponding loading task queue, and the browser consumes its own resources while executing these loading tasks. To ensure efficient and smooth loading of OFD documents in the browser environment, it is necessary to predict the resource consumption rate of the browser environment during each loading task execution process based on the current loading task execution progress. Then, based on this resource consumption rate, the timing for changing the loading tasks in the browser environment needs to be determined. This timing can be, but is not limited to, the time interval with the lowest resource consumption rate during the loading task execution process in the browser environment. After converting the OFD document into a loading task compatible with the browser environment, it is added to the loading task queue within the aforementioned time interval, ensuring that the OFD document loading task receives timely and sufficient resources for execution in the browser environment.

[0071] An OFD document contains multiple pages, each with significantly different content structures. To adapt the entire OFD document to browser-friendly page elements, the page structure is first identified, mapping the types and locations of all structural elements on each page. This allows for accurate representation of the attributes and spatial positions of each structural element. Next, a Document Object Model (DOM) is constructed for the OFD document. This DOM parses the OFD document into a node tree containing elements such as tags and text. Each node corresponds to a specific element and provides operation methods and attributes, supporting dynamic modification of the document structure, content, and style. Based on this mapping, an HTML page element set is generated within the DOM. This integrates the elements corresponding to each structural element in the OFD document after transformation into the HTML page scenario, providing a foundation for the subsequent construction of HTML5 text elements.

[0072] In another embodiment, an HTML5 text element for displaying the watermark is constructed based on the document object model of the OFD document and the set of HTML page elements, including:

[0073] Extract the set of HTML page elements from the document object model of the OFD document, distinguish the element types of the set of HTML page elements, and obtain several subsets of HTML page elements; among them, all HTML page elements under each subset of HTML page elements have the same element type attribute.

[0074] Based on the element type attribute corresponding to each subset of HTML page elements, the text of all HTML page elements under each subset of HTML page elements is converted and edited to generate HTML5 text elements for displaying watermarks.

[0075] The beneficial effects of the above embodiments are understood to be that the HTML page element set includes various types of page elements. Different types of page elements require different algorithms for text conversion. If each HTML page element is converted to text form individually, the algorithm needs to be repeatedly called, undoubtedly increasing the algorithm call frequency and resource consumption, which is not conducive to quickly converting each page element in the HTML page element set into a text element. Specifically, the HTML page element set is extracted from the document object model of the OFD document, and the HTML page element set is distinguished by element type to obtain several HTML page element subsets, ensuring that all page elements under each HTML page element subset have the same element type attribute. Furthermore, based on the element type attribute corresponding to each HTML page element subset, an appropriate algorithm is selected to perform text conversion and editing on all HTML page elements under each HTML page element subset, generating HTML5 text elements for displaying watermarks, ensuring accurate matching between the HTML5 text elements and the HTML page elements.

[0076] In another embodiment, configuration parameters for the HTML5 text element are set to overlay the HTML5 text element onto the OFD document page, thereby forming a text watermark, including:

[0077] Based on the visual requirements of the watermark, the configuration parameters of the HTML5 text element are set synchronously. The visual requirements of the watermark include the font size, font color, font transparency, font rotation angle, and watermark spacing of the watermark text content. The configuration parameters include the text content, font style, transparency, rotation angle, and arrangement of the HTML5 text element.

[0078] The text watermark is positioned by marking its location coordinates on the OFD document page. Based on these coordinates, the HTML5 text element is aligned with the corresponding grid lines on the OFD document page, thus overlaying and displaying the watermark on the OFD document page.

[0079] The beneficial effects of the above embodiments are that, in order to create watermarks with diverse visual forms on OFD documents, it is necessary to synchronously set the configuration parameters of the HTML5 text element according to the user's visual requirements for the watermark on the OFD document. This ensures that the text content, font style, transparency, rotation angle, and arrangement of the HTML5 text element are compatible with the font size, font color, font transparency, font rotation angle, and watermark spacing of the watermark text content. Furthermore, the coordinates of the text watermark formation position are marked on the OFD document page. These coordinates can be, but are not limited to, the coordinates of all points on the outermost edge of the space where the text watermark needs to be formed on the document page. Then, based on these coordinates, the HTML5 text element is aligned with the corresponding grid lines within the OFD document page, thus overlaying and displaying it on the OFD document page to form the text watermark, ensuring that the watermark is formed at the corresponding page position on the OFD document page.

[0080] In another embodiment, based on the watermark change request, the target content for watermark change is determined; based on the target content for watermark change, the attributes of the HTML5 text element are modified to change the text watermark, including:

[0081] The watermark change request is parsed to extract the target value of the watermark visual requirement parameter change for the text watermark; based on the target value of the watermark visual requirement parameter change, the target content of the watermark change is determined; the target content of the watermark change includes the category of watermark configuration parameters that need to be changed and their target values.

[0082] Based on the target content of the watermark change, new element attribute values ​​are generated to override the original attribute values ​​of the HTML5 text element, thereby changing the text watermark.

[0083] The beneficial effects of the above embodiments are that the watermark on the OFD document page is adapted and generated with the HTML5 text element. It is understood that changes in the HTML5 text element will directly lead to changes in the watermark. In order to achieve flexible changes to the watermark on the OFD document page, the target values ​​for changing the visual requirements parameters of the text watermark are extracted from the watermark change request. The target values ​​for changing the visual requirements parameters of the watermark can be, but are not limited to, the target values ​​that need to be adjusted to for at least one of the following: font size, font color, font transparency, font rotation angle, and watermark spacing. This determines the category of watermark configuration parameters that need to be changed and their target values, thereby generating new element attribute values ​​and overwriting the original attribute values ​​of the HTML5 text element with the new element attribute values, thereby changing the text watermark. This can improve the flexibility of text watermark updates and reduce browser resource consumption.

[0084] In one embodiment, setting the configuration parameters of the HTML5 text element can be specifically implemented as follows:

[0085] Obtain the font size parameter from the visual requirements parameters of the watermark. Transparency parameters and reference spacing parameters And obtain the page rendering width parameter of the currently parsed page of the OFD document. and page rendering height parameters ;

[0086] Count the number of characters in the text content of the watermark. And count the total number of characters in the non-empty text nodes of the currently parsed page, based on the page rendering height. With the page rendering width The product of these values ​​is used as the page area, based on the font size parameter. The square of the value multiplied by the empirical ratio of 0.6 is used as the average area occupied by a single character. The page area is then divided by the average area occupied by a single character to obtain the theoretical maximum number of characters that can be accommodated. Finally, the total number of characters in the non-empty text nodes is divided by the theoretical maximum number of characters that can be accommodated to obtain the content density coefficient of the currently parsed page. ;

[0087] According to the font size parameters The page rendering height The number of characters The transparency parameter and the content density coefficient Determine the visual pixel density index (VPDI) of the watermark;

[0088] Specifically, VPDI can be determined using the following formula:

[0089]

[0090] Among them, the constant 10 is the normalization constant for the number of baseline characters, which is dimensionless and used to normalize the number of characters. Normalized to a dimensionless pure numerical value;

[0091] Based on the watermark visual pixel density index VPDI and the reference spacing parameter Determine the dynamically adjusted watermark spacing ;

[0092] Specifically, S can be determined using the following formula:

[0093]

[0094] The calculated watermark spacing As a configuration parameter for the arrangement of the HTML5 text element, it controls the density of the text watermark on the page;

[0095] When a watermark change request is received, the updated font size parameters are extracted again from the target content of the watermark change. The transparency parameter The reference spacing parameters And re-obtain the page rendering width of the currently parsed page. and the page rendering height Recalculate the total number of characters in the non-empty text nodes of the currently parsed page and recalculate the content density coefficient. Recalculate the watermark spacing With the updated watermark spacing This overrides the original spacing attribute of the HTML5 text element, thereby changing the density of the text watermark.

[0096] Among them, the font size parameter The value is a positive integer in pixels, ranging from, for example, 12 to 120, and is directly read from the watermark visual requirement parameters; the transparency parameter The value is a real number, ranging from 0 to 1, and is directly read from the watermark visual requirement parameters; the reference spacing parameter The value is a positive integer in pixels, ranging from, for example, 20 to 200, and is either directly read from the watermark visual requirement parameters or preset by the system; the page rendering width The value is a positive number in pixels, obtained from the same source in the Document Object Model (DOM) page layout information generated after the browser parses the OFD document; the page rendering height... The number is a positive number in pixels, obtained from the same source in the document object model page layout information; the number of characters The content density coefficient is a non-negative integer, obtained by taking the length attribute of the watermark text string; The value is a real number, ranging from 0 to 1; the VPDI is a dimensionless non-negative real number; the watermark spacing... It is a positive real number in pixels, and its value range is preferably, for example, the reference spacing. 1.0 to 1.78 times.

[0097] The above technical solution, when setting watermark spacing, first obtains the rendering size from the currently parsed page and, combined with the watermark's font size, transparency, number of characters, and page content density coefficient, calculates a visual pixel density index. This index is then used to logarithmically scale the baseline spacing, allowing the spacing to adaptively adjust to page size and content volume. When a watermark change request occurs, the above parameters are retrieved again and the spacing is recalculated, directly overriding the original spacing style of the text element. The advantage of this approach is that spacing adjustments only involve modifying CSS styles, without triggering page reflow or repaint. Compared to the traditional Canvas method, which requires redrawing the entire page with every change, this reduces the browser's computational burden and avoids the problem of watermarks obscuring the text due to overly dense spacing or losing their warning effect due to overly sparse spacing.

[0098] In another embodiment, setting the configuration parameters of the HTML5 text element may further include the following process:

[0099] Obtain the font size parameter from the visual requirements parameters of the watermark. And obtain the page rendering width parameter of the currently parsed page of the OFD document. and page rendering height parameters ;

[0100] According to the page rendering width and the page rendering height Determine the page aspect ratio normalization factor of the currently parsed page. ;

[0101] Specifically, the page aspect ratio normalization factor can be calculated according to the following formula. :

[0102]

[0103] According to the font size parameters The page rendering width and the page aspect ratio normalization factor Determine the watermark anti-counterfeiting interference factor WAF;

[0104] Specifically, the watermark anti-counterfeiting interference factor (WAF) can be calculated using the following formula:

[0105]

[0106] Where k is the logistic curve steepness adjustment constant, which is dimensionless and determined through experimental optimization; The scaling factor is dimensionless and used to scale... The ratio is amplified to the sensitive range of the logistic function;

[0107] Based on the watermark anti-counterfeiting interference factor WAF, and the minimum angle corresponding to the minimum lower limit of the watermark rotation angle. The preset watermark rotation angle is an adjustable value above the minimum angle. The dynamically adjusted watermark rotation angle is calculated according to the following formula. :

[0108]

[0109] The calculated watermark rotation angle As a rotation angle configuration parameter for the HTML5 text element, it controls the tilt direction and degree of the text watermark on the page.

[0110] Specifically, when a watermark change request is received, the updated font size parameters are extracted again from the target content of the watermark change. And re-obtain the page rendering width of the currently parsed page. and the page rendering height Recalculate the page aspect ratio normalization factor. Recalculate the watermark rotation angle With the updated watermark rotation angle Override the original rotation angle attribute of the HTML5 text element to change the tilt posture of the text watermark;

[0111] The font size parameters The value is a positive integer in pixels, ranging from, for example, 12 to 120, and is directly read from the watermark visual requirement parameters; the page rendering width The value is a positive number in pixels, obtained directly from the document object model page layout information generated after the browser parses the OFD document; the page rendering height... A positive number in pixels, obtained directly from the document object model page layout information; the page aspect ratio normalization factor. The value is a dimensionless real number, ranging from 0 to 1; the WAF is a dimensionless real number; the watermark rotation angle It is a real number expressed in degrees.

[0112] In the above formula, k is the logistic curve steepness adjustment constant, used to control the sensitivity of the watermark anti-counterfeiting interference factor WAF to changes in the input variable (i.e., the percentage of font size to page width minus the aspect ratio normalization factor). The larger the value of k, the more drastic the change of WAF near the critical point, and the steeper the adjustment of the rotation angle; the smaller the value of k, the smoother the change of WAF, and the gentler the adjustment of the rotation angle. k is a dimensionless constant, and its preferred value is 0.15, preferably between 0.1 and 0.2. If the value of k is too large (e.g., close to 1), small fluctuations in the input variable will cause a significant jump in the rotation angle, affecting the visual continuity of the watermark display; if the value of k is too small (e.g., close to 0.01), the WAF hardly changes with the input variable, and the rotation angle always remains near the middle value, failing to achieve effective adaptive adjustment.

[0113] α is a scaling factor used to amplify the ratio of font size to page width, f / w, to a range within which the logistic function can effectively respond. Since font size f is typically between 12 and 120 pixels, and page width w is typically between 800 and 1920 pixels, the typical range of f / w is very small. If directly substituted into the logistic function, the input variable will always remain within an extremely narrow range close to zero, resulting in very limited variation in the WAF and an inability to effectively respond to changes in page size. Multiplying by α amplifies the ratio to the same order of magnitude as the page aspect ratio normalization factor u, thus ensuring that the result of subtracting the two effectively covers the sensitive range of the logistic function. α is a dimensionless constant, preferably 100, with a range between 50 and 200.

[0114] Γ represents the minimum lower limit of the watermark rotation angle. It defines the minimum rotation angle of the watermark, ensuring that the tilt angle of the watermark text will not fall below γ regardless of changes in page aspect ratio and font size. This lower limit is set because if the watermark rotation angle is too small, the watermark text will be nearly horizontal, easily confused with the horizontal text direction of the OFD document body. This reduces the visual distinction between the text and the watermark, weakening the watermark's warning and anti-counterfeiting effects. γ is measured in degrees, with a preferred value of 15°. The value range is between 10° and 20°, preset by the system, but can be adjusted within this range by those skilled in the art based on actual application scenarios.

[0115] β is the adjustable amplitude of the watermark rotation angle, which defines the adjustable range of the watermark rotation angle above the minimum lower limit γ, so that the maximum upper limit of the final rotation angle reaches γ + β. β is in degrees, with a preferred value of 30°, and a range between 20° and 40°. Using 30° as the adjustment amplitude means that when WAF = 0, the rotation angle is γ (i.e., 15°), and when WAF = 1, the rotation angle is γ + β (i.e., 45°). When WAF continuously changes between 0 and 1, the angle adjusts smoothly between 15° and 45° accordingly. This covers the most classic and widely used 45° tilt angle in the watermarking field, while also retaining downward adjustment space in the 15° direction, allowing the watermark to be appropriately corrected when the page is wide or the font is small, avoiding visual discomfort caused by excessive tilting. β is preset by the system.

[0116] The above technical solution, when setting the watermark rotation angle, calculates an anti-counterfeiting interference factor based on the aspect ratio of the currently parsed page and the ratio of the font size to the page width using a logistic function. This factor is then mapped to a preset minimum and maximum angle, allowing the watermark tilt angle to change non-linearly and continuously with the page aspect ratio. When a change occurs, the page size and font size are re-acquired, the angle is recalculated, and the rotation property of the text element is updated. Since adjusting the rotation angle only involves CSS property overriding and does not require redrawing the page content, the update speed is fast and resource consumption is low. Simultaneously, this solution allows the watermark to automatically adjust to a suitable tilt posture on pages with different screen ratios, avoiding confusion with the direction of the main text due to an angle that is too small, and avoiding affecting visual recognizability due to an angle that is too large or too small, thus maintaining the effectiveness of the watermark without sacrificing the reading experience.

[0117] Please see Figure 2 As shown, an embodiment of this application provides a dynamic setting system for OFD document text watermarking. This dynamic setting system for OFD document text watermarking includes:

[0118] The document loading and parsing module is used to load OFD documents in the browser environment and extract document page structure information from the OFD documents.

[0119] The page element generation module is used to generate a set of HTML page elements based on the document page structure information;

[0120] The text element building module is used to construct HTML5 text elements for displaying watermarks based on the document object model of the OFD document and the collection of HTML page elements.

[0121] The configuration parameter setting module is used to set the configuration parameters of HTML5 text elements;

[0122] The watermark display module is used to overlay HTML5 text elements onto the OFD document page to create a text watermark.

[0123] The watermark changing module is used to determine the target content for watermark changing based on the watermark change request; and to modify the HTML5 text element attributes based on the target content for watermark changing, thereby changing the text watermark.

[0124] The beneficial effects of the above embodiments are that the OFD document text watermarking method dynamic setting system dynamically generates HTML5 text elements as the basis for dynamically updating text watermarks, realizes dynamic text watermark changes in OFD documents in the browser environment, improves the flexibility of text watermark updates and reduces browser resource consumption.

[0125] In another embodiment, the document loading and parsing module is used to load an OFD document in a browser environment and extract document page structure information from the OFD document, including:

[0126] Get the current loading task execution process in the browser environment, determine the timing of loading task changes based on the loading task execution process, and add the OFD document to the loading task queue after converting it into a loading task based on the loading task change timing.

[0127] Page structure recognition is performed on OFD documents to obtain page structure element mapping information; the page structure element mapping information includes the mapping relationship of all types of structure elements and their locations in each page of the OFD document;

[0128] The page element generation module is used to generate a set of HTML page elements based on the document page structure information, including:

[0129] Construct a document object model for the OFD document, and generate an HTML page element set in the document object model based on the page structure element mapping information; wherein, the HTML page element set includes the element set corresponding to each structural element under the OFD document after transformation in the HTML page scene.

[0130] In another embodiment, the text element building module is used to construct an HTML5 text element for displaying the watermark based on the document object model of the OFD document and the set of HTML page elements, including:

[0131] Extract the set of HTML page elements from the document object model of the OFD document, distinguish the element types of the set of HTML page elements, and obtain several subsets of HTML page elements; among them, all HTML page elements under each subset of HTML page elements have the same element type attribute.

[0132] Based on the element type attribute corresponding to each subset of HTML page elements, the text of all HTML page elements under each subset of HTML page elements is converted and edited to generate HTML5 text elements for displaying watermarks.

[0133] In another embodiment, the configuration parameter setting module is used to set configuration parameters for HTML5 text elements, including:

[0134] Based on the visual requirements of the watermark, the configuration parameters of the HTML5 text element are set synchronously. The visual requirements of the watermark include the font size, font color, font transparency, font rotation angle, and watermark spacing of the watermark text content. The configuration parameters include the text content, font style, transparency, rotation angle, and arrangement of the HTML5 text element.

[0135] The watermark display module is used to overlay HTML5 text elements onto an OFD document page to create a text watermark, including:

[0136] The text watermark is positioned by marking its location coordinates on the OFD document page. Based on these coordinates, the HTML5 text element is aligned with the corresponding grid lines on the OFD document page, thus overlaying and displaying the watermark on the OFD document page.

[0137] In another embodiment, the watermark changing module is used to determine the target content for watermark changing based on the watermark changing request; and to modify the attributes of the HTML5 text element according to the target content for watermark changing, thereby changing the text watermark, including:

[0138] The watermark change request is parsed to extract the target value of the watermark visual requirement parameter change for the text watermark; based on the target value of the watermark visual requirement parameter change, the target content of the watermark change is determined; the target content of the watermark change includes the category of watermark configuration parameters that need to be changed and their target values.

[0139] Based on the target content of the watermark change, new element attribute values ​​are generated to override the original attribute values ​​of the HTML5 text element, thereby changing the text watermark.

[0140] The OFD document text watermarking method dynamic setting system of the present invention has the same operation and effect as the OFD document text watermarking method dynamic setting method described above, and will not be described again here.

[0141] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. This disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims. Thus, if these modifications and variations of the invention fall within the scope of the claims of the invention and their equivalents, the invention is also intended to include these modifications and variations.

Claims

1. A method for dynamically setting OFD document text watermarks, characterized in that, include: Load the OFD document in the browser environment and parse and extract the document page structure information from the OFD document; Based on the document page structure information, generate a set of HTML page elements; Based on the document object model of the OFD document and the set of HTML page elements, construct an HTML5 text element for displaying the watermark; Configure the HTML5 text element to overlay the HTML5 text element onto the OFD document page, thereby forming a text watermark; Based on the watermark change request, determine the target content of the watermark change; Based on the target content of the watermark change, modify the attributes of the HTML5 text element to change the text watermark.

2. The method for dynamically setting OFD document text watermarks as described in claim 1, characterized in that: Load the OFD document in the browser environment and parse and extract the document page structure information from the OFD document; generate an HTML page element set based on the document page structure information, including: Obtain the current loading task execution process in the browser environment; determine the timing of loading task changes in the browser environment based on the loading task execution process; and add the OFD document to the loading task queue after converting it into a loading task based on the loading task change timing. The OFD document is subjected to page structure recognition to obtain page structure element mapping information; wherein, the page structure element mapping information includes the mapping relationship of all structural element types and their positions in each page of the OFD document; Construct a document object model for the OFD document, and generate an HTML page element set in the document object model based on the page structure element mapping information; wherein, the HTML page element set includes the element set corresponding to each structure element under the OFD document after the HTML page scene transformation.

3. The method for dynamically setting OFD document text watermarks as described in claim 1, characterized in that: Based on the document object model of the OFD document and the set of HTML page elements, an HTML5 text element for displaying the watermark is constructed, including: The set of HTML page elements is extracted from the document object model of the OFD document, and the set of HTML page elements is distinguished by element type to obtain several subsets of HTML page elements; wherein all HTML page elements under each subset of HTML page elements have the same element type attribute. Based on the element type attribute corresponding to each subset of HTML page elements, the text of all HTML page elements under each subset of HTML page elements is converted and edited to generate HTML5 text elements for displaying watermarks.

4. The method for dynamically setting OFD document text watermarks as described in claim 1, characterized in that: Setting the configuration parameters of the HTML5 text element to overlay the HTML5 text element onto the OFD document page, thereby forming a text watermark, includes: Based on the visual requirements parameters of the watermark, the configuration parameters of the HTML5 text element are set synchronously; wherein, the visual requirements parameters of the watermark include the font size, font color, font transparency, font rotation angle, and watermark spacing of the watermark text content; the configuration parameters include the text content, font style, transparency, rotation angle, and arrangement of the HTML5 text element; The coordinates of the text watermark formation position are marked on the OFD document page. Based on the coordinates, the HTML5 text element is aligned with the corresponding grid lines on the OFD document page, and thus overlaid on the OFD document page to form a text watermark.

5. The method for dynamically setting OFD document text watermarks as described in claim 1, characterized in that: Based on the watermark change request, determine the target content of the watermark change; Based on the target content of the watermark change, modify the attributes of the HTML5 text element to change the text watermark, including: The watermark change request is parsed to extract the target value of the watermark visual requirement parameter change for the text watermark; based on the target value of the watermark visual requirement parameter change, the target content of the watermark change is determined; wherein, the target content of the watermark change includes the category of the watermark configuration parameter to be changed and its target value. Based on the target content of the watermark change, a new element attribute value is generated to overwrite the original attribute value of the HTML5 text element, thereby changing the text watermark.

6. An OFD document text watermarking method dynamic setting system, characterized in that, include: The document loading and parsing module is used to load OFD documents in the browser environment and parse and extract document page structure information from the OFD documents; The page element generation module is used to generate a set of HTML page elements based on the document page structure information; The text element construction module is used to construct an HTML5 text element for displaying the watermark based on the document object model of the OFD document and the set of HTML page elements. The configuration parameter setting module is used to set the configuration parameters of the HTML5 text element; A watermark display module is used to overlay the HTML5 text element onto the OFD document page to form a text watermark. The watermark change module is used to determine the target content of the watermark change based on the watermark change request. Based on the target content of the watermark change, modify the attributes of the HTML5 text element to change the text watermark.

7. The OFD document text watermarking method dynamic setting system as described in claim 6, characterized in that: The document loading and parsing module is used to load OFD documents in the browser environment and parse and extract document page structure information from the OFD documents, including: Obtain the current loading task execution process in the browser environment; determine the timing of loading task changes in the browser environment based on the loading task execution process; and add the OFD document to the loading task queue after converting it into a loading task based on the loading task change timing. The OFD document is subjected to page structure recognition to obtain page structure element mapping information; wherein, the page structure element mapping information includes the mapping relationship of all structural element types and their positions in each page of the OFD document; The page element generation module is used to generate a set of HTML page elements based on the document page structure information, including: Construct a document object model for the OFD document, and generate an HTML page element set in the document object model based on the page structure element mapping information; wherein, the HTML page element set includes the element set corresponding to each structure element under the OFD document after the HTML page scene transformation.

8. The OFD document text watermarking method dynamic setting system as described in claim 6, characterized in that: The text element construction module is used to construct an HTML5 text element for displaying the watermark based on the document object model of the OFD document and the set of HTML page elements, including: The set of HTML page elements is extracted from the document object model of the OFD document, and the set of HTML page elements is distinguished by element type to obtain several subsets of HTML page elements; wherein all HTML page elements under each subset of HTML page elements have the same element type attribute. Based on the element type attribute corresponding to each subset of HTML page elements, the text of all HTML page elements under each subset of HTML page elements is converted and edited to generate HTML5 text elements for displaying watermarks.

9. The OFD document text watermarking method dynamic setting system as described in claim 6, characterized in that: The configuration parameter setting module is used to set the configuration parameters of the HTML5 text element, including: Based on the visual requirements parameters of the watermark, the configuration parameters of the HTML5 text element are set synchronously; wherein, the visual requirements parameters of the watermark include the font size, font color, font transparency, font rotation angle, and watermark spacing of the watermark text content; the configuration parameters include the text content, font style, transparency, rotation angle, and arrangement of the HTML5 text element; The watermark display module is used to overlay the HTML5 text element onto the OFD document page to form a text watermark, including: The coordinates of the text watermark formation position are marked on the OFD document page. Based on the coordinates, the HTML5 text element is aligned with the corresponding grid lines on the OFD document page, and thus overlaid on the OFD document page to form a text watermark.

10. The OFD document text watermarking method dynamic setting system as described in claim 6, characterized in that: The watermark changing module is used to determine the target content of the watermark change based on the watermark change request. Based on the target content of the watermark change, modify the attributes of the HTML5 text element to change the text watermark, including: The watermark change request is parsed to extract the target value of the watermark visual requirement parameter change for the text watermark; based on the target value of the watermark visual requirement parameter change, the target content of the watermark change is determined; wherein, the target content of the watermark change includes the category of the watermark configuration parameter to be changed and its target value. Based on the target content of the watermark change, a new element attribute value is generated to overwrite the original attribute value of the HTML5 text element, thereby changing the text watermark.