Method and device for adding watermark to contract
By automatically generating and encrypting contract numbers and marking information in the contract, the problem of watermarks in the prior art is difficult to prevent tampering, the uniqueness and security of the contract are achieved, and the tamper-proof effect of the contract documents is ensured.
Patent Information
- Application Number
- CN202410448368.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2044-04-15
AI Technical Summary
The watermark added to existing contracts is difficult to prevent tampering and information leakage. Users can modify or replace the watermark to confuse the original and current versions, and cannot effectively distinguish them.
After the contract document is reviewed, the contract number and marking information are automatically generated, and the contract is inserted into the body of the contract through programming, a watermark plate contract is generated, and the process is encrypted to ensure the uniqueness of the watermark and the anti-tampering effect.
Improve the tamper-proof effect of the contract, ensure the uniqueness and security of the contract, prevent tampering and information leakage, and users can obtain a watermarked version when downloading to prevent tampering.
Smart Images

Figure CN118940231A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information security, and in particular to a method and device for adding watermarks to contracts. Background Art
[0002] In enterprises, contract tampering is a common risk. In addition, contract information leakage will also cause certain impact or losses to the enterprise. In order to prevent the above risks, it is usually adopted to add a watermark to the body of the contract.
[0003] Watermark is a means of digital protection. In the prior art, watermarks are mostly added to contracts in the form of text or image watermarks. This watermarking solution is not very sound for preventing tampering and information leakage, because after the user downloads the contract from the application system to the local computer, he can modify the content of the watermarked version of the contract, add the same image watermark or text watermark by himself, or make a separate contract text and obtain the watermark style through other means to add it. In this way, it is impossible to distinguish which is the original version and which is the current version. In other words, this method of adding watermarks only replaces text or images, and does not actually achieve the effect of preventing tampering. Summary of the invention
[0004] The present invention provides a method and device for adding a watermark to a contract to ensure the uniqueness and authenticity of the contract.
[0005] To this end, the present invention provides the following technical solutions:
[0006] The method and device for adding watermarks to contracts provided by the present invention automatically generate contract numbers and marking information after the contract document review is completed; obtain the contract document, read its text as a file stream, and write the file stream into a text object; then determine the watermark-related attributes, insert the contract number and marking information into the text object according to the watermark-related attributes, and generate a watermarked version of the contract text. By adding the contract number and marking information, the image watermark is realized through program design, the content of the watermark is unique, and the watermark cannot be imitated by other methods. Compared with the image watermark in the prior art, the anti-tampering effect of the contract is improved.
[0007] Furthermore, the watermarked contract text is encrypted to generate a watermarked contract file, which effectively restricts the editing of the text and ensures the security of the text.
[0008] Furthermore, when an online contract preview request is received, a watermarked version of the contract text is displayed, which will not affect the reading of the contract.
[0009] Furthermore, when a contract download request is received, the watermark in the watermark version of the contract file is removed, and the contract text after the watermark is removed is saved, effectively preventing the original contract file text from being tampered with. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 It is a flow chart of a method for adding watermark to a contract provided by an embodiment of the present invention;
[0011] Figure 2 is another flow chart of a method for adding a watermark to a contract provided by an embodiment of the present invention;
[0012] Figure 3 This is an example of the contract text after watermarking using the solution of the present invention;
[0013] Figure 4 It is a structural schematic diagram of a device for adding a watermark to a contract provided by an embodiment of the present invention;
[0014] Figure 5 The present invention is a flowchart of processing a contract using the device for adding watermarks to a contract provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0015] In order to enable persons skilled in the art to better understand the solutions of the embodiments of the present invention, the embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and implementation modes.
[0016] The embodiment of the present invention provides a method and device for adding a watermark to a contract. After the contract document review is completed, a contract number and marking information are automatically generated; the contract document is obtained, and the text of the contract document is read as a file stream, and the file stream is written into a text object; watermark-related attributes are determined; and according to the watermark-related attributes, the contract number and the marking information are inserted into the text object to generate a watermarked version of the contract text, thereby achieving effective protection of the contract text.
[0017] like Figure 1 FIG. 1 is a flow chart of a method for adding a watermark to a contract provided by an embodiment of the present invention, comprising the following steps:
[0018] Step 101, after the contract document review is completed, the contract number and marking information are automatically generated.
[0019] The contract number may be automatically generated according to a predetermined rule. For example, the following contract number generation rule may be used:
[0020] Contracting entity number + contract handling department number + year (two digits) + contract type code + serial number, such as: DQGW-ZH-23-ZL-001.
[0021] Of course, in practical applications, the number generation rules may be set according to actual needs of the user, which is not limited in the embodiment of the present invention.
[0022] Step 102, obtain the contract document, read the text of the contract document as a file stream, and write the file stream into a text object.
[0023] Specifically, the body of the contract document is read as a file stream BufferedInputStream, and the file stream is written into the Document object.
[0024] The Document object is an object in an HTML file. You can use the Document object to check, modify, or add content to an HTML document, and handle events within the document. On a Web page, the Document object can be referenced through the Document property of the Window object, or directly referenced.
[0025] Step 103: Determine watermark related attributes.
[0026] For example, you can use the seal generation tool class method Seal.builder() to set watermark related properties one by one.
[0027] The watermark related attributes include any one or more of the following: size size(300), color color(Color.LIGHT_GRAY), border circle (for example, set to line shape: dotted line, width: 140, height: 140), inner border circle (for example, set to line shape: dotted line, width: 132, height: 132), inner circle (for example, set to line shape: dotted line, width: 120, height: 120), main word (for example, the main word content is contract number, font size 30, gap 30, interval 20), center word (for example, the center word content is an empty string, font size 100), header (for example, the header content is an empty string, font size 22, gap 10.0, interval 68).
[0028] After the settings are completed, call Seal.draw(newFile) to generate a seal with the watermark content and store it in the ZWSY.jpg file in the specified directory.
[0029] Step 104: insert the contract number and the marking information into the text object according to the watermark-related attributes to generate a watermarked version of the contract text.
[0030] Specifically, the Aspose technical method may be called to pass in the Document object newParagraph(doc) object generated in the above step 103, and pass in the doc object and set the watermark format to the image format new Shape(doc,ShapeType.IMAGE).
[0031] Then, through the shape operation, set the following information in sequence:
[0032] 1) Watermark image location getImageData().setImage(image),
[0033] 2) Watermark tilt setRotation(0),
[0034] 3) Brightness setBrightness(0.5),
[0035] 4) Contrast setContrast(0.5),
[0036] 5) Watermark width setWidth(60),
[0037] 6) Watermark height setHeight(230),
[0038] 7) Relative horizontal position
[0039] setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE)、
[0040] 8) Relative vertical position
[0041] setRelativeVerticalPosition(RelativeVerticalPosition.PAGE),
[0042] 9)Text vertical alignment setVerticalAlignment(VerticalAlignment.CENTER),
[0043] 10) Set the text horizontal alignment to HorizontalAlignment (HorizontalAlignment.CENTER).
[0044] Then, call watermarkPara.appendChild(shape) to insert the set watermark into the contract body.
[0045] The method for adding watermarks to contracts provided in this embodiment automatically generates a contract number and marking information after the contract document review is completed; obtains the contract document, reads its text as a file stream, and writes the file stream into a text object; then determines the watermark-related attributes, inserts the contract number and marking information into the text object according to the watermark-related attributes, and generates a watermarked version of the contract text. By adding the contract number and marking information, the content of the watermark is enriched. Compared with the watermark in the form of a fixed image in the prior art, the watermark in the solution of the present invention is automatically generated through program design, which improves the anti-tampering effect of the contract.
[0046] like Figure 2 FIG. 2 is another flow chart of a method for adding a watermark to a contract provided by an embodiment of the present invention, comprising the following steps:
[0047] Step 201, after the contract document review is completed, the contract number and marking information are automatically generated.
[0048] Step 202, obtain the contract document, read the text of the contract document as a file stream, and write the file stream into a text object.
[0049] Step 203: Determine watermark related attributes.
[0050] Step 204: insert the contract number and the marking information into the text object according to the watermark-related attributes to generate a watermarked version of the contract text.
[0051] It should be noted that, in a specific application, the marking information may be a setting frame, such as a circular frame, a square frame, a diamond frame, etc. In addition, the setting frame may be represented by a solid line or a dotted line, and may have one or more layers. This is not limited in the embodiments of the present invention.
[0052] When inserting the contract number and the marking information, the positions of the two can be set arbitrarily. For example, the contract number can be placed inside or outside the setting box, etc., and this embodiment of the present invention does not limit this.
[0053] Step 205, encrypting the watermarked version contract text to generate a watermarked version contract file.
[0054] For example, the text can be saved as a watermarked file through the corresponding text control indiDocx, where the saved file is encrypted by the control indiDocx, thereby limiting the editing of the text.
[0055] Figure 3 An example of a contract text after watermarking using the solution of the present invention is shown.
[0056] The method for adding a watermark to a contract provided in this embodiment generates a watermarked contract file by encrypting the watermarked contract text, thereby effectively limiting the editing of the text and ensuring the security of the text.
[0057] Furthermore, in order to facilitate users to browse the contract text, in another non-limiting embodiment of the present invention, it may further include: when receiving an online contract preview request, displaying the watermarked version of the contract text.
[0058] Furthermore, in order to meet the user's demand for contract downloading, in another non-limiting embodiment of the present invention, it may further include: when a contract download request is received, the watermark in the watermark version contract file is removed, and the contract text after the watermark is removed is saved.
[0059] In order to prevent copying and pasting after downloading the text with watermark anti-counterfeiting mark through the text control indiDocx, you can copy the text with watermark through the API method when downloading:
[0060] indiDocxAttachmentService.copyAttachmentPhysicalByGroupCode(contractInfoEntity.getContractText(),false).
[0061] After copying, remove the file watermark by calling the Aspose technology API interface sect.getHeadersFooters().getByHeaderFooterType(headerType).removeAllChild ren(). After the removal is completed, call the contract text save API method to save the text.
[0062] It can be seen that, by utilizing the solution of the present invention, when a user downloads the contract text, he can only download the text without watermark, while the text opened in the online preview is the watermarked version of the text, which not only facilitates the user's reading of the contract, but also facilitates the user's downloading of the contract, and can effectively protect the contract text from being tampered with.
[0063] Accordingly, an embodiment of the present invention also provides a device for adding a watermark to a contract, such as Figure 4 Shown is a structural schematic diagram of the device.
[0064] The device 400 for adding watermark to a contract in this embodiment includes the following modules:
[0065] The information generation module 401 is used to automatically generate a contract number and marking information after the contract document review is completed;
[0066] The file reading module 402 is used to obtain the contract file, read the text of the contract file as a file stream, and write the file stream into a text object;
[0067] A watermark setting module 403, used to determine watermark related attributes;
[0068] The watermark inserting module 404 is used to insert the contract number and the marking information into the text object according to the watermark related attributes to generate a watermarked version of the contract text.
[0069] The watermark-related attributes and insertion method can refer to the description in the above-mentioned method embodiment of the present invention, which will not be described in detail here.
[0070] In another non-limiting embodiment, the device 400 for adding a watermark to a contract may further include: a storage module (not shown) for encrypting the watermarked version of the contract text to generate a watermarked version of the contract file.
[0071] By encrypting the watermarked contract text and generating a watermarked contract file, the editing of the text is effectively restricted, thus ensuring the security of the text.
[0072] In another non-limiting embodiment, the apparatus 400 for adding a watermark to a contract may further include: a preview module, and / or a download module (not shown).
[0073] The preview module is used to display the watermarked version of the contract text when receiving an online contract preview request.
[0074] The download module is used to remove the watermark in the watermark version contract file when receiving a contract download request; and save the contract text after the watermark is removed.
[0075] In this way, the user's needs for contract preview and download can be better met, and the contract text can be effectively protected from being tampered with.
[0076] Reference Figure 5 , Figure 5 An example process of processing a contract using the device for adding watermarks to a contract provided by an embodiment of the present invention is shown.
[0077] like Figure 5 As shown, after the contract approval is completed, with the help of Aspose plug-in, on the one hand, the contract number is automatically generated according to the rules, and on the other hand, the dotted circle is automatically generated according to the background algorithm.
[0078] Read the contract text, automatically insert the contract number and dotted circle into the contract text, and generate a watermarked version of the contract text.
[0079] Then, the watermarked version of the contract text is encrypted. Specifically, the contract text can be previewed using the application platform text control and saved as a watermarked version of the contract file.
[0080] When the user needs to view the contract, he can use the text control of the application platform to browse it, and the contract with watermark is displayed to the user;
[0081] When the user needs to download the contract, he can use the text control of the application platform to download it. The downloaded contract text is the text without the watermark, that is, the text without the watermark. Accordingly, the user can edit the text, but the user cannot download the watermark, so the watermark version of the contract file cannot be tampered with, ensuring the security of the contract file.
[0082] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or apparatus.
[0083] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. Moreover, the system embodiments described above are merely schematic, in which the modules and units described as separate components may or may not be physically separated, that is, they may be located on one network unit, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0084] The embodiments of the present invention are described in detail above. The present invention is described in detail using specific implementation methods herein. The description of the above embodiments is only used to help understand the method and system of the present invention. It is only a part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should belong to the scope of protection of the present invention, and the content of this specification should not be understood as limiting the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for adding a watermark to a contract, characterized in that: The method comprises: After the contract document review is completed, the contract number and tag information are automatically generated; Acquire the contract document, read the text of the contract document as a file stream, and write the file stream into a text object; Determine watermark related attributes; The contract number and the marking information are inserted into the text object according to the watermark related attributes to generate a watermarked version of the contract text.
2. The method according to claim 1, characterized in that The marking information is a setting box.
3. The method according to claim 2, characterized in that The setting frame is one or more layers of circular rings.
4. The method according to claim 3, characterized in that The watermark-related attributes include any one or more of the following: watermark size, color, border circle, inner border circle, inner circle, main characters, center characters, and heading; the main characters include the contract number, and any one or more of the following information: font size, space, and interval of the contract number.
5. The method according to claim 4, characterized in that The central word and / or the header is an empty character string.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The watermarked version of the contract text is encrypted to generate a watermarked version of the contract file.
7. The method according to claim 6, characterized in that The method further comprises: When receiving a request for online preview of a contract, displaying the watermarked version of the contract text; and / or When a contract download request is received, the watermark in the watermark version contract file is removed, and the contract text after the watermark is removed is saved.
8. A device for adding watermarks to contracts, characterized in that: The device comprises: An information generation module is used to automatically generate contract numbers and marking information after the contract document review is completed; A file reading module, used for obtaining the contract file, reading the text of the contract file as a file stream, and writing the file stream into a text object; A watermark setting module, used to determine watermark related attributes; The watermark insertion module is used to insert the contract number and the marking information into the text object according to the watermark related attributes to generate a watermark version of the contract text.
9. The device according to claim 8, characterized in that The device also includes: The storage module is used to encrypt the watermark version contract text and generate a watermark version contract file.
10. The device according to claim 9, characterized in that The device further comprises: a preview module and / or a download module; The preview module is used to display the watermarked version of the contract text when receiving an online contract preview request. The download module is used to remove the watermark in the watermark version contract file when receiving a contract download request; and save the contract text after the watermark is removed.
Citation Information
Patent Citations
Electronic document online editing method and system
CN109408783A
Management method and device for electronic contracts, equipment and medium
CN110991991A
