Watermark adding method and device

By converting the watermarks in web documents into two-dimensional vector diagrams and adding them to the target document, the problem of watermarks being easily deleted in the prior art is solved, and information security and display effect are improved.

CN119720135APending Publication Date: 2025-03-28ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311280868.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-28
Publication Date
2025-03-28

AI Technical Summary

Technical Problem

In the prior art, the watermarks in web documents are easily deleted by browser developer tools or other tools, and there is a problem of low information security.

Method used

By obtaining the text content of the watermark to be added to the target document, creating a text node for describing the watermark, and converting it, generating a two-dimensional vector diagram of the watermark, and finally adding it to the target document.

Benefits of technology

Improve the security of watermark information and prevent the watermark from being easily found or deleted. At the same time, because the two-dimensional vector graphics are easy to scale, image distortion is avoided, and the display effect and user experience of watermarks are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119720135A_ABST
    Figure CN119720135A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a watermark adding method and device. The watermark adding method comprises the steps of obtaining text content of a watermark to be added to a target document; creating a text node of the watermark according to the text content of the watermark; performing conversion processing on the text nodes to generate a two-dimensional vector diagram of the watermark; and adding the two-dimensional vector diagram of the watermark into the target document. According to the technical scheme provided by the embodiment of the invention, the security of the watermark information can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a watermark adding method and device. Background Art

[0002] In order to prevent web page information from being directly used, watermarks are usually added to web page documents to protect information security.

[0003] In the related art, since the watermark content added to the web page document is usually stored in the web page code in plain text, it can be easily deleted by the browser's developer tools or other tools, resulting in a problem of low information security. Summary of the invention

[0004] The embodiments of the present disclosure provide a method and device for adding a watermark.

[0005] According to a first aspect of the present disclosure, a method for adding a watermark is provided, the method comprising:

[0006] Get the text content of the watermark to be added to the target document;

[0007] According to the text content of the watermark, creating a text node for describing the text content;

[0008] Converting the text nodes to generate a two-dimensional vector diagram of the watermark;

[0009] The two-dimensional vector image of the watermark is added to the target document.

[0010] In some embodiments, converting the text node to generate the two-dimensional vector diagram of the watermark includes:

[0011] Generate a watermark expression according to a preset watermark template and the text node;

[0012] Encoding the watermark expression to generate a target character string;

[0013] A two-dimensional vector image of the watermark is generated according to the target character string.

[0014] In some embodiments, generating a watermark expression according to a preset watermark template and the text node includes:

[0015] According to the mapping relationship preset in the watermark template, the text node is mapped to obtain the node information of the picture node of the watermark; wherein the node information of the picture node at least includes the node character string of the picture node;

[0016] The watermark expression is generated according to the node information of the picture node.

[0017] In some embodiments, the text node is also used to describe the text attribute information of the watermark; the mapping process is performed on the text node according to the mapping relationship preset in the watermark template to obtain the node information of the picture node of the watermark, including:

[0018] According to the mapping relationship preset in the watermark template, the text content and text attribute information described by the text node are mapped to obtain the node information of the picture node.

[0019] In some embodiments, the node information of the picture node also includes picture attribute information; the mapping process is performed on the text content and the text attribute information described by the text node according to the mapping relationship preset in the watermark template to obtain the node information of the picture node, including:

[0020] According to a first mapping relationship preset in the watermark template, mapping the text content described by the text node to a node string of the image node;

[0021] Mapping the text attribute information described by the text node to the image attribute information of the image node according to a second mapping relationship preset in the watermark template;

[0022] The text attribute information includes at least one of the uniform resource identifier URI of the text node, text basic attributes and text transformation attributes; the text transformation attributes are used to generate the transformation effect of the text node.

[0023] In some embodiments, encoding the watermark expression to generate a target character string includes:

[0024] Performing URL encoding on the designated characters in the watermark expression to obtain URL encoded data;

[0025] Converting characters other than designated characters in the watermark expression and the URL encoded data into binary data;

[0026] The binary data is encoded according to a preset encoding rule to generate the target character string.

[0027] In some embodiments, encoding the binary data according to a preset encoding rule to generate the target character string includes:

[0028] Extracting a continuous character string of a preset length from the binary data;

[0029] The continuous character string extracted from the binary data is encoded according to the encoding rule to generate the target character string.

[0030] In some embodiments, generating the two-dimensional vector diagram of the watermark according to the target character string includes:

[0031] According to the target character string, create the picture node;

[0032] The image node is moved into a preset texture node to generate a two-dimensional vector image of the watermark.

[0033] In some embodiments, adding the two-dimensional vector image of the watermark to the target document includes:

[0034] The two-dimensional vector diagram of the watermark is added to the target document with a first transparency lower than a transparency threshold, wherein the transparency threshold is used to reduce the visual perception of the two-dimensional vector diagram in the target document.

[0035] According to a second aspect of the present disclosure, a watermark adding device is provided, the device comprising:

[0036] An acquisition module, used for acquiring the text content of the watermark to be added to the target document;

[0037] A creation module, used for creating a text node for describing the text content according to the text content of the watermark;

[0038] A conversion module, used for converting the text nodes to generate a two-dimensional vector diagram of the watermark;

[0039] The adding module is used to add the two-dimensional vector image of the watermark to the target document.

[0040] In some embodiments, the conversion module includes:

[0041] A first generating submodule, used for generating a watermark expression according to a preset watermark template and the text node;

[0042] The second generation submodule is used to encode the watermark expression to generate a target character string;

[0043] The third generating submodule is used to generate the two-dimensional vector image of the watermark according to the target character string.

[0044] In some embodiments, the first generation submodule is used to:

[0045] According to the mapping relationship preset in the watermark template, the text node is mapped to obtain the node information of the picture node of the watermark; wherein the node information of the picture node at least includes the node character string of the picture node;

[0046] The watermark expression is generated according to the node information of the picture node.

[0047] In some embodiments, the text node is also used to describe text attribute information of the watermark; and the first generation submodule is used to:

[0048] According to the mapping relationship preset in the watermark template, the text content and text attribute information described by the text node are mapped to obtain the node information of the picture node.

[0049] In some embodiments, the node information of the picture node also includes picture attribute information; the first generating submodule is used to:

[0050] According to a first mapping relationship preset in the watermark template, mapping the text content described by the text node to a node string of the image node;

[0051] Mapping the text attribute information described by the text node to the image attribute information of the image node according to a second mapping relationship preset in the watermark template;

[0052] The text attribute information includes at least one of the uniform resource identifier URI of the text node, text basic attributes and text transformation attributes; the text transformation attributes are used to generate the transformation effect of the text node.

