Disclosure of Invention
The invention aims to overcome the technical current situation that the delayed watermark adding cannot be supported and the adding of different watermarks in each page cannot be realized in the prior art, and provides a document-based delayed watermark adding technology for solving the technical problem that the current plug-in can only add watermarks immediately and cannot add watermarks in a delayed manner.
The core idea of the invention is as follows: the user can set the time for adding the watermark, and when the current time is more than or equal to the set time, the watermark is added into the pdf file; the system relied on by the invention comprises a graphical interface used for generating configuration files, a creating plug-in used for controlling the addition of watermarks and an opening plug-in used for controlling the opening of files.
A technology for adding delay watermark based on document includes creating copy and attribute file of source file, opening copy of source file by opening plug-in;
wherein, creating a source file copy and a property file specifically comprises the following steps:
step A, setting relevant parameters for adding watermarks and generating configuration files through a graphical interface;
the relevant parameters comprise whether a watermark is added or not, a source file path, a watermark file path, a configuration file storage path, a generated encrypted file storage path, an open password, an edit password, a watermark angle, watermark transparency, a watermark proportion, background position and watermark adding time;
b, generating a copy of the source file and an attribute file by creating a plug-in;
wherein, an opening password and an editing password are added in the generated copy of the source file;
the property file contains: opening a password, editing the password, adding a watermark, adding time, locating in a background, a watermark proportion, a watermark angle and watermark transparency;
the method comprises the following steps of:
b.1, writing a first page of the attribute file into whether the watermark is added, a password is opened, a password is edited, a watermark angle, watermark transparency, watermark proportion, background position and watermark adding time which are set in the step A;
step b.2 opens the watermark file and copies the watermark file after the first page of the property file (there may be multiple pages of the watermark file). (ii) a
Step B.3, saving the attribute file into the folder of the generated encrypted file saving path set in the step A;
step C, reading the configuration file generated in the step A by creating a plug-in, opening the source file through a source file path, copying the source file to obtain a copy of the source file, and storing the copy of the source file into a folder of the generated encrypted file saving path set in the step A;
step D, adding an opening password and an editing password for the copy of the source file generated in the step B, and adding an opening password for the generated attribute file, wherein the steps are as follows:
the attribute file is stored in a folder of the generated encrypted file storage path, and the opening password added for the attribute file is not the opening password filled in the step A but a fixed password;
step E, closing the opened source file and the watermark file;
wherein, the source file and the watermark file are not changed in the process from the step A to the step E;
a copy of the source file and a property file are located under the generated encrypted file saving path;
from step A to step E, the creation of the copy of the source file and the property file is completed;
opening a copy of a source file by opening a plug-in, specifically comprising the steps of:
step 1, opening an attribute file and reading the content of a first page of the attribute file, specifically:
searching a corresponding attribute file in a peer directory of the generated encrypted file saving path by opening the plug-in, if the corresponding attribute file cannot be found, reporting an error, and exiting the program; if the attribute file is found, opening the plug-in, opening the attribute file by inputting a fixed opening password, and reading the content of the first page of the attribute file;
step 2, acquiring the current system time;
step 3, comparing the current system time with the time for adding the watermark to decide whether to add the watermark or not, specifically comprising the following steps:
3.1 if the current system time is less than the time for adding the watermark, the watermark is not required to be added, the plug-in is opened, the copy of the source file is opened in a read-only mode by inputting the opening password in the step A, and the copy is displayed to a user;
3.2 if the current system time is more than or equal to the time of adding the watermark, judging the attribute of 'whether the watermark is added' and determining whether the watermark is added or not without adding the watermark again and showing the watermark to a user according to the judgment result of 'whether the watermark is added', specifically:
a, if the 'whether the watermark is added' is equal to 1, the watermark is added, the watermark does not need to be added again, the opening password in the step A is input, the copy of the source file is opened in a read-only mode, and the copy is displayed to a user;
3.2.B if the 'whether the watermark is added' is equal to 0, indicating that the watermark is not added, firstly inputting the opening password and the editing password which are set in the step A, opening the copy of the source file in an editable mode, then reading the content of the attribute file after the second page, and adding the watermark to the copy of the source file through the attributes such as the watermark angle, the watermark transparency, the watermark proportion, the background and the like which are set in the step A; modifying the content of the attribute file, setting the value of 'whether the watermark is added' to be 1, finally closing the copy of the source file, inputting the opening password in the step A, opening the copy of the source file in a read-only mode, and displaying the copy to a user;
reading all contents, namely watermark files, of the attribute file after the first page;
step 4, closing the opened copy of the source file and the attribute file;
to this end, from step 1 to step 4, opening a copy of the source file by opening the plug-in is completed;
to this end, a document-based delayed watermarking technique is completed from step a to step E, and from step 1 to step 4.
Advantageous effects
Compared with the prior watermarking technology, the document-based delayed watermarking technology has the following advantages
Has the advantages that:
1. the watermark can be added in a delayed manner, so that the addition of the watermark is more flexible;
2. the original source file and the original watermark file are not modified, so that the security is high;
3. different watermarks can be added to different pages in batches.
Example 2
This embodiment describes the process of the present invention for a document-based delayed watermarking technique to create a configuration file 16 via the graphical interface 1, read the configuration file 16 via the creation plug-in 2 and generate a copy 19 of the source file and a property file 20.
Fig. 2 is a schematic diagram of a graphical interface 1 of a document-based delayed watermarking technique of the present invention. As can be seen from fig. 2, the graphical interface 1 includes whether a watermark 4 is added, a source file path 5, a watermark file path 6, a configuration file saving path 7, a generated encrypted file saving path 8, an open password 9, an edit password 10, a watermark angle 11, a watermark transparency 12, a watermark proportion 13, a position in a background 14, and a watermark adding time 15; by filling in these fields, a configuration file 16 is generated.
Fig. 3 is a schematic diagram of the generation of a copy 19 of the source file and a property file 20 by the creation plug-in 2 of a document-based delayed watermarking technique of the invention. The method comprises the following specific steps:
and a, copying the created plug-in 2 to a plug-in directory of the adobe reader.
And b, opening an adobe reader, clicking a time delay watermark creating button, and selecting the configuration file 16 generated in the embodiment 1.
And c, opening the source file and the watermark file through the source file path 5 and the watermark file path 6 filled in the embodiment 1.
Below the generated encrypted file path 8, two encrypted files will be generated, a copy 19 of the source file and a property file 20. The first page of the attribute file 20 is written with information about whether the watermark 4 is added, the opening password 9, the editing password 10, the watermark angle 11, the watermark transparency 12, the watermark proportion 13, the position in the background 14 and the watermark adding time 15, and the rest pages of the attribute file 20 are copies of the watermark file.
Step e. add the open password 9 and edit password 10 filled in example 1 to the generated copy 19 of the source file and add a fixed open password to the generated property file 20.
And f, closing the source file and the watermark file.
Thus, below the generated encrypted file saving path, a copy 19 of the source file to which the open password 9 and the edit password 10 are added and a property file 20 to which the open password is fixed are generated.
Example 3
This embodiment describes the process of opening a file by opening plug-in 3 according to a document-based delayed watermarking technique of the present invention.
Fig. 4 is a schematic diagram of the file opening by the opening plug-in 3 of the document-based delayed watermarking technique of the present invention. The method comprises the following specific steps:
and step I, copying the opened plug-in 3 to a plug-in directory of the adobe reader.
Step ii, open the adobe reader, click the open file button, and select the copy 19 of the source file generated in embodiment 2, at this time, open the plug-in 3 will search for the corresponding property file 20 in the peer directory of the copy 19 of the source file. If not, an error is reported, otherwise, all contents of the first page of the property file 20 are read.
And step III, opening the plug-in 3 to acquire the current time 22 of the system.
And IV, comparing the current time 22 of the system with the watermarking time 15.
And V, if the current time 22 of the system is less than the watermark adding time 15, the watermark is not required to be added, and the plug-in 3 is opened to control the copy 19 of the source file to be opened in a read-only mode.
Step vi. if the system current time 22 is greater than or equal to the watermark adding time 15 and if the added watermark 4 is equal to 1, it indicates that the watermark has been added, the copy 19 of the source file is opened in a read-only manner, otherwise, the copy 19 of the source file is opened in an editable manner and the property file 20 is opened in a read-only manner (not shown to the user). According to the information of the first page of the property file 20: watermark angle 11, watermark transparency 12, watermark proportion 13, files located after the background 14 and the first page of the property file (i.e. watermark files), a watermark is added to a copy 19 of the source file. And after the watermark is added, modifying the value of 'whether the watermark is added' 4 in the first page of the attribute file 20, changing 0 to 1, closing the copy 19 of the source file, and closing the attribute file 20. A copy 19 of the source file is then opened in a read-only manner.
The whole process of example 3 is now complete.
While the foregoing is directed to the preferred embodiment of the present invention, it is not intended that the invention be limited to the embodiment and the drawings disclosed herein. Equivalents and modifications may be made without departing from the spirit of the disclosure, which is to be considered as within the scope of the invention.