A document batch watermark adding method, system and storage medium

By recognizing and classifying PDF document pages and adjusting watermark parameters to avoid overlap, the problem of time-consuming and labor-intensive watermark addition and low recognition rate in existing technologies has been solved, achieving efficient QR code or barcode watermark addition.

CN114969683BActive Publication Date: 2025-11-07SHANGHAI MINGDU INTELLIGENT CLOUD COMPUTING CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210658689.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-12
Publication Date
2025-11-07
Estimated Expiration
2042-06-12

AI Technical Summary

Technical Problem

Existing PDF editors cannot adjust the addition of QR codes or barcode watermarks according to the actual situation of the page, resulting in time-consuming and laborious operations. Furthermore, the overlap of QR codes or barcode watermarks with the main text of the page affects the recognition rate.

Method used

By identifying and classifying document pages, determining the overlap between text areas and watermark blocks, adjusting watermark parameters to avoid overlap, and generating watermark templates suitable for different page types.

Benefits of technology

It improves the efficiency of watermark addition, avoids overlap between QR code or barcode watermarks and the main text, and improves the recognition rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114969683B_ABST
    Figure CN114969683B_ABST
Patent Text Reader

Abstract

The application discloses a document batch watermark adding method and system and a storage medium. Each page in a target document to which a watermark is to be added is recognized in batches, and is divided into multiple page types according to the positions of text regions in the pages. It is judged whether the text regions in a first page type belonging to a text page coincide with a second watermark block containing a barcode or a two-dimensional code picture which is planned to be added. If there is coincidence, part of variable parameters in the second watermark type is adjusted to form a second watermark adjustment block to replace an original second watermark block in an initial watermark template, so as to form a first watermark template corresponding to the first page type. Finally, the first watermark template is added to each target page marked as the first page type. Through the adjustment operation on the second watermark block, interference of the text regions in the first page type on the two-dimensional code watermark is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of medical information technology, and in particular to a document batch watermark adding method and system and a storage medium. BACKGROUND

[0002] At present, when a user adds a watermark to a large number of pages in a document, for example, when a watermark is inserted in a PDF document by using an existing PDF editor, the PDF editor directly performs a watermark adding operation on the entire document. For a relatively large document, it usually takes a long time to complete the operation. At the same time, the watermark adding operation can only be performed on specific document pages according to the page numbers set in advance by an operator, and cannot be adjusted according to the actual situation of some pages. For example, when a special watermark such as a two-dimensional code or a barcode is added to each page of a document, in order to make the two-dimensional code or barcode watermark as little as possible to coincide with the text in the page to cause recognition obstacles, the operator often needs to constantly preview the watermark effect of each page before adding the watermark, and adjust the watermark parameters until the preview effect meets the requirements before printing. The operation process is time-consuming and laborious, and seriously affects the efficiency of document watermark adding. SUMMARY

[0003] The present application provides a document batch watermark adding method, which comprises the following steps:

[0004] S1, identifying each page of a target document to be added with a watermark, and obtaining the region of the text content in each page;

[0005] S2, marking each page of the target document as a plurality of page types according to the layout of the text content in each page, and identifying the largest text region in a first page type as a text page;

[0006] S3, determining whether at least one second watermark block exists in an initial watermark template, and if so, calculating a second region on the initial watermark template according to the page distribution parameters and the arrangement rule parameters of the second watermark type; the second watermark block is configured to generate a watermark picture containing a barcode or a two-dimensional code according to the input parameters of the second type of watermark;

[0007] S4, if the second region overlaps the largest text region or the overlapping region does not meet the set overlapping rule, adjusting part of the variable parameters in the second watermark type to form a second watermark adjustment block, replacing the second watermark block with the second watermark adjustment block in the initial watermark template to form a first watermark template corresponding to the first page type, and adding the first watermark template to each target page marked as the first page type.