[0053] In some embodiments, the second generation submodule is used to:

[0054] Performing URL encoding on the designated characters in the watermark expression to obtain URL encoded data;

[0055] Converting characters other than designated characters in the watermark expression and the URL encoded data into binary data;

[0056] The binary data is encoded according to a preset encoding rule to generate the target character string.

[0057] In some embodiments, the second generation submodule is used to:

[0058] Extracting a continuous character string of a preset length from the binary data;

[0059] The continuous character string extracted from the binary data is encoded according to the encoding rule to generate the target character string.

[0060] In some embodiments, the third generation submodule is used to:

[0061] According to the target character string, create the picture node;

[0062] The image node is moved into a preset texture node to generate a two-dimensional vector image of the watermark.

[0063] In some embodiments, the adding module is used to:

[0064] The two-dimensional vector diagram of the watermark is added to the target document with a first transparency lower than a transparency threshold, wherein the transparency threshold is used to reduce the visual perception of the two-dimensional vector diagram in the target document.

[0065] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the watermark adding method described in any one of the first aspects is implemented.

[0066] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the watermark adding method described in any one of the first aspects is implemented.

[0067] The technical solution provided by the embodiment of the present disclosure obtains the text content of the watermark to be added to the target document, creates a text node for describing the text content of the watermark according to the text content of the watermark to be added; converts the text node to generate a two-dimensional vector diagram of the watermark; and adds the two-dimensional vector diagram of the watermark to the target document. In this way, by converting the text node for describing the text content of the watermark, the text content of the watermark will not be stored in the web page code in plain text, which can reduce the possibility of users using the browser's developer tools or other tools to easily find and delete the watermark content from the web page code to a certain extent, thereby improving the security of the watermark information; in addition, because the two-dimensional vector diagram is obtained by converting the text node, the two-dimensional vector diagram is easy to scale without causing image distortion, so it can achieve a document watermark with better display effect, which is conducive to improving the user experience.

[0068] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0070] Figure 1 A schematic diagram of a process of adding a watermark provided by an embodiment of the present disclosure is shown;

[0071] Figure 2 A schematic diagram of a process of adding a watermark provided by an embodiment of the present disclosure is shown;

[0072] Figure 3 A schematic diagram of a process of adding a watermark provided by an embodiment of the present disclosure is shown;

[0073] Figure 4 A schematic diagram of a process of adding a watermark provided by an embodiment of the present disclosure is shown;

[0074] Figure 5 A schematic diagram of a process of adding a watermark provided by an embodiment of the present disclosure is shown;

[0075] Figure 6 A schematic diagram of a process of adding a watermark provided by an embodiment of the present disclosure is shown;

[0076] Figure 7a A schematic diagram of a process of adding a watermark provided by an embodiment of the present disclosure is shown;

[0077] Figure 7b A schematic diagram of a process of adding a watermark provided by an embodiment of the present disclosure is shown;

[0078] Figure 8 A schematic diagram of the structure of a watermark adding device provided by an embodiment of the present disclosure is shown;

[0079] Fig. 9 A schematic structural diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0080] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the embodiments of the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the embodiments of the present invention as detailed in the appended claims.

[0081] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present invention. The singular forms of "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0082] It should be understood that although the terms first, second, third, etc. may be used to describe various information in embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of embodiments of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0083] Before describing the embodiments of the present disclosure in detail, the terms involved in the embodiments of the present disclosure are briefly described.

[0084] SVG: Scalable Vector Graphics, which uses the extensible markup language (XML) format to define images and is used to describe two-dimensional vector graphics.

[0085] Pattern: When you use a predefined graphic to fill or stroke an object, you need to use the pattern element. The pattern element enables the predefined graphic to be repeated (or tiled) on the x-axis and y-axis at fixed intervals to cover the area to be painted.

[0086] Base64: is a method of representing binary data based on 64 printable characters. Every 6 bits is a unit, corresponding to a printable character. 3 bytes are equivalent to 24 bits, corresponding to 4 Base64 units, that is, 3 bytes can be represented by 4 printable characters.

[0087] btoa: The btoa() method encodes a binary string (i.e., each byte in the string is treated as a byte of binary data) into a Base64-encoded ASCII string.

[0088] Figure 1 A schematic diagram of a watermark adding method provided by an embodiment of the present disclosure is shown. Figure 1 As shown, the watermark adding method may include the steps of:

[0089] 101: Obtain the text content of the watermark to be added to the target document;

[0090] 102: according to the text content of the watermark, create a text node for describing the text content of the watermark;

[0091] 103: convert the text nodes to generate a two-dimensional vector map of the watermark;

[0092] 104: Add the two-dimensional vector image of the watermark to the target document.

[0093] The watermark adding method in this embodiment can be executed by a server. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server.

[0094] In some examples, the target document may be a document in a specified file format, and the specified document format may be a document in a vector file format, for example, the target document is an SVG document.

[0095] In some examples, if the document to be watermarked is not a document in a specified file format, the document to be watermarked needs to be converted into a target document in a specified file format.

[0096] In some examples, for the target document, if a DOM (Document Object Model) node containing the text content of the watermark already exists, a text node of the watermark to be added to the target document can be created according to the text content of the watermark in the DOM node.

[0097] Here, the DOM node containing the text content of the watermark refers to a DOM element node that can cover the watermark text on the page to which the watermark is to be added.

[0098] Exemplarily, a DOM node is created, a background image is added to the DOM node, and the text content of the watermark is added to the background image to obtain a DOM node containing the text content of the watermark.

[0099] Here, the text node of the watermark can be used to store the text content of the watermark. The text content can also be called "text content".

[0100] In some examples, the server may obtain the text content of the watermark in response to the watermark adding request.

[0101] For example, when the watermark adding request carries user information, the user information can be used as the text content of the watermark.

[0102] For another example, when the watermark adding request carries user information, the text content stored in the database that has a corresponding relationship with the user information can be used as the text content of the watermark.

[0103] The user information may include user identity information, user login information, and / or device IP, etc.

[0104] The user's identity information includes but is not limited to: user name, identity ID, and / or mobile phone number, etc.

[0105] User login information includes, but is not limited to: at least one of an account number, a password, and the latest login time corresponding to the account number.

[0106] In other examples, the server can determine the text content of the watermark in response to a watermark adding request based on the device information of the sender of the watermark adding request and / or the receiving time of the watermark adding request. For example, the device IP of the sender and / or the receiving time of the watermark adding request can be used as the text content of the watermark.

[0107] It is understandable that other methods may be used to obtain the text content of the watermark, and this embodiment does not specifically limit this.

