Detailed Description
In order to make the solution of the embodiment of the present invention better understood by those skilled in the art, the embodiment of the present invention is further described in detail below with reference to the accompanying drawings and embodiments.
The embodiment of the invention provides a method and a device for adding watermarks to a contract, which automatically generate contract numbers and marking information after the examination of a contract file is completed; acquiring the contract file, reading the text of the contract file as a file stream, and writing the file stream into a text object; determining watermark correlation properties; and inserting the contract number and the marking information into the text object according to the watermark related attribute to generate a watermark version contract body, thereby realizing effective protection of the contract body.
As shown in fig. 1, a flowchart of a method for adding watermarks in a syndication according to an embodiment of the invention includes the following steps:
Step 101, automatically generating contract number and mark information after the examination of the contract document is completed.
The contract number may be automatically generated according to a predetermined rule, for example, the following contract number generation rule may be adopted:
sign-up subject number + contract underwriting department number + year (two digits) +contract type code + running number, such as: DQGW-ZH-23-ZL-001.
Of course, in practical application, the number generation rule may be set according to the actual needs of the user, which is not limited to the embodiment of the present invention.
And 102, acquiring the contract file, reading the text of the contract file as a file stream, and writing the file stream into a text object.
Specifically, the body of the contract file is read as a file stream BufferedInputStream, which is written into the Document object.
A Document object refers to an object in an HTML Document with which the HTML Document can be checked, modified, or added with content, and events within the Document processed. On a Web page, a Document object may be referenced by a Document attribute of a Window object, or directly.
Step 103, determining watermark correlation properties.
For example, watermark related attribute setting can be sequentially performed by using a seal generation tool method seal.
The watermark correlation attribute includes any one or more of the following: size (300), color (color. Light_GRAY), edge circle (e.g., set to line shape: dot-dashed line, width: 140, height: 140), inner edge circle (e.g., set to line shape: dot-dashed line, width: 132, height: 132), inner edge circle (e.g., set to line shape: dot-dashed line, width: 120, height: 120), main word (e.g., main word content is contract number, font size 30, gap 20), center word (e.g., center word content is empty string, font size 100), head-up (e.g., head-up content is empty string, font size 22, gap 10.0, gap 68).
After the setting is completed, the seal. Draw (newFile) is called, the watermark content is generated into a seal, and the seal is stored in a ZWSY. Jpg file under the appointed directory.
And step 104, inserting the contract number and the marking information into the text object according to the watermark correlation attribute to generate a watermark version contract body.
Specifically, the Aspose technical method may be invoked to transfer the Document object NEW PARAGRAPH (doc) object generated in the step 103, and transfer the doc object and set the watermark format as the picture format new Shape (doc, shape type.image).
Then, through the shape operation, the following information is set in order:
1) Watermark picture position GETIMAGEDATA (). SetImage (image),
2) Watermark gradient setRotation (0),
3) Brightness setBrightness (0.5),
4) Contrast setContrast (0.5),
5) Watermark width setWidth (60),
6) Watermark height SETHEIGHT (230),
7) Relative horizontal position
setRelativeHorizontalPosition(RelativeHorizontalPosition.PAGE)、
8) Relative vertical position
setRelativeVerticalPosition(RelativeVerticalPosition.PAGE)、
9) Text vertical alignment SETVERTICALALIGNMENT (center),
10 Text level alignment etHorizontalAlignment (horizontal alignment).
Then, watermark Para. Appendshield (shape) is called, and inserting the set watermark into the contract text.
According to the method for adding the watermark to the contract, after the examination of the contract file is completed, contract numbers and marking information are automatically generated; acquiring a contract file, reading the text of the contract file as a file stream, and writing the file stream into a text object; and then determining the watermark correlation attribute, and inserting the contract number and the marking information into the text object according to the watermark correlation attribute to generate a watermark version contract text. By adding contract number and mark information, the content of the watermark is enriched. Compared with the watermark of the fixed picture mode in the prior art, the method and the device automatically generate the watermark through programming, and improve the anti-tampering effect of the contract.
As shown in fig. 2, another flowchart of a method for adding watermarks in a syndication according to an embodiment of the invention includes the following steps:
in step 201, after the examination of the contract document is completed, the contract number and the mark information are automatically generated.
Step 202, acquiring the contract file, reading the text of the contract file as a file stream, and writing the file stream into a text object.
In step 203, watermark correlation properties are determined.
And 204, inserting the contract number and the marking information into the text object according to the watermark correlation attribute to generate a watermark version contract body.
It should be noted that, in a specific application, the marking information may be a setting frame, for example, a circular frame, a square frame, a diamond frame, and the like. In addition, the setting frame may be represented by a solid line or a broken line, and may have one or more layers. The embodiments of the present invention are not limited in this regard.
When the contract number and the mark information are inserted, the positions of the contract number and the mark information may be set arbitrarily, for example, the contract number may be placed in the setting frame or out of the setting frame, which is not limited to the embodiment of the present invention.
And 205, carrying out encryption setting on the watermark contract text to generate a watermark contract file.
For example, text may be saved as a watermarked file via a corresponding text control indiDocx, where the saved file is encrypted via control indiDocx, thereby limiting the editing process for the text.
Fig. 3 shows an example of the body of a contract after watermarking with the scheme of the present invention.
According to the method for adding the watermark to the contract, the watermark contract file is generated by encrypting the watermark contract body, so that editing processing of the body is effectively limited, and the safety of the body is ensured.
Further, in order to facilitate the user to browse the contract text, in another non-limiting embodiment of the present invention, the method may further include: and when receiving the online preview contract request, displaying the watermark version contract text.
Further, in order to meet the downloading requirement of the user on the contract, in another non-limiting embodiment of the present invention, the method may further include: and when receiving a contract downloading request, removing the watermark in the watermark version contract file, and storing the contract text after watermark removal.
In order to prevent copy-paste tampering after the text with the watermark anti-counterfeiting mark is downloaded through the text control indiDocx, the copy operation can be performed on the text with the watermark by an API method during downloading:
indiDocxAttachmentService.copyAttachmentPhysicalByGroupCode(contra ctInfoEntity.getContractText(),false).
And after copying, removing the file watermark by calling Aspose technical API interface ct.getHeaadensFootes (). GetByHeaderFooterType (headerType). RemoveAllChild ren (), and calling a contract text preservation API method to preserve the text after removing.
Therefore, by utilizing the scheme of the invention, only the watermark-free text can be downloaded when the user downloads the contract text, and the text which is opened by online previewing is the watermark version text, thereby being convenient for the user to read the contract, facilitating the user to download the contract and effectively ensuring that the contract text cannot be tampered.
Correspondingly, the embodiment of the invention also provides a device for adding the watermarks to the combination, as shown in fig. 4, which is a schematic structural diagram of the device.
The apparatus 400 for co-watermarking in this embodiment includes the following modules:
an information generating module 401, configured to automatically generate a contract number and tag information after the examination of the contract document is completed;
A file reading module 402, configured to obtain the contract file, read a body of the contract file as a file stream, and write the file stream into a text object;
A watermark setting module 403, configured to determine a watermark correlation attribute;
And the watermark insertion module 404 is configured to insert the contract number and the marking information into the text object according to the watermark correlation attribute, and generate a watermarked contract body.
The watermark correlation attribute and the insertion mode can refer to the description in the foregoing method embodiment of the present invention, and are not repeated here.
In another non-limiting embodiment, the apparatus 400 for co-watermarking may further comprise: and the storage module (not shown) is used for carrying out encryption setting on the watermark contract text to generate a watermark contract file.
By encrypting the watermark contract text, a watermark contract file is generated, editing processing of the text is effectively limited, and the security of the text is ensured.
In another non-limiting embodiment, the apparatus 400 for co-watermarking may further comprise: a preview module, and/or a download module (not shown). Wherein:
and the preview module is used for displaying the watermark version contract text when receiving an online preview contract request.
The downloading module is used for removing the watermark in the watermark version contract file when receiving the downloading contract request; and storing the contract text after the watermark is removed.
Therefore, the requirements of the user on previewing and downloading the contract can be better met, and the fact that the body of the contract cannot be tampered can be effectively guaranteed.
Referring to fig. 5, fig. 5 illustrates an example flow of processing a contract using an apparatus for watermarking a contract provided by an embodiment of the invention.
As shown in fig. 5, after the contract approval is finished, by means of Aspose plug-ins, on the one hand, the contract number is automatically generated according to rules, and on the other hand, the dotted circle is automatically generated according to a background algorithm.
And reading the contract text, automatically inserting the contract number and the dotted circular ring into the contract text, and generating the watermark version contract text.
And then, encrypting the watermark contract text, specifically, previewing the contract text by using an application platform text control, and storing the watermark contract text as a watermark contract file.
When a user needs to view the contract, browsing by using an application platform text control, and displaying the watermark-carrying contract to the user;
when the user needs to download the contract, the application platform text control is utilized to download the downloaded contract text, namely the text without the watermark, namely the anhydrous printing plate text. Accordingly, the user can edit the text, but the user cannot download the watermark, so that the watermark version contract file cannot be tampered, and the security of the contract file is ensured.
It is noted that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of the present invention and in the foregoing figures, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. Moreover, the system embodiments described above are illustrative only, and the modules and units illustrated as separate components may or may not be physically separate, i.e., may reside on one network element, or may be distributed across multiple network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
While the embodiments of the present invention have been described in detail, the detailed description of the invention is provided herein, and the description of the embodiments is provided merely to facilitate the understanding of the method and system of the present invention, which is provided by way of example only, and not by way of limitation. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention, and the present description should not be construed as limiting the present invention. It is therefore contemplated that any modifications, equivalents, improvements or modifications falling within the spirit and principles of the invention will fall within the scope of the invention.