[0008] Preferably, the step S2 further comprises: marking the pages with the same maximum text region in the target document pages as the first page type, and marking the other pages as the second page type, wherein the maximum text region is a rectangular region.

[0009] Preferably, the document batch watermark adding method further comprises: S5, adding the second watermark blocks in the initial watermark template to form a second watermark template corresponding to the second page type, and adding the second watermark template into each target page marked as the second page type.

[0010] Preferably, the step S3 further comprises: if there is only the first watermark block in the initial watermark template, generating the first watermark block arranged on the first region of the initial watermark template according to the page distribution parameters and the arrangement rule of the first watermark type, and adding the initial watermark template into each target page marked as the first page type.

[0011] Preferably, the step S4 further comprises:

[0012] If the second region overlaps with the maximum text region or the overlapping region does not conform to the set overlapping rule, it is judged whether the number of rows in the watermark layout parameter in the second watermark type is greater than 2, and if the number of rows is greater than 2, the number of rows in the layout parameter is modified to 2.

[0013] The watermark position parameter in the second watermark type is modified, and the two second watermark blocks located above and below are modified respectively to move the corresponding second regions upward and downward to form two second watermark adjustment blocks; the second regions corresponding to the second watermark adjustment blocks do not overlap with the maximum text region or the overlapping region conforms to the set overlapping rule.

[0014] The second watermark blocks are replaced by the second watermark adjustment blocks in the initial watermark template to form a first watermark template corresponding to the first page type, and the first watermark template is added into each target page marked as the first page type.

[0015] The application further discloses a document batch watermark adding system, which comprises a page recognition module, a marking module, a watermark judgment module and a first watermark adding module.

[0016] Preferably, the marking module is further used for marking pages with the same maximum text area in the target document pages as the first page type and marking other pages as the second page type, and the maximum text area is a rectangular area.

[0017] Preferably, the document batch watermark adding system further comprises a second watermark adding module, which is used for adding the second watermark block in the initial watermark template to form a second watermark template corresponding to the second page type and adding the second watermark template into each target page marked as the second page type.

[0018] The application further discloses a document batch watermark adding device, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, and the processor implements the steps of any one of the foregoing methods when executing the computer program.

[0019] The application further discloses a computer readable storage medium, which stores a computer program, and the computer program implements the steps of any one of the foregoing methods when executed by a processor.

[0020] The application discloses a document batch watermark adding method and system and a storage medium.

[0021] Additional aspects and advantages of the application will be made apparent by the following description and the appended claims. BRIEF DESCRIPTION OF DRAWINGS

[0022] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:

[0023] Figure 1 A flowchart of a document batch watermark adding method disclosed for an embodiment.

[0024] Figure 2 A specific flowchart of step S4 disclosed for an embodiment.

[0025] Figure 3 Another specific flowchart of step S4 disclosed for an embodiment. DETAILED DESCRIPTION

[0026] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the embodiments of the present application will be described clearly and completely below with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are some but not all of the embodiments of the present application. Based on the described embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort belong to the scope of protection of the present application.

[0027] In the present application, unless otherwise clearly specified and limited, the technical terms or scientific terms used herein shall be understood as the usual meanings understood by those skilled in the art to which the present application pertains. The terms "first", "second", and similar terms used in the patent application description and claims of the present application do not represent any order, number, or importance, but are only used to distinguish different components. Similarly, the terms "one" or "a" and similar terms do not represent a quantity limitation, but represent the existence of at least one.

[0028] As shown in the accompanying Figure 1 The present embodiment discloses a document batch watermark adding method, comprising the following steps:

[0029] Step S1, identifying each page of the target document to be added with watermark, and obtaining the area where the text content in each page is located.

[0030] Step S2, marking the target document pages as a plurality of page types according to the layout of the text content in each page, and identifying the largest text area in the first page type as a text page.

[0031] In step S2, the pages in the target document having the same largest text area are marked as the first page type, and the other pages are marked as the second page type, and the largest text area is a rectangular area.