[0108] In some examples, the watermark adding request may be sent by the client to the server in response to a document loading request, where the document loading request may be used to request that a target document be displayed in a web page.

[0109] In some examples, in the above step 102, the server may create a text node according to the text content of the watermark and the basic text attribute information of the watermark.

[0110] For example, the text content of the watermark and the basic text attribute information of the watermark are included in the watermark adding request.

[0111] For another example, the text basic attribute information of the watermark may be included in the configuration information stored in the server. The text detection attribute information may be the text basic attribute information historically set by the user, or may also be the text basic attribute information preset by the server.

[0112] Here, the text basic attribute information of the watermark may be used to indicate the text style of the watermark.

[0113] In some examples, the basic text attribute information of the watermark includes but is not limited to at least one of the following: the display position of the text content, the display color of the text content, the size information of the text content, the font, the font size, whether italic, whether bold, alignment, etc. The size information may include information such as text width and text height.

[0114] In some examples, the server may use a first tag in Scalable Vector Graphics (SVG) syntax to create a text node according to the text content of the watermark. For example, the first tag may be a text tag in SVG (e.g., <text>Label).

[0115] In some examples, a text node for the watermark can be created in the source code of the target document.

[0116] As an example, a page div element can be created in the SVG code of the target document, and a text node of the watermark can be created in the div element. Here, the div element can be used as a container of a rectangular area.

[0117] For example, the text node for creating a watermark in a div element is: <div class="text"> Watermark Text .

[0118] In this embodiment, a text node is created according to the text content of the watermark, and the text node can be used to store the text content of the watermark.

[0119] In some examples, before executing step 103, a text transformation attribute may also be added to the text node of the watermark.

[0120] Here, in order to make the watermark more difficult to detect and remove, some transformation effects can be added to the text node, such as rotation, tilt, distortion, etc. For example, the offset attribute (for example, <translate>properties) or rotate elements (for example, <rotate>elements) to achieve these transformation effects.

[0121] In some examples, in the above step 103, the server may convert the text content in the text node to generate a two-dimensional vector image of the watermark.

[0122] For example, the text content in the text node can be mapped according to a preset mapping relationship, and a two-dimensional vector map of the watermark can be generated according to the mapping result of the text content. The preset mapping relationship may include a correspondence between the text content and the image information used to generate the two-dimensional vector map.

[0123] For another example, the text content in the text node is serialized into a binary object, and a two-dimensional vector image of the watermark is generated based on the binary object of the text content. Here, the two-dimensional vector image can be called a "vector image", which can be represented by geometric primitive information such as points, straight lines, polylines, and curves. Compared with pixel images (also called "bitmaps"), vector images are easy to scale and will not cause image distortion.

[0124] In this embodiment, the two-dimensional vector image may be an SVG vector image.

[0125] In some examples, in the above step 103, the server may also call an encryption service, such as using a hash algorithm to encrypt the text content in the text node, and generate a two-dimensional vector image of the watermark according to the encryption result of the text content.

[0126] Exemplarily, a hash algorithm can be used to map the text content of the watermark to a fixed-length hash value (e.g., a binary value) as the result of the encryption processing of the text content. Here, the hash algorithm can be a message digest algorithm (Message-Digest Algorithm, MD5) or a secure hash algorithm (Secure Hash Algorithm, SHA), etc.

[0127] In some examples, in the above step 104, a watermark may be generated according to the two-dimensional vector image of the watermark, and the watermark may be added to the target document.

[0128] Embodiments of the present disclosure provide a watermark adding method. By creating a text node for describing the text content of the watermark to be added to the target text and performing transformation processing on the text node, a two-dimensional vector graph of the watermark is generated; the two-dimensional vector graph of the watermark is added to the target document. In this way, by performing transformation processing on the text node describing the text content of the watermark, the text content of the watermark is not stored in the web page code in plain text, which can reduce the possibility that users can easily find or delete the watermark content from the web page code by the developer tools of the browser or other tools to a certain extent, thereby improving information security; in addition, since the two-dimensional vector graph is obtained by performing transformation processing on the text node, the two-dimensional vector graph is easy to scale without causing image distortion, so a document watermark with a better display effect can be realized; in addition, the two-dimensional vector graph has less redundant information than the pixel graph in file representation, which can greatly reduce the resource overhead of the client and is beneficial to improving the user experience.

[0129] In some embodiments, as Figure 2 shown, in step 103 above, performing transformation processing on the text node to generate a two-dimensional vector graph of the watermark may include the following steps:

[0130] 201: Generate a watermark expression according to a preset watermark template and the text node;

[0131] 202: Perform encoding processing on the watermark expression to generate a target string;

[0132] 203: Generate a two-dimensional vector graph of the watermark according to the target string.

[0133] Here, the watermark template may be a template file created in advance for drawing the watermark.

[0134] The watermark template may be preset with a prefix content and a suffix content of the watermark. The prefix content may be the content at the start position of the watermark expression, and the suffix content may be the content at the end position of the watermark expression. For example, the prefix content may be "<g", and the suffix content may be "g>"; however, this embodiment is not limited thereto.

[0135] In some examples, in step 201 above, the text node may be mapped to a watermark expression according to the mapping relationship preset in the watermark template; or, the text content in the text node may be spliced between the prefix content and the suffix content preset in the preset watermark template, and the spliced content may be mapped to a watermark expression according to the mapping relationship preset in the watermark template.

[0136] The watermark expression may include non-special characters and / or special characters; non-special characters may be numbers, letters, etc. Special characters may be characters other than numbers and letters, such as spaces, etc.

[0137] In some examples, the implementation process of step 202 may include:

[0138] When the watermark expression contains special characters, URL (Uniform Resource Locator) encoding is performed on the special characters in the watermark expression to obtain URL encoding data corresponding to the special characters;

[0139] The non-special characters in the watermark expression are converted into binary data corresponding to the non-special characters, and according to the positions of the special characters and the non-special characters in the watermark expression, the URL encoded data corresponding to the special characters and the binary data corresponding to the non-special characters are spliced ​​to form spliced ​​data, and the spliced ​​data is encoded according to the preset encoding rules to generate the target character string.

[0140] The target character string is used as path data of a two-dimensional vector graph.

[0141] The preset encoding rule may be encoding based on 64 printable characters.

[0142] In the disclosed embodiment, a watermark expression is generated according to a preset watermark template and text nodes, and a two-dimensional vector diagram of the watermark is generated by encoding the watermark expression. This process does not require calling an external service interface to process the text nodes, which can facilitate the rapid generation of a two-dimensional vector diagram of the watermark.

[0143] In addition, since the target string object can be used in the source code of the target document to replace the text content of the watermark, this can make it difficult for crackers to easily locate the watermark structure and reduce the risk of the watermarked data being easily found.

[0144] In some embodiments, Figure 3 As shown, in the above step 201, generating a watermark expression according to a preset watermark template and text nodes may include the following steps:

[0145] 301: mapping the text nodes according to the mapping relationship preset in the watermark template to obtain node information of the picture node of the watermark; wherein the node information of the picture node at least includes the node character string of the picture node;

[0146] 302: Generate a watermark expression according to the node information of the image node.

[0147] In some examples, in step 301, the text content in the text node is mapped into a node string of the watermark image node according to a mapping relationship preset in the watermark template; and the node information of the watermark image node is obtained according to the node string of the watermark image node.

[0148] For example, the node character string of the watermark image node and the preset image attribute information may be used to form the node information of the watermark image node.

[0149] Here, the node string of the picture node may be used to identify the picture node.

[0150] In some examples, in step 302, the node information of the image node may be spliced ​​between the prefix content and the suffix content preset in the watermark template, and the splicing result may be used as the watermark expression.

[0151] In this embodiment, the text nodes are mapped according to the mapping relationship preset in the watermark template to obtain the node information of the watermark image node. In this way, a watermark expression can be generated based on at least the node character string of the image node included in the node information of the image node, and then the watermark expression is used to generate a two-dimensional vector diagram of the watermark. In this way, the text content of the watermark will not be stored in plain text in the web page code, which can improve the security of the watermark information.

[0152] In some embodiments, the text node is also used to describe the text attribute information of the watermark.

[0153] In some examples, the text attribute information includes at least one of a uniform resource identifier (URI) of the text node, text basic attributes, and text transformation attributes; the text transformation attributes are used to generate a transformation effect of the text node.

[0154] Among them, URI is a string used to identify the name of a certain Internet resource. This identification allows users to interact with any resource (including local and Internet) through a specific protocol. In some examples, the basic text attributes may include but are not limited to at least one of the following: the display position of the text content, the display color of the text content, the size information of the text content, the font, the font size, whether italic, whether bold, alignment, etc. The size information may include text width and text line height.

[0155] In some examples, the text transformation attribute may include, but is not limited to, at least one of the following: a rotation angle, an offset position, and / or a distortion degree of the text content.

[0156] For example, the rotation angle of the text content can be defined by the "rotate" attribute in the target document's SVG code, and the offset position of the text can be defined by the "translate" attribute in the target document's SVG code.

[0157] like Figure 4 As shown, based on Figure 3 In the above step 301, mapping the text nodes according to the mapping relationship preset in the watermark template to obtain the node information of the watermark image node may include the following steps:

[0158] 3011: According to the mapping relationship preset in the watermark template, the text content and text attribute information described by the text node are mapped to obtain the node information of the image node.

[0159] Here, the node information of the picture node includes the node character string of the picture node and the picture attribute information of the picture node.

[0160] For example, the node character string of the picture node is concatenated in front of the picture attribute information of the picture node to form the node information of the picture node.

[0161] Here, according to the mapping relationship preset in the watermark template, the text content described by the text node can be mapped to the node string of the picture node, the text attribute information described by the text node can be mapped to the image attribute information of the picture node, and the node information of the picture node can be obtained according to the node string of the picture node and the image attribute information of the picture node.

[0162] In this embodiment, since the text content and text attribute information described by the text node are mapped to obtain the node information of the image node, compared with only mapping the text content, the complexity of the node information of the acquired image node can be increased. In this way, after the watermark expression generated according to the node information of the image node is subsequently processed into a two-dimensional vector diagram of the watermark, the watermark information can be more difficult to find and more difficult to remove from the web page code.

[0163] In some embodiments, the node information of the picture node also includes picture attribute information; in the above step 3011, mapping the text content and text attribute information described by the text node according to the mapping relationship preset in the watermark template to obtain the node information of the picture node may include the following steps:

[0164] 3011a: Map the text content described by the text node into a node string of the image node according to the first mapping relationship preset in the watermark template;

[0165] 3011b: Map the text attribute information described by the text node to the image attribute information of the image node according to the second mapping relationship preset in the watermark template.

[0166] In some examples, the text transformation attribute may be a randomly selected change attribute from a plurality of change attributes. For example, the randomly selected change attribute may include: an offset position of a text node randomly set by a conversion attribute, and / or a rotation angle of a text node randomly set by a selection attribute.

[0167] In the above step 3011a, the text content described by the text node can be directly used as the node string of the image node according to the first mapping relationship preset in the watermark template. Alternatively, the target content extracted from the text content described by the text node according to the preset extraction rule is mapped to the node string of the image node. Here, the preset extraction rule can be, for example, starting from the first character in the text content, extracting one character every preset number of characters.

[0168] In some examples, the second mapping relationship includes:

[0169] A first conversion relationship between a namespace uniform resource identifier (NamespaceURI) of a text node and a namespace URI of a picture node;

[0170] A second conversion relationship between a text basic attribute of a text node and a picture basic attribute of a picture node;

[0171] A third conversion relationship between the text transformation attribute of the text node and the image transformation attribute of the image node.

[0172] In some examples, the first conversion relationship may be used to directly use the namespace uniform resource identifier of the text node as the namespace uniform resource identifier of the image node.

[0173] In some examples, the second conversion relationship may be used to:

[0174] Convert the height in the text basic properties to the texture height in the image basic properties;

[0175] Convert the width in the text base properties to the texture width in the image base properties.

[0176] For example, the second conversion relationship may be used to directly use the height in the text basic attributes as the texture height in the picture basic attributes, or to use the product of the height in the text basic attributes and a preset coefficient as the texture height in the picture basic attributes.

[0177] For example, the second conversion relationship may be used to directly use the width in the text basic attributes as the texture width in the picture basic attributes, or to use the product of the width in the text basic attributes and a preset coefficient as the texture width in the picture basic attributes.

[0178] In some examples, the third conversion relationship may be used to convert a text transformation attribute of a text node into a plurality of image transformation attributes of an image node.

[0179] In some examples, in the above step 3011b, when the text attribute information includes a text transformation attribute of a text node, a conversion relationship between the text transformation attribute and multiple different image transformation attributes can be determined according to a second mapping relationship; and according to the conversion relationship, the text transformation attribute is converted to obtain attribute information of multiple image transformation attributes of the image node.

[0180] The second mapping relationship may include a conversion relationship between the text transformation attribute and a plurality of different image transformation attributes.

[0181] For example, the text transformation attributes include different transformation attributes of the text node. The different transformation attributes of the text node can be converted into a plurality of image transformation attributes according to the conversion relationship included in the second mapping relationship.