[0032] The pages in the target document having the same largest text area are marked as the first page type, and the other pages are marked as the second page type, and the largest text area is a rectangular area. In the document, the pages having the largest text area are often text pages, so these text pages are marked as the first page type, and the other pages are marked as the second page type, which can be directory pages, index pages, content separation pages, and other pages.

[0033] Step S3, determining whether there is at least one second watermark block in the initial watermark template, if there is, calculating the second area on the initial watermark template according to the page distribution parameters and the arrangement rule parameters of the second watermark type; the second watermark block is configured to generate a watermark picture containing a bar code or a two-dimensional code according to the input parameters of the second type watermark.

[0034] The step S3 further comprises: if there is only a first watermark block in the initial watermark template, generating the first area on the initial watermark template according to the page distribution parameters and the arrangement rule of the first watermark type, and adding the initial watermark template to each target page marked as the first page type.

[0035] In the present embodiment, the step further comprises the following initial watermark template generating step:

[0036] Step S101, obtain the input parameters of each selected watermark type, and query the watermark database according to the selected watermark type to obtain the preset parameters of the corresponding type.

[0037] Step 102, generate a plurality of different type watermark blocks according to the input parameters and preset parameters of each type of watermark respectively, and add different type watermark blocks to the same substrate with a transparent background to form a watermark template. According to the configuration information of all watermarks under the template, the configuration parameters of each watermark type are looped, including the first type watermark and the second type watermark; at least one first watermark block is generated according to the input parameters and preset parameters of the first type watermark, wherein the first watermark block is configured to generate a watermark picture containing input text according to the input parameters of the first type watermark; at least one second watermark block containing a barcode or a two-dimensional code picture is generated according to the input parameters of the second type watermark, wherein the second watermark block is configured to generate a watermark picture containing a barcode or a two-dimensional code according to the input parameters of the second type watermark. Respectively obtain the page distribution parameters and arrangement rule parameters in the first type watermark and the second type watermark, copy the first watermark block and the second watermark block according to the respective page distribution parameters, and then add and arrange them on the substrate according to the respective arrangement rule parameters, to form a watermark template.

[0038] Obtain the page distribution parameters and arrangement rule parameters of the second type watermark, and calculate the second area position of each second watermark block arranged on the substrate;

[0039] Obtain the page distribution parameters and arrangement rule parameters of the first type watermark, calculate the first initial area of each first watermark block arranged on the substrate, judge whether the first initial area and the second area overlap, if there is overlap, calculate the overlap coefficient of the corresponding first watermark block with overlap, if the overlap coefficient is lower than the preset value, do not adjust the position of the first initial area, otherwise move the first initial area to the direction of reducing overlap to separate from the overlap, the overlap coefficient is the proportion of the overlapping part of the first initial area and the second area in the area of the second area, if not overlapping, add the corresponding first watermark block and second watermark block to the first initial area and second area on the substrate.

[0040] Wherein, this overlap coefficient can be the ratio of the overlapping area to the corresponding second area, or the depth of the overlapping area into the second area, etc., which can be set according to the specific situation. If the overlap coefficient is lower than the preset value, the position of the first initial area is not adjusted, otherwise the first initial area is moved to the direction of reducing overlap to separate from the overlap, if not overlapping, the corresponding first watermark block and second watermark block are added to the first initial area and second area on the substrate.

[0041] In the embodiment, the first watermark block containing the first type of watermark and the second watermark block containing the second type of watermark can also be generated according to different watermark parameters. Then, the level parameters set by the first watermark type and the second watermark type are obtained, the second watermark type with a higher priority is arranged preferentially, and the second area on the watermark template where the second watermark block is arranged is calculated according to the page distribution parameter and the arrangement rule parameter of the second watermark type. The page distribution parameter and the arrangement rule parameter of the first watermark type with a lower priority are obtained, the first initial area on the watermark template where the first watermark block is arranged is calculated, if the first initial area overlaps the second area, part of the variable parameters in the first watermark type are adjusted to form a first watermark adjustment block, and the first watermark adjustment block and the second watermark block are added to the same watermark template formed by the substrate with a transparent background after the overlapping area of the first watermark adjustment block and the second watermark block meets the overlapping rule. The overlapping rule can be the ratio of the overlapping area to the corresponding second area as described in the foregoing embodiment, or the depth of the overlapping area into the second area, etc., which can be set according to specific conditions. By adding the level parameter to each watermark type, the priority of the adjustment of each watermark can be set in advance.

[0042] In the embodiment, the adjustable level can also be added to the parameters with adjustable attributes in each watermark type, so that the priority of the adjustment operation of each watermark can be set in advance. Specifically, the following steps can be included:

[0043] The page distribution parameter and the arrangement rule parameter of the first watermark type with a lower priority are obtained, at least one first watermark block is generated, and the position parameter of the corresponding first initial area arranged on the watermark template is calculated.

[0044] If the first initial area overlaps the second area, the first variable with an adjustable attribute in the first watermark type is obtained, and the first watermark block is adjusted according to the attribute of the first variable to form a first watermark adjustment block. If the first initial area overlaps the second area, multiple first variables with adjustable attributes in the first watermark type are obtained. The adjustable levels of the multiple first variables are compared, the parameter attribute of the first variable with the highest adjustable level is obtained, the first watermark block is adjusted according to the parameter attribute to form a first watermark adjustment block.

[0045] The overlapping area of the first watermark adjustment block and the second watermark block is obtained, and whether the overlapping area meets a preset overlapping rule is calculated. If yes, the first watermark adjustment block and the second watermark block are added to a watermark template formed in the same substrate with a transparent background. If not, the first watermark adjustment block is adjusted again until the overlapping area meets the preset overlapping rule. For example, the first variable is a watermark angle parameter, a watermark position parameter and a watermark size parameter. If the changeable level of the watermark angle parameter is the highest, the watermark angle parameter of the first watermark block is adjusted preferentially when the first initial area overlaps with the second area. Specifically, the parameter attribute of the watermark angle parameter is obtained. If the first watermark type is a text watermark, the minimum watermark area of the text watermark is obtained. The first watermark adjustment block is obtained by rotating the minimum watermark area by a preset angle once. The first watermark adjustment block includes the position information of the minimum watermark area.

[0046] In step S4, if the second area overlaps with the maximum text area or the overlapping area does not meet the set overlapping rule, part of the variable parameters in the second watermark type is adjusted to form a second watermark adjustment block. The second watermark block in the initial watermark template is replaced by the second watermark adjustment block to form a first watermark template corresponding to the first page type. The first watermark template is added to each target page marked as the first page type.

[0047] In step S4, if the second area overlaps with the maximum text area or the overlapping area does not meet the set overlapping rule, part of the variable parameters in the second watermark type is adjusted to form a second watermark adjustment block. The second watermark block in the initial watermark template is replaced by the second watermark adjustment block to form a first watermark template corresponding to the first page type. The first watermark template is added to each target page marked as the first page type.

[0048] As shown in the accompanying drawings, Figure 2 The step S4 further includes:

[0049] In step S41, if the second area overlaps with the maximum text area or the overlapping area does not meet the set overlapping rule, whether the number of rows in the watermark layout parameter in the second watermark type is greater than 2 is judged. If yes, the number of rows in the layout parameter is modified to 2.

[0050] In step S42, the watermark position parameter in the second watermark type is modified. Two second watermark adjustment blocks are formed by respectively moving the two second watermark blocks located above and below upward and downward so that the corresponding second areas do not overlap with the maximum text area or the overlapping area meets the set overlapping rule.

[0051] In step S43, the second watermark block in the initial watermark template is replaced by the second watermark adjustment block to form a first watermark template corresponding to the first page type. The first watermark template is added to each target page marked as the first page type.

[0052] Specifically, the region where the generated two-dimensional code watermark belonging to the second watermark type is located on the page body, which will cause the two-dimensional code pattern to overlap with the text, so that the text destroys the two-dimensional code pattern and may cause the recognition efficiency of the two-dimensional code to be reduced. Therefore, the position of the two-dimensional code watermark needs to be adjusted, which can be moved up or down to the header or footer area of the page, so as to avoid the interference of the text content on the two-dimensional code watermark.

[0053] In another embodiment, as shown in the accompanying drawings, Figure 3 The step S4 further comprises:

[0054] In step S401, if the second region overlaps with the maximum text region or the overlapping region does not meet the set overlapping rule, it is judged whether the number of rows in the layout parameter of the watermark in the second watermark type is greater than 2. If it is greater than 2, the number of rows of the layout parameter is modified to 2.

[0055] In step S402, the watermark position parameter in the second watermark type is modified, and the two second watermark blocks located above and below are respectively modified to move the corresponding second regions upward and downward to form two second watermark adjustment blocks. The second region corresponding to the second watermark adjustment block does not overlap with the maximum text region or the overlapping region meets the set overlapping rule.

[0056] In step S403, if there is still a first watermark block in the watermark template, the first region where the first watermark block is arranged on the initial watermark template is generated according to the page distribution parameter and the arrangement rule of the first watermark type. It is judged whether the first region overlaps with the second region corresponding to the second watermark adjustment block. If the first initial region overlaps with the second region, the part of the variable parameter in the first watermark type is adjusted to form the first watermark adjustment block, until the overlapping region of the first watermark adjustment block and the second watermark adjustment block meets the overlapping rule. The overlapping rule can be the ratio of the overlapping region to the corresponding second region, or the depth of the overlapping region into the second region, which can be set according to the specific situation.

[0057] In step S404, the second watermark block is replaced by the second watermark adjustment block, and the first watermark block is replaced by the first watermark adjustment block in the initial watermark template, to form the first watermark template corresponding to the first page type, and the first watermark template is added to each target page marked as the first page type. Specifically, the parameters of each first watermark block and second watermark block in the original watermark template are adjusted as described above, so as to be modified into each first watermark adjustment block and second watermark adjustment block, and finally the original watermark template becomes the first watermark template corresponding to the first page type.

[0058] In the embodiment, the document batch watermark adding method further comprises: step S5, adding a second watermark block in the initial watermark template to form a second watermark template corresponding to the second page type, and adding the second watermark template into each target page marked as the second page type.

[0059] The second page type can be a directory page, an index page, a content separation page, or other pages with less text content and larger blank areas. In these pages, the two-dimensional code or barcode watermark is less disturbed by text. In this case, we can ignore such interference and directly use the initial watermark template as the second watermark template corresponding to the second page type. The second watermark template is added to each target page marked as the second page type.

[0060] The above embodiment identifies each page in the target document to which the watermark is to be added in batches, divides the pages into multiple page types according to the positions of the text regions in the pages, and determines whether the text regions in the first page type, which is classified as a main text page, overlap with a second watermark block containing a barcode / two-dimensional code picture that is planned to be added. If there is an overlap, part of the variable parameters in the second watermark type is adjusted to form a second watermark adjustment block to replace the original second watermark block in the initial watermark template, so as to form a first watermark template corresponding to the first page type. Finally, the first watermark template is added to each target page marked as the first page type. Thus, the problem that the existing watermark software can only generate a two-dimensional code watermark according to the input preset parameters, which may result in the region where the generated two-dimensional code watermark is located being on the main text of the page, so that the two-dimensional code pattern overlaps with the main text, the main text destroys the two-dimensional code pattern, and thus the recognition rate of the two-dimensional code may be reduced, is solved. Therefore, by adjusting the position, size, or other parameters of the two-dimensional code watermark, the interference of the main text content on the two-dimensional code watermark is avoided.

[0061] In another embodiment, a document batch watermark adding system is also disclosed, comprising: a page identification module, configured to identify each page of a target document to which a watermark is to be added, and obtain a region in which text content in each page is located; a marking module, configured to mark each page of the target document as a plurality of page types according to a layout of the text content in each page, and identify a largest text region in a first page type as a text page; a watermark judgment module, configured to judge whether at least one second watermark block exists in an initial watermark template, and if so, calculate a second region on the initial watermark template in which the second watermark block is arranged according to a page distribution parameter and an arrangement rule parameter of a second watermark type; the second watermark block is configured to be a watermark picture containing a bar code or a two-dimensional code generated according to input parameters of the second watermark type; a first watermark adding module, configured to adjust part of variable parameters in the second watermark type to form a second watermark adjustment block when the second region and the largest text region overlap or the overlapping region does not meet a set overlapping rule, replace the second watermark block with the second watermark adjustment block in the initial watermark template to form a first watermark template corresponding to the first page type, and add the first watermark template to each target page marked as the first page type.

[0062] In the embodiment, the marking module is further configured to mark pages having a same largest text region in the target document as the first page type, and mark other pages as the second page type, the largest text region being a rectangular region.

[0063] In the embodiment, the document batch watermark adding system further comprises a second watermark adding module, configured to add the second watermark block in the initial watermark template to form a second watermark template corresponding to the second page type, and add the second watermark template to each target page marked as the second page type.

[0064] The specific functions of the above-mentioned document batch watermark adding system correspond to the document batch watermark adding method disclosed in the above embodiments one by one, and therefore will not be described in detail here, and the specific functions can be referred to the above-mentioned document batch watermark adding method. It should be noted that each embodiment in the present specification is described in a progressive manner, and each embodiment mainly describes the difference from other embodiments, and the same or similar parts between each embodiment can be referred to each other.

[0065] In some other embodiments, a document batch watermark adding apparatus is also provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements each step of the document batch watermark adding method described in the above embodiments when executing the computer program.

[0066] The document batch watermark adding device can include, but is not limited to, a processor, a memory. The server can include, but is not limited to, a processor, a memory. Those skilled in the art can understand that the schematic diagram is only an example of the server and does not constitute a limitation on the server device, and can include more or less components than the diagram, or combine certain components, or different components, for example, the server device can also include an input / output device, a network access device, a bus, etc.

[0067] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor and the like. The processor is the control center of the server device, and connects various parts of the server device through various interfaces and lines.

[0068] The memory can be used to store the computer programs and / or modules, and the processor realizes various functions of the server device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state memory devices.

[0069] If the document batch watermark adding method is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-mentioned embodiment methods can also be completed by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of each method embodiment when executed by a processor. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium can include any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0070] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

[0071] In summary, the above is only a preferred embodiment of the present application, and any equivalent changes and modifications made within the scope of the patent application of the present application shall be included in the scope of the present application.

Claims

1. A method for batch watermarking of documents, characterized by, The method comprises the following steps: S1, recognizing each page of a target document to be watermarked to obtain the area of the text content in each page; S2, marking each page of the target document as a plurality of page types according to the layout of the text content in each page, and identifying the largest text area in a first page type as a main text page; S3, determining whether at least one second watermark block exists in an initial watermark template, and if so, calculating a second area on the initial watermark template according to the page distribution parameters and layout rule parameters of the second watermark type; The second watermark block is configured to generate a watermark picture containing a barcode or a two-dimensional code according to the input parameters of the second type of watermark; S4, if the second area overlaps the largest text area or the overlapping area does not meet the set overlap rule, adjusting part of the variable parameters in the second watermark type to form a second watermark adjustment block, replacing the second watermark block with the second watermark adjustment block in the initial watermark template to form a first watermark template corresponding to the first page type, and adding the first watermark template to each target page marked as the first page type; The step S4 further comprises: If the second area overlaps the largest text area or the overlapping area does not meet the set overlap rule, determining whether the number of rows in the watermark layout parameter in the second watermark type is greater than 2, and if so, modifying the number of rows to 2; modifying the watermark position parameter in the second watermark type to form two second watermark adjustment blocks by moving the corresponding second areas of the two second watermark blocks located above and below upward and downward, respectively; the second areas corresponding to the second watermark adjustment blocks do not overlap the largest text area or the overlapping area meets the set overlap rule; replacing the second watermark block with the second watermark adjustment block in the initial watermark template to form a first watermark template corresponding to the first page type, and adding the first watermark template to each target page marked as the first page type; S5, adding the second watermark block in the initial watermark template to form a second watermark template corresponding to the second page type, and adding the second watermark template to each target page marked as the second page type.

2. The document batch watermark adding method of claim 1, wherein, The step S2 further comprises: marking the pages in the target document having the same largest text area as the first page type, and marking the other pages as the second page type, wherein the largest text area is a rectangular area.

3. The document batch watermark adding method according to claim 2, characterized in that, The step S3 further comprises: if only the first watermark block exists in the initial watermark template, generating the first area on the initial watermark template according to the page distribution parameters and layout rules of the first watermark type, and adding the initial watermark template to each target page marked as the first page type.

4. A document batch watermarking system, characterized by, The method comprises: A page recognition module for recognizing each page of a target document to be watermarked to obtain the area of the text content in each page; A marking module for marking each page of the target document as a plurality of page types according to the layout of the text content in each page, and identifying the largest text area in a first page type as a main text page; The watermark judging module is configured to judge whether at least one second watermark block exists in the initial watermark template, and if the second watermark block exists, calculate a second region on which the second watermark block is arranged on the initial watermark template according to the page distribution parameter and the arrangement rule parameter of the second watermark type; The second watermark block is configured to generate a watermark picture containing a bar code or a two-dimensional code according to input parameters of the second type of watermark; The first watermark adding module is configured to adjust part of variable parameters in the second watermark type to form a second watermark adjustment block when the second region overlaps with the maximum text region or the overlapping region does not meet the set overlapping rule, replace the second watermark block with the second watermark adjustment block in the initial watermark template to form a first watermark template corresponding to the first page type, and add the first watermark template to each target page marked as the first page type; judge whether the number of rows in the watermark layout parameter in the second watermark type is greater than 2, and if the number of rows is greater than 2, modify the number of rows of the layout parameter to 2; modify the watermark position parameter in the second watermark type, respectively modify two second watermark blocks located above and below to move the corresponding second regions upward and downward to form two second watermark adjustment blocks; the second region corresponding to the second watermark adjustment block does not overlap with the maximum text region or the overlapping region meets the set overlapping rule; replace the second watermark block with the second watermark adjustment block in the initial watermark template to form a first watermark template corresponding to the first page type, and add the first watermark template to each target page marked as the first page type; The second watermark adding module is configured to add the second watermark block in the initial watermark template to form a second watermark template corresponding to the second page type, and add the second watermark template to each target page marked as the second page type.

5. The document bulk watermark adding system of claim 4, wherein: The marking module is further configured to mark pages with the same maximum text region in the target document pages as the first page type, and mark other pages as the second page type, the maximum text region being a rectangular region.

6. A document batch watermark adding apparatus comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized by: The processor executes the computer program to implement the steps of the method of any one of claims 1-3.

7. A computer readable storage medium storing a computer program, characterized in that: The computer program is executed by the processor to implement the steps of the method of any one of claims 1-3.

Citation Information

Patent Citations

  • Watermark adding method and mobile terminal

    CN107464206A

  • Delay watermark adding technology based on document

    CN108537053A

  • Watermark adding method and device, watermark recognition method and device and electronic equipment

    CN110634095A

  • Webpage watermark adding method and device

    CN113672837A