[0182] Here, different transformation properties of the text node may include but are not limited to: offset (Offset), translation (Translate), amplitude (Scale), rotation (Rotate), matrix (Matrix).

[0183] Image transformation properties may include, but are not limited to: offset, translation, amplitude, rotation, and matrix of image nodes.

[0184] Here, the text transformation attribute can be a string formed by multiple transformation attributes of a text node in a preset order. When the text transformation attribute is mapped according to the second mapping relationship, the string of the text transformation attribute can be split into multiple sub-strings, and the different sub-strings obtained by the split are mapped to different transformation attributes of the image node in turn.

[0185] In some examples, when the text attribute information does not include text attribute information of a text node, default image attribute information may be determined as the image attribute information of the image node.

[0186] For example, when the text attribute information does not include the text transformation attribute of the text node, a plurality of default image transformation attributes may be determined as the image transformation attributes of the image node.

[0187] In some examples, the text transformation attribute includes multiple text transformation attribute fields and attribute values ​​corresponding to each text transformation attribute field. The above step 3011b may include:

[0188] Matching multiple text transformation attribute fields with multiple attribute fields of image transformation attributes, and determining the text transformation attribute fields and attribute values ​​of the text transformation attribute fields to which each image transformation attribute needs to be mapped;

[0189] For each image transformation attribute, according to a target mapping rule randomly extracted from the mapping rules corresponding to the image transformation attribute, the attribute value of the text transformation attribute field to which the image transformation attribute needs to be mapped is mapped to the attribute value of the image transformation attribute.

[0190] In some examples, the rule indexes of the mapping rules corresponding to the above-mentioned respective picture transformation attributes may be respectively set in the conversion relationships corresponding to the respective picture transformation attributes.

[0191] Exemplarily, the mapping rule corresponding to any one of the image transformation attributes may include: obtaining the attribute value of the image transformation attribute by subjecting the attribute value of the attribute field in the text transformation attribute that matches the image transformation attribute to at least one transformation.

[0192] For example, the text transformation attribute field is "Rotate", the rotation angle of the watermark text is angle a, and the mapping rules corresponding to the image transformation attribute with the attribute field being "Rotate" may include Rule 1 and Rule 2; wherein Rule 1 may be: taking angle a as the attribute value of the field whose image attribute field is "Rotate"; and Rule 2 may be: taking the angle obtained by adding angle a to the preset angle as the attribute value of the field whose image attribute field is "Rotate".

[0193] In this embodiment, the text attribute information includes the text transformation attributes of the text node. The text content and text attribute information of the text node are respectively mapped and processed into the node string and image attribute information of the image node, and then a watermark expression is generated. This can improve the security of the watermark information compared to storing the text content of the text node in plain text as watermark information.

[0194] In some embodiments, Figure 5 As shown, in the above step 202, encoding the watermark expression to generate a target character string may include the following steps:

[0195] 501: URL-encode the specified characters in the watermark expression to obtain URL-encoded data;

[0196] 502: Convert characters and URL-encoded data in the watermark expression that are different from the specified characters into binary data;

[0197] 503: Encode the binary data according to a preset encoding rule to generate a target character string.

[0198] Here, the watermark expression may include specified characters and characters different from the specified characters. For example, the specified characters may be special characters, which may include but are not limited to: symbol characters such as "%", "-", "_", "&" and ". " and spaces, etc.; characters different from the specified characters may be non-special characters, such as letters, numbers, Chinese characters, etc.

[0199] It is understandable that this embodiment does not specifically limit the specific category of the designated characters.

[0200] In step 501, the designated characters in the watermark expression may be URL encoded, and characters in the watermark expression other than the designated characters may remain unchanged. Exemplarily, a URL encoding function (eg, encodeURIComponent function) may be used to URL encode the designated characters in the watermark expression.

[0201] In step 502, after the designated characters in the watermark expression are replaced with URL encoded data of the designated characters in the watermark expression, binary processing is performed on the URL encoded data of the designated characters in the watermark expression and characters other than the designated characters to obtain binary data.

[0202] Here, according to the original position of the designated character in the watermark expression, the designated character in the watermark expression is replaced with the URL encoded data of the designated character in the watermark expression.

[0203] Here, URL encoded data of designated characters and characters other than designated characters in the watermark expression may be binary processed through the btoa interface.

[0204] In some examples, a binary data buffer may be used to store binary data generated based on a watermark expression, and the binary data buffer may be represented by an ArrayBuffer object.

[0205] Here, the preset encoding rule may be encoding based on 64 printable characters, that is, Base64 encoding.

[0206] Since Base64 is one of the most common encoding methods for transmitting 8-bit bytecode on the Internet, it can represent binary data based on 64 printable characters. Therefore, by performing Base64 encoding on binary data to generate a target string, the target string can be used as the path data of the watermark image, which is beneficial for saving the network resource overhead of loading the watermark image while improving the compatibility of different browsers with the watermark.

[0207] In the disclosed embodiment, the watermark expression generated by the text node is URL-encoded and binary-converted to obtain binary data, and the binary data is converted into a target string to represent a two-dimensional vector graph of the watermark. In this way, on the one hand, the text content in the text node is no longer stored in plain text in the web page source code, which can reduce the possibility of the watermark content being found and deleted, thereby improving the security of the watermark information; on the other hand, since the two-dimensional vector graph is easy to scale and will not produce image distortion, it can improve the performance of watermark rendering and reduce the resource overhead of the client.

[0208] In some embodiments, in the above step 503, encoding the binary data according to a preset encoding rule to generate a target character string may include the following steps:

[0209] Extract a continuous string of a preset length from binary data;

[0210] Encode the continuous character string extracted from the binary data according to the encoding rules to generate the target character string.

[0211] In some examples, a continuous character string of a preset length may be extracted from the binary data.

[0212] For example, the first character in the binary data can be used as the starting character of the continuous string to be extracted, and a continuous string of a preset length can be extracted from the binary data; alternatively, the last character in the binary data can be used as the ending character of the continuous string to be extracted; alternatively, a continuous string of a preset length can be extracted starting from the middle position of the binary data.

[0213] In some other examples, when the length of the binary data is less than a preset length, zero padding extension may be performed in front of the binary data to obtain a continuous character string that meets the preset length.

[0214] It is understandable that the present embodiment does not limit the specific method of extracting the continuous character string from the binary data, as long as a continuous character string of a preset length can be extracted from the binary data.

[0215] In some examples, the preset length may be set to n times of 3 bytes, where n is greater than or equal to 64.

[0216] In some examples, considering that binary data is Base64 encoded, every 3 bytes in the binary data will become 4 bytes after encoding, which makes the data volume correspondingly larger. Therefore, when the size of the http request body is limited, the preset length can be determined according to the size of the http request body. Here, the http request body is used to transmit the target string, and the target string is generated by encoding a continuous string of preset length extracted from the binary data.

[0217] For example, the maximum value of the http request body size is 1KB (i.e., 1024 bytes), the maximum value of the preset length can be set to 768 bytes, and the minimum value can be set to 192 bytes, so that the target string obtained after base64 encoding the continuous string of the preset length can be used as the image reference address of the watermark.

[0218] It is understandable that, in practical applications, the preset length can be set according to specific needs, and this embodiment does not specifically limit this.

[0219] In this embodiment, the target string is generated by encoding the watermark expression, and the watermark expression is generated based on the node information of the watermarked image node, that is, it is equivalent to encoding the watermark expression generated based on the node information of the watermarked image node into a string, so that the string can be used as the watermarked image reference address.

[0220] In the disclosed embodiment, a continuous character string of a preset length is extracted from binary data and encoded according to encoding rules to generate a target character string. This can reduce the length of the target character string while increasing the flexibility of the target character string generation method, thereby further improving the security of the watermark information.

[0221] In some embodiments, Figure 6 As shown, in the above step 203, generating a two-dimensional vector diagram of a watermark according to the target character string may include the following steps:

[0222] 601: Create a picture node according to the target string;

[0223] 602: Move the image node into the preset created texture node to generate a two-dimensional vector image of the watermark.

[0224] In step 601, after creating the texture node of the watermark, a picture node may be created according to the target character string. The picture node may be used to store the target character string.

[0225] In step 602, the picture node may be set as a texture resource of a texture node to generate a two-dimensional vector image of the watermark.

[0226] Here, the texture node can also be used to set the watermark's location, size, repetition mode, transparency and other properties in the document content.

[0227] Here, the texture node can be used as a carrier of the image node. In the SVG code of the target document, the texture node is a Pattern node, that is, the Pattern fill type can be used as the carrier of the watermark image node.

[0228] In some examples, the watermark may be tiled on the document content of the target document according to the attribute information of the watermark set in the texture node.

[0229] It is understandable that drawing the watermark into the target document will not affect the visibility and integrity of the target document.

[0230] In some examples, in step 103, adding the two-dimensional vector image of the watermark to the target document may include:

[0231] The two-dimensional vector image of the watermark is added to the target document with a first transparency lower than a transparency threshold, wherein the transparency threshold is used to reduce the visual perception of the two-dimensional vector image in the target document.

[0232] Here, the transparency threshold may be set according to expert experience, for example, the transparency threshold may be set to 0.01, 0.02 or other values.

[0233] In some examples, the first transparency may be a transparency that makes the two-dimensional vector image of the watermark completely transparent.

[0234] In this embodiment, the two-dimensional vector image of the watermark is added to the target document with a first transparency lower than the transparency threshold, that is, it can be considered that the two-dimensional vector image is drawn into the target document in an implicit manner.

[0235] In this way, compared to displaying the watermark text in plain text, since the two-dimensional vector image of the watermark added to the target document is generated based on the text content of the watermark, and the transparency of the two-dimensional vector image of the watermark is lower than the transparency threshold, the watermark is added to the target document in an implicit manner without causing a large visual impact on the document content and is not easily noticed by users. Therefore, the security of the watermark information can be further improved.

[0236] The watermark adding method provided by the embodiment of the present disclosure adopts the Pattern fill type as the watermark carrier, and the Pattern fill type is not a DOM node. Compared with the DOM node, it still has the risk of being discovered and deleted by the user. Since the Pattern is not a specific node that can be searched by the user, but a fill type provided by the SVG code, it has no direct relationship with the direct presentation of the watermark in the structure of the source code, and the definition position and the use position of the Pattern in the SVG code are not adjacent, but the association between the watermark content and the drawing can only be established from the JavaScript logic. Therefore, it is safer than using the DOM node as a watermark carrier.

[0237] In addition, the watermark defined by the DOM node can only express one watermark, while the watermark implemented by Pattern can automatically tile the entire page range according to the specified size, with more efficient performance and lower maintenance costs.

[0238] Table 1 below shows the difference in code between DOM node watermark and Pattern watermark.

[0239] Table 1:

[0240]

[0241] The watermark adding method provided by the embodiment of the present disclosure converts text node information into image node information, generates a watermark expression and encodes it into binary data, and generates a base64 encoding segment based on the binary data. Since all style information of the watermark text node has been translated and mapped, there is no need to define the watermark style through the Cascading Style Sheets (CSS) style. Compared with the plain text attributes of the CSS style that are easily discovered and tampered by users, in this embodiment, the color in the image attribute of the watermark can be set to transparent (or the offset can be changed to a maximum value), so as to achieve the purpose of hiding the watermark, and the watermark adding is safer.

[0242] Table 2 below shows the difference in code between a watermark style expressed by arraybuffer&base64 and a watermark style expressed by CSS.

[0243] Table 2:

[0244]

[0245] As an example, it is assumed that a text node of a watermark is generated according to the text content of a certain watermark. For example, Table 3 shows the text node generated based on the watermark text.

[0246] Table 3:

[0247]

[0248] The text nodes shown in Table 3 are converted into watermark expressions, as shown in Table 4 below.

[0249] Table 4:

[0250]

[0251] The watermark expression shown in Table 4 is encoded to obtain the encoded watermark expression shown in Table 5 below.

[0252] Table 5:

[0253]

[0254] The encoded watermark expression shown in Table 5 is encoded into binary data, and a Base64 address is generated according to the binary data, as shown in Table 6 below.

[0255] Table 6:

[0256]

[0257] Based on the Base64 address shown in Table 6, a Pattern watermark as shown in Table 7 below may be generated.

[0258] Table 7:

[0259]

[0260] In order to further explain any embodiments of the present disclosure, some specific embodiments are provided below.

[0261] Most online document preview services use static images as a technical solution for watermark rendering. The background attribute of Cascading Style Sheets (CSS) can achieve the watermark effect. This solution is a pure front-end implementation method. The image copied by right-clicking also has a watermark. A variety of image formats can be used, such as jpg, png, gif, etc. However, image watermarks are easily removed or modified by image processing tools (for example, photoshop, PS) and other tools; at the same time, image watermarks will increase page loading time and traffic consumption; and image watermarks are bitmaps, which will become blurred and unrecognizable when scaled, and will also affect the clarity of the document.

[0262] In addition, the characteristic texture (pattern) node of Scalable Vector Graphics (SVG) can be used as the carrier for drawing watermarks. This solution mainly defines repeatable graphic objects and then uses them to fill or stroke other graphic elements. However, the watermark content will be saved in plain text in the SVG source code, and users can easily find and delete watermark elements; and the rendering of the watermark may be affected by the support level of the browser or display device.

[0263] The disclosed embodiment provides a watermark adding method, which can be applied to the scenario of adding watermarks in an online document preview service. For example, the watermark adding method can be applied to an online document preview service in a B / S (Browser / Server) mode environment based on an X86 architecture or an ARM architecture.

[0264] The watermark adding method provided by the embodiment of the present disclosure can solve the problem of zoom blur and easy discovery and deletion of watermarks when rendering watermarks in the online document preview service. When opening a document using the online document preview service based on this solution, a better document watermark can be achieved, effectively improving the user experience, while improving the security and robustness of the document.

[0265] The present disclosure provides a method for adding a watermark. Figure 7a As shown, the method may include watermark generation, watermark conversion, and watermark rendering.

[0266] 1. Watermark generation.

[0267] Use the tags in SVG syntax to create a text node to store the watermark content.

[0268] Text nodes can use text elements (for example, <text>The text element can be defined by specifying the watermark's text content, font, color, size and other attributes.

[0269] In order to make the watermark more difficult to detect and remove, some transformation effects can be added to the text node, such as rotation, tilt, distortion, etc. For example, the offset attribute (for example, <translate>properties) or rotate elements (for example, <rotate>elements) to achieve these effects.

[0270] The defined text node is placed in a template consisting of a preset prefix node and a suffix node, and the two are spliced ​​together into a complete SVG description tag. This tag is defined as a watermark expression. Through this process, an SVG node is obtained from the text content.

[0271] 2. Watermark conversion.

[0272] In order to increase the security and concealment of the watermark, the text node is first encoded into the SVG node through the conversion interface encodeURIComponent provided by the browser, and then converted into binary data through the btoa interface, and then the identifier is concatenated to export the base64 string as the image reference address. In this way, the watermark will not appear in the SVG source code in plain text, and will not be easily found and deleted by the browser's developer tools or other tools.

[0273] 3. Watermark rendering.

[0274] To display a watermark in an SVG file, you can use SVG texture tiling to repeatedly display the watermark image in the SVG file to cover the area to be colored.

[0275] Texture elements can be used (e.g. <pattern>element) to define a repeatable graphic object, which can then be used to fill or stroke other graphic elements.

[0276] You can use image nodes (for example, Element) references the base64 string address of the watermark image, then moves the image node into the texture node, tiles the texture node on top of the document content, and sets the watermark image's location, size, repetition mode and other properties in the texture node to define the location and tiling mode of the texture node to determine the final effect of the watermark.

[0277] The above-mentioned watermark generation step and watermark conversion step are used to realize the conversion of text nodes into texture maps.

[0278] Specifically, Figure 7b As shown, the conversion of a text node into a texture map includes:

[0279] (1) Text nodes are rendered via HTML;

[0280] (2) Get the innerHTML of the text parent node;

[0281] (3) Text nodes are converted into expressions through mapping relationships;

[0282] The mapping relationship includes: the mapping relationship between the text content (Text.content) and the node string (NodeString) of the image node;

[0283] The mapping relationship also includes at least one of the following:

[0284] The mapping relationship between the namespace uniform resource identifier (NamespaceURI) of the text node and the namespace URI of the image node;

[0285] The mapping relationship between the height of the text node (Height) and the texture height of the image node (Pattern Height);

[0286] The mapping relationship between the width (Width) of the text node and the texture width (PatternWidth) of the image node;

[0287] The mapping relationship between the Transform attribute of the text node and the Offset, Translate, Scale, Rotate, and Matrix of the image node;

[0288] (4) Convert the expression into binary through the btoa interface;

[0289] (5) Special characters in the expression are translated through URL encoding;

[0290] (6) Concatenate the base64 to get the reference identifier.

[0291] To sum up, compared with the online document watermark rendering method in the related art, there are obvious defects. For example, due to the characteristics of bitmaps, image watermarks cannot be losslessly scaled, and text node watermarks have low robustness and are more easily cracked by users. The technical solution provided by the embodiment of the present disclosure can effectively improve the performance and robustness of online document watermark rendering by optimizing the watermark rendering and typesetting process of the entire document, while reducing the resource overhead of the client.

[0292] Figure 8 A schematic diagram of the structure of a watermark adding device provided by an embodiment of the present disclosure is shown. Figure 8 As shown, the watermark adding device 100 may include:

[0293] An acquisition module 110, used to acquire the text content of the watermark to be added to the target document;

[0294] A creation module 120, used to create a text node for describing the text content according to the text content of the watermark;

[0295] The conversion module 130 is used to convert the text node to generate a two-dimensional vector diagram of the watermark;

[0296] The adding module 140 is used to add the two-dimensional vector image of the watermark to the target document.

[0297] In some embodiments, the conversion module 130 includes:

[0298] A first generating submodule, used for generating a watermark expression according to a preset watermark template and the text node;

[0299] The second generation submodule is used to encode the watermark expression to generate a target character string;

[0300] The second generating submodule is used to generate the two-dimensional vector image of the watermark according to the target character string.

[0301] In some embodiments, the first generation submodule is used to:

[0302] According to the mapping relationship preset in the watermark template, the text node is mapped to obtain the node information of the picture node of the watermark; wherein the node information of the picture node at least includes the node character string of the picture node;

[0303] The watermark expression is generated according to the node information of the picture node.

[0304] In some embodiments, the text node is also used to describe text attribute information of the watermark; and the first generation submodule is used to:

[0305] According to the mapping relationship preset in the watermark template, the text content and text attribute information described by the text node are mapped to obtain the node information of the picture node.

[0306] In some embodiments, the node information of the picture node also includes picture attribute information; the first generating submodule is used to:

[0307] According to a first mapping relationship preset in the watermark template, mapping the text content described by the text node to a node string of the image node;

[0308] Mapping the text attribute information described by the text node to the image attribute information of the image node according to a second mapping relationship preset in the watermark template;

[0309] The text attribute information includes at least one of the uniform resource identifier URI of the text node, text basic attributes and text transformation attributes; the text transformation attributes are used to generate the transformation effect of the text node.

[0310] In some embodiments, the second generation submodule is used to:

[0311] Performing URL encoding on the designated characters in the watermark expression to obtain URL encoded data;

[0312] Converting characters other than designated characters in the watermark expression and the URL encoded data into binary data;

[0313] The binary data is encoded according to a preset encoding rule to generate the target character string.

[0314] In some embodiments, the second generation submodule is used to:

[0315] Extracting a continuous character string of a preset length from the binary data;

[0316] The continuous character string extracted from the binary data is encoded according to the encoding rule to generate the target character string.

[0317] In some embodiments, the third generation submodule is used to:

[0318] According to the target character string, create the picture node;

[0319] The image node is moved into a preset texture node to generate a two-dimensional vector image of the watermark.

[0320] In some embodiments, the adding module 140 is used to:

[0321] The two-dimensional vector diagram of the watermark is added to the target document with a first transparency lower than a transparency threshold, wherein the transparency threshold is used to reduce the visual perception of the two-dimensional vector diagram in the target document.

[0322] It should be noted that: when the watermark adding device provided in the above embodiment executes the watermark adding method, only the division of the above program modules is used as an example. In actual application, the above processing can be assigned to different program modules as needed, that is, the internal structure of the device is divided into different program modules to complete all or part of the above-described processing. In addition, the watermark adding device provided in the above embodiment and the watermark adding method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0323] An embodiment of the present disclosure further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the watermark adding method provided by any embodiment of the present disclosure is implemented.

[0324] The electronic device may be a server. Here, the server may be various types of servers; for example, the server may be, but is not limited to, a cloud server or a local server.

[0325] The memory may include various types of storage media, which are non-transitory computer storage media that can continue to store information on the memory after the communication device loses power.

[0326] The processor may be connected to the memory via a bus or the like, and is used to read an executable program stored in the memory, for example, to implement the watermark adding method provided by any embodiment of the present disclosure.

[0327] An embodiment of the present disclosure further provides a computer-readable storage medium, wherein the computer-readable storage medium stores an executable program, wherein when the executable program is executed by a processor, the watermark adding method provided by any embodiment of the present disclosure is implemented.

[0328] It should be noted that the storage medium of the embodiment of the present disclosure can be implemented by any type of volatile or non-volatile storage device, or a combination thereof.

[0329] like Fig. 9 FIG. 2 is a diagram showing a structure of an electronic device 200 according to an exemplary embodiment. For example, the electronic device 200 may be provided as a server. Fig. 9 The electronic device 200 includes a processing component 210, which further includes one or more processors, and a memory resource represented by a memory 220 for storing instructions executable by the processing component 210, such as an application. The application stored in the memory 220 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 210 is configured to execute instructions to perform the watermark adding method in the above embodiment.

[0330] The electronic device 200 may further include a power supply component 230 configured to perform power management of the electronic device 200, a wired or wireless network interface 240 configured to connect the electronic device 200 to a network, and an input / output (I / O) interface 250. The electronic device 200 may operate based on an operating system stored in the memory 220, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.

[0331] In the several embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.

[0332] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment.

[0333] In addition, all functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may be separately configured as a unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0334] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.

[0335] Alternatively, if the above-mentioned integrated unit of the present disclosure is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present disclosure can essentially or in other words, the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods of each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.

[0336] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0337] The methods disclosed in several method embodiments provided in the present disclosure can be arbitrarily combined without conflict to obtain new method embodiments.

[0338] The features disclosed in several product embodiments provided in the present disclosure can be arbitrarily combined without conflict to obtain new product embodiments.

[0339] The features disclosed in several method or device embodiments provided in the present disclosure may be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0340] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.< / pattern> < / rotate> < / translate> < / text> < / rotate> < / translate> < / text>

Claims

1. A watermark adding method, characterized in that: The method comprises: Get the text content of the watermark to be added to the target document; According to the text content of the watermark, creating a text node for describing the text content; Converting the text nodes to generate a two-dimensional vector diagram of the watermark; The two-dimensional vector image of the watermark is added to the target document.

2. The method according to claim 1, characterized in that The text node is converted to generate a two-dimensional vector diagram of the watermark, including: Generate a watermark expression according to a preset watermark template and the text node; Encoding the watermark expression to generate a target character string; A two-dimensional vector image of the watermark is generated according to the target character string.

3. The method according to claim 2, characterized in that The step of generating a watermark expression according to a preset watermark template and the text node includes: According to the mapping relationship preset in the watermark template, the text node is mapped to obtain the node information of the picture node of the watermark; wherein the node information of the picture node at least includes the node character string of the picture node; The watermark expression is generated according to the node information of the picture node.

4. The method according to claim 3, characterized in that The text node is also used to describe the text attribute information of the watermark; The mapping process is performed on the text node according to the mapping relationship preset in the watermark template to obtain the node information of the picture node of the watermark, including: According to the mapping relationship preset in the watermark template, the text content and text attribute information described by the text node are mapped to obtain the node information of the picture node.

5. The method according to claim 4, characterized in that The node information of the picture node also includes picture attribute information; The mapping process is performed on the text content and text attribute information described by the text node according to the mapping relationship preset in the watermark template to obtain the node information of the picture node, including: According to a first mapping relationship preset in the watermark template, mapping the text content described by the text node to a node string of the image node; Mapping the text attribute information described by the text node to the image attribute information of the image node according to a second mapping relationship preset in the watermark template; The text attribute information includes at least one of the uniform resource identifier URI of the text node, text basic attributes and text transformation attributes; the text transformation attributes are used to generate the transformation effect of the text node.

6. The method according to claim 2, characterized in that The watermark expression is encoded to generate a target character string, including: Performing URL encoding on the designated characters in the watermark expression to obtain URL encoded data; Converting characters other than designated characters in the watermark expression and the URL encoded data into binary data; The binary data is encoded according to a preset encoding rule to generate the target character string.

7. The method according to claim 6, characterized in that The step of encoding the binary data according to a preset encoding rule to generate the target character string includes: Extracting a continuous character string of a preset length from the binary data; The continuous character string extracted from the binary data is encoded according to the encoding rule to generate the target character string.

8. The method according to any one of claims 2 to 7, characterized in that: Generating a two-dimensional vector diagram of the watermark according to the target character string, including: Create a picture node according to the target string; The image node is moved into a preset texture node to generate a two-dimensional vector image of the watermark.

9. The method according to claim 1, characterized in that: Adding the two-dimensional vector image of the watermark to the target document comprises: The two-dimensional vector diagram of the watermark is added to the target document with a first transparency lower than a transparency threshold, wherein the transparency threshold is used to reduce the visual perception of the two-dimensional vector diagram in the target document.

10. A watermark adding device, characterized in that: The device comprises: An acquisition module, used for acquiring the text content of the watermark to be added to the target document; A creation module, used for creating a text node for describing the text content according to the text content of the watermark; A conversion module, used for converting the text nodes to generate a two-dimensional vector diagram of the watermark; The adding module is used to add the two-dimensional vector image of the watermark to the target document.