CN114943065A - User-defined multi-watermark combination generation method, system and storage medium - Google Patents

User-defined multi-watermark combination generation method, system and storage medium Download PDF

Info

Publication number
CN114943065A
CN114943065A CN202210658685.3A CN202210658685A CN114943065A CN 114943065 A CN114943065 A CN 114943065A CN 202210658685 A CN202210658685 A CN 202210658685A CN 114943065 A CN114943065 A CN 114943065A
Authority
CN
China
Prior art keywords
watermark
type
parameters
template
block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210658685.3A
Other languages
Chinese (zh)
Inventor
陈新辉
许小娟
余欢
曾祖铃
何正良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Mingduzhi Cloud Computing Co Ltd
Mingdu Zhiyun Zhejiang Technology Co Ltd
Original Assignee
Shanghai Mingduzhi Cloud Computing Co Ltd
Mingdu Zhiyun Zhejiang Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Mingduzhi Cloud Computing Co Ltd, Mingdu Zhiyun Zhejiang Technology Co Ltd filed Critical Shanghai Mingduzhi Cloud Computing Co Ltd
Priority to CN202210658685.3A priority Critical patent/CN114943065A/en
Publication of CN114943065A publication Critical patent/CN114943065A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/16Program or content traceability, e.g. by watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2201/00General purpose image data processing
    • G06T2201/005Image watermarking
    • G06T2201/0062Embedding of the watermark in text images, e.g. watermarking text documents using letter skew, letter distance or row distance

Abstract

The invention discloses a user-defined multi-watermark combination generation method, a user-defined multi-watermark combination generation system and a storage medium, wherein the user-defined multi-watermark combination generation method comprises the steps of obtaining input parameters of all selected watermark types, and inquiring a watermark database according to the selected watermark types to obtain preset parameters of corresponding types; generating a plurality of different types of watermark blocks according to the input parameters and preset parameters of each type of watermark, and adding the different types of watermark blocks into the same substrate with the transparent background to form a watermark template; converting a document to be processed into a target document in a PDF format, circularly reading each page of the target document, adjusting the layout of different watermark blocks in a watermark template according to the content position of the page, and adding the watermark blocks to the corresponding page of the target document to generate a watermark document. The method solves the problems that the existing watermark setting is fixedly written in the code, and each watermark change or some complex watermarks need to be developed for the second time frequently, so that huge software service cost is brought to pharmaceutical enterprises.

Description

User-defined multi-watermark combination generation method, system and storage medium
Technical Field
The invention belongs to the technical field of informatization, and particularly relates to a method, a system and a storage medium for generating a custom multi-watermark combination.
Background
At present, a large amount of documents often exist in research and development organizations of pharmaceutical enterprises when preparing and organizing drug declaration data. Under different declaration states and different service scenes, different watermarks need to be added to the documents during operation in order to prevent illegal diffusion of the documents. Moreover, with the change of the regulations, the corresponding edition upgrading needs to be performed on the document, and at this time, new requirements and changes are also made on the watermark under the same service scene. In the current pharmaceutical management software industry, watermarks are usually fixed and written in codes, each watermark change or some complex watermarks need to be developed for the second time frequently, huge software service cost is brought to pharmaceutical enterprises, a software provider needs to face continuous development tasks of adding or modifying watermarks, and great inconvenience is brought to the pharmaceutical enterprises and the software provider.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a user-defined multi-watermark combination generation method, which comprises the following steps:
s1, acquiring input parameters of each selected watermark type, and inquiring a watermark database according to the selected watermark type to acquire preset parameters of the corresponding type;
s2, generating a plurality of watermark blocks of different types according to the input parameters and the preset parameters of each type of watermark, and adding the watermark blocks of different types to the same substrate with a transparent background to form a watermark template;
s3, converting the document to be processed into a target document in PDF format, reading each page of the target document circularly, adjusting the layout of different watermark blocks in the watermark template according to the page content position, and adding the watermark blocks to the corresponding page of the target document to generate a watermark document.
Preferably, the step S2 includes: acquiring configuration information of all watermarks under a template according to a configured watermark template, and circularly configuring parameters of each watermark type, wherein the watermark types comprise a first type watermark and a second type watermark; generating at least one first watermark block according to input parameters and preset parameters corresponding to the first type watermark; and generating at least one second watermark block containing the bar code or the two-dimensional code picture according to the input parameters of the second type of watermark.
Preferably, the step S2 further includes: respectively acquiring page distribution parameters and arrangement rule parameters in the first type watermark and the second type watermark, copying the first watermark block and the second watermark block by corresponding quantity according to the respective page distribution parameters, and then sequentially adding and arranging on the substrate according to the respective arrangement rule parameters to form the watermark template.
Preferably, the step S3 includes: the method comprises the steps of obtaining the page size of a target document, adjusting the size of a watermark template to a preset multiple of a target document page, and amplifying a first watermark block and a second watermark block in the watermark template by the same multiple in equal proportion.
Preferably, the step S2 further includes: acquiring page distribution parameters and layout rule parameters of the second type of watermarks, and calculating the second area position of each second watermark block on the substrate; acquiring page distribution parameters and layout rule parameters of a first type watermark, calculating a first initial area of each first watermark block arranged on a substrate, judging whether the first initial area and a second area are overlapped, if so, calculating the overlapping coefficient of the overlapped corresponding first watermark block, if the overlapping coefficient is lower than a preset value, not adjusting the position of the first initial area, otherwise, moving the first initial area to the direction of reducing the overlapping until the overlapping is separated, wherein the overlapping coefficient is the proportion of the overlapping part of the first initial area and the second area in the area of the second area, and if not, adding the corresponding first watermark block and the second watermark block in the first initial area and the second area on the substrate.
The invention also discloses a user-defined multi-watermark combination generation system, which comprises: the watermark template configuration module is used for acquiring input parameters of each selected watermark type and inquiring the watermark database according to the selected watermark type to acquire preset parameters of the corresponding type; the watermark template generating module is used for generating a plurality of watermark blocks of different types according to the input parameters and the preset parameters of the watermarks of the different types respectively and adding the watermark blocks of the different types to the same substrate with the transparent background to form a watermark template; and the watermark adding module is used for converting the document to be processed into a target document in a PDF format, circularly reading each page of the target document, adjusting the layout of different watermark blocks in the watermark template according to the content position of the page, and adding the watermark blocks to the corresponding page of the target document to generate a watermark document.
Preferably, the watermark template generating module includes: the configuration acquisition module is used for acquiring configuration information of all watermarks under a template according to a configured watermark template and circularly configuring parameters of each watermark type, wherein the watermark types comprise a first type watermark and a second type watermark; the first watermark generating module is used for generating at least one first watermark block according to the input parameters and the preset parameters corresponding to the first type watermark; and the second watermark generating module is used for generating at least one second watermark block containing the bar code or the two-dimensional code picture according to the input parameters of the second type of watermark.
Preferably, the watermark template generating module is further configured to obtain page distribution parameters and layout rule parameters in the first type of watermark and the second type of watermark, copy the first watermark blocks and the second watermark blocks by corresponding amounts according to the respective page distribution parameters, and add and arrange the first watermark blocks and the second watermark blocks on the substrate in sequence according to the respective layout rule parameters to form the watermark template.
The invention also discloses a device for generating the customized multi-watermark combination, which comprises a memory, a processor and a computer program which is stored in the memory and can run on the processor, wherein the processor executes the computer program to realize the steps of any one of the methods.
The invention also discloses a computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the steps of the method as set forth in any one of the above.
The invention discloses a user-defined multi-watermark combination generation method, a user-defined multi-watermark combination generation system and a storage medium, wherein input parameters of all selected watermark types are obtained, and preset parameters of corresponding types are obtained by inquiring a watermark database according to the selected watermark types; generating a plurality of different types of watermark blocks according to the input parameters and preset parameters of each type of watermark, and adding the different types of watermark blocks into the same substrate with the transparent background to form a watermark template; converting a document to be processed into a target document in a PDF format, circularly reading each page of the target document, adjusting the layout of different watermark blocks in a watermark template according to the content position of the page, and adding the watermark blocks to the corresponding page of the target document to generate a watermark document. The user-defined multi-watermark combination generation method is suitable for projects and products needing to add watermarks to documents, meets the complex watermark adding scene and watermark requirements of clients, does not need customized development, and can meet the adding requirements of various complex combined watermarks of the clients through configuration. The difficulty and the workload of adding the multi-type combined watermark to the document are reduced. The change of the watermark requirement is convenient for a client to change due to the change of the requirement or the change of the document, and the secondary development is not required to be carried out by contacting a developer. The method solves the problems that the existing watermark setting is fixedly written in the code, and each watermark change or some complex watermarks need to be developed for the second time frequently, so that huge software service cost is brought to pharmaceutical enterprises.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a schematic flowchart of a method for generating a customized multi-watermark combination according to an embodiment.
Fig. 2 is a schematic diagram of a watermark template information storage field according to an embodiment of the disclosure.
Fig. 3 is a schematic flowchart of step S2 according to an embodiment.
Fig. 4 is a schematic flowchart of step S3 according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the drawings of the embodiments of the present invention. It is to be understood that the embodiments described are only a few embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the invention without any inventive step, are within the scope of protection of the invention.
In the present invention, unless otherwise specifically defined and limited, technical or scientific terms used herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which the present invention belongs. The use of "first," "second," and similar terms in the description and in the claims of the present application does not denote any order, quantity, or importance, but rather the terms are used to distinguish one element from another. Also, the use of the terms "a" or "an" and the like do not denote a limitation of quantity, but rather denote the presence of at least one.
The user-defined multi-watermark combination generation method disclosed by the embodiment provides a method for adding different watermarks in different service scenes aiming at a large number of documents generated in the drug research and development and declaration processes. Different clients can create, modify, delete, configure, combine, preview and add the watermark to the document according to different service scenes and different requirements on the watermark. The problem that the product is frequently subjected to secondary development due to watermark change is solved, and the long-term investment cost of a medicine enterprise in the aspect of software is reduced. As shown in fig. 1, this embodiment discloses a method for generating a customized multi-watermark combination, which may specifically include the following steps:
and step S1, acquiring the input parameters of each selected watermark type, and querying a watermark database according to the selected watermark type to acquire the preset parameters of the corresponding type.
Wherein different watermark attributes can be defined according to the watermark type in specific setting. The watermark types may include a first watermark type, a second watermark type and a third watermark type, wherein the first watermark type may be a text watermark, the second watermark type may be a picture watermark, and the third watermark type may be a two-dimensional code/bar code watermark.
The attributes of the first watermark type, i.e., the literal watermark, may include, but are not limited to, the following. Watermark content: the watermark content can be manually input to fix the watermark content, and the constant label can be clicked to add a constant field. The add custom variable field may also be clicked on. Therefore, the text watermark content may be a combination of fixed content, constant and variable. Font size: the method is used for setting the font size of the watermark characters, and the unit is pixel px. Watermarking font: the watermark font is used to define a watermark text style, which may be defaulted to "song body", for example. And (3) character color: the watermark color mainly defines the watermark text color, and may for example default to black. The date format is as follows: the watermark format is mainly used for some watermarks which need to contain time information, but different watermarks have different requirements on the date format, so that the definition of the date format is provided.
The attributes of the second watermark type, i.e. the picture watermark, may include, but are not limited to, the following. Uploading a watermark picture: and by uploading the picture document, the watermark picture to be added by the watermark of the picture type is customized. Height of the picture: and calculating the scaling of the uploaded picture according to the actual height of the uploaded picture and the set picture height.
The third watermark type, namely the attributes of the two-dimensional code/bar code watermark are similar to those of the image watermark, but are not fixed images, and when the watermark is used, the images are dynamically generated according to the information defined by the user.
Other common configuration attributes for each watermark may also be included, which may include, for example, but are not limited to, the following parametric content. Number of watermark arrangement: and if the tiling mode is set to 1-1, the tiling mode does not exist. If 2-3 is set, 3 rows and 2 columns are shown tiled, and 2 × 3-6 identical watermarks are displayed on a page. Watermark position: the watermark location may define a watermark start location, provided the choice is: upper left corner of document page, upper right corner of document page, lower left corner of document page, lower right corner of document page, center of document page. A lateral offset distance x, and a longitudinal offset distance y may also be defined. If the initial position of the watermark is the upper left corner of the document page or the center of the document page, xy refers to offset towards the lower right; if the initial position of the watermark is the upper right corner of the document page, xy refers to offset towards the lower left; if the initial position of the watermark is the lower left corner of the document page, xy refers to the offset towards the upper right corner; if the initial position of the watermark is the lower right corner of the document page, xy refers to the offset towards the upper left corner; the gas x, y, supporting negative numbers, is offset in opposite directions to that described above. Rotation angle: the rotation angle refers to the inclination of the watermark and supports 0-360 degrees of rotation, and the rotation is clockwise according to the central position of the watermark. Transparency: the transparency is set to support the coverage degree of the watermark on the document content in different scenes. If the watermark is loaded on the watermarked content, a transparency less than 100/100 may be set as desired to prevent overwriting the document content. If the watermark is added to the blank of the document, the transparency can be set to 100/100, and the watermark is added in an opaque manner.
In the specific operation, by filling in the template variables, after the watermark template to be used is determined, the self-defined parameters, namely the variables, configured in the template are obtained. And generating an input box according to the self-defined parameters, filling out related variables by a user, and transmitting the variables to the next module to generate the watermark picture.
Step S2, generating a plurality of watermark blocks of different types according to the input parameters and the preset parameters of each type of watermark, and adding the watermark blocks of different types to the same substrate with the transparent background to form a watermark template. The watermark block refers to a file element containing corresponding watermark content, the file element can be a png picture with a transparent background containing corresponding watermark content such as characters, pictures or two-dimensional codes, and can also be a file with other formats, and the file element can be added into a substrate to form a watermark template.
The stored watermark template is mainly used for storing the configured watermark template information, and any relational or non-relational database such as MySQL, SqlServer, Oracle, MongoDB, Elasticisarch and the like can be selected for carrying out the persistence of table structured data. The storage contains fields such as the template information field of fig. 2.
In this embodiment, as shown in fig. 3, the step S2 may further include:
step S21, obtaining the configuration information of all watermarks under the template according to the configured watermark template, and circularly following each watermark type configuration parameter, wherein the watermark types comprise a first type watermark and a second type watermark.
Step S22, generating at least one first watermark block according to the input parameters and preset parameters corresponding to the first type watermark, where the first watermark block is configured to be a watermark picture containing input text generated according to the input parameters of the first type watermark.
In step S23, at least one second watermark block including a barcode or a two-dimensional code picture is generated according to the input parameters of the second type of watermark, where the second watermark block is configured as a watermark picture including a barcode or a two-dimensional code generated according to the input parameters of the second type of watermark.
The step S2 further includes: and step S24, respectively acquiring page distribution parameters and layout rule parameters in the first type watermark and the second type watermark, copying corresponding quantity of the first watermark block and the second watermark block according to the respective page distribution parameters, and then sequentially adding and arranging the first watermark block and the second watermark block on the substrate according to the respective layout rule parameters to form the watermark template.
In a preferred embodiment, the step S2 further includes:
step S101, acquiring page distribution parameters and layout rule parameters of the second type of watermark, and calculating the position of a second area where each second watermark block is arranged on the substrate.
Step S102, obtaining page distribution parameters and layout rule parameters of the first type watermark, calculating a first initial area of each first watermark block arranged on the substrate, judging whether the first initial area and the second area are overlapped, if so, calculating a superposition coefficient of the overlapped corresponding first watermark block, if the superposition coefficient is lower than a preset value, not adjusting the position of the first initial area, otherwise, moving the first initial area to the direction of reducing the superposition until the first initial area is separated from the superposition, wherein the superposition coefficient is the proportion of the superposition part of the first initial area and the second area in the area of the second area, and if not, adding the corresponding first watermark block and the second watermark block in the first initial area and the second area on the substrate.
Specifically, the arrangement position, the arrangement number and the arrangement rule of the two-dimensional code watermark on the substrate are calculated according to the page distribution parameter and the arrangement rule parameter of the second type watermark, for example, the page distribution parameter may be 1 × 2 layout, that is, two-dimensional codes are arranged per page, and the arrangement rule parameter may be that the two-dimensional code watermarks are arranged only in the page and the footer area, or that the whole page includes the text. And finally confirming the second area positions of the two generated second watermark blocks on the substrate according to the size parameter and the position parameter of the second type watermark.
And then acquiring a first initial area position occupied by a first watermark block generated by the first type watermark on the substrate according to the same way. And then judging whether the first initial area and the second area are overlapped, wherein if the two-dimensional code in the two-dimensional code watermark is overlapped with the characters in the character watermark, the character watermark possibly covers a part of a two-dimensional code graph, so that the two-dimensional code watermark is difficult to identify, and therefore, when the combined watermark is generated, whether the two-dimensional code watermark is overlapped with other watermarks needs to be judged in advance. In this embodiment, whether the first watermark block needs to be adjusted may also be determined by determining a coincidence coefficient of a coincidence area of the first initial area and the second area. The coincidence coefficient may be a ratio of the coincidence area to the corresponding second area, or a depth of the coincidence area into the second area, and may be set according to specific conditions. If the coincidence 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 coincidence until the first initial area is out of coincidence, and if the coincidence coefficient is not in coincidence, corresponding first watermark blocks and second watermark blocks are added to the first initial area and the second area on the substrate.
In other preferred embodiments, the step S2 can also include the following.
Step S201, respectively generating a first watermark block including a first type watermark and a second watermark block including a second type watermark according to different watermark parameters.
Step S202, obtaining the grade parameters set by the first watermark type and the second watermark type, performing priority arrangement on the second watermark type with higher priority, and calculating a second area of the second watermark block arranged on the watermark template according to the page distribution parameters and the arrangement rule parameters of the second watermark type.
Step S203, obtaining a page distribution parameter and an arrangement rule parameter of a first watermark type with a lower priority, calculating a first initial area of a first watermark block arranged on the watermark template, if the first initial area coincides with a second area, adjusting a part of variable parameters in the first watermark type to form a first watermark adjusting block, and adding the first watermark adjusting block and the second watermark block to the watermark template formed in the same substrate with a transparent background after the overlapping area of the first watermark adjusting block and the second watermark block conforms to an overlapping rule. The overlapping rule may be a ratio of the overlapping area to the corresponding second area as described in the foregoing embodiment, or a depth of the overlapping area entering the second area, which may be set according to specific situations.
In the embodiment, a grade parameter is added to each watermark type, and the adjustment priority of each watermark can be set in advance. For example, the watermark template of this time has a first watermark type and a second watermark type, and if the priority of the first watermark type is lower and the priority of the second watermark type is higher, when the watermark regions of the first watermark type and the second watermark type overlap and need to be adjusted, the watermark with higher priority can be kept still, the watermark block with lower priority is adjusted first, if there are a plurality of different types of watermarks, the watermark block with highest priority is kept still, and other watermark blocks are sequentially adjusted from low to high according to the priority. The hierarchical adjustment of the combined watermark is realized by setting the priority of each watermark type, and each type of watermark can be adjusted more reasonably according to the importance degree of each watermark type to avoid mutual influence.
In this embodiment, step S203 may further include:
step S2031, obtaining the page distribution parameters and layout rule parameters of the first watermark type with lower priority, generating at least one first watermark block, and calculating the location parameters of the first initial area correspondingly disposed on the watermark template.
Step S2032, if the first initial area and the second area are overlapped, acquiring a first variable with an adjustable attribute in the first watermark type, and correspondingly adjusting the first watermark block according to the attribute of the first variable to form a first watermark adjustment block.
If the first initial area and the second area are overlapped, a plurality of first variables with adjustable properties in the first watermark type are obtained. And comparing the changeable grades in the plurality of first variables, acquiring the parameter attribute of the first variable with the highest changeable grade, and performing corresponding changing operation on the first watermark block according to the parameter attribute to form a first watermark adjusting block.
For example, the first variable is a watermark angle parameter, a watermark position parameter and a watermark size parameter, and if the changeable level of the watermark angle parameter is the highest, the watermark angle parameter of the first watermark block is preferentially adjusted when the first initial area and the second area are overlapped. Specifically, the parameter attribute of the watermark angle parameter is acquired, if the first watermark type is a character watermark, the minimum watermark area of the character watermark is acquired, and a first watermark adjusting block is acquired after the minimum watermark area is rotated by a preset angle, wherein the first watermark adjusting block comprises the position information of the minimum watermark area.
Step S2033, acquiring a superposition area of the first watermark adjusting block and the second watermark block, calculating whether the superposition area meets a preset superposition rule, if so, adding the first watermark adjusting block and the second watermark block to a watermark template formed in the same substrate with a transparent background, and if not, returning to the previous step to adjust the first watermark adjusting block again until the superposition area meets the preset superposition rule.
In this embodiment, a changeable level is added to a parameter having an adjustable attribute in each watermark type, and the priority of the adjustment operation for each watermark can be set in advance. For example, the first watermark type in the current watermark template needs to be adjusted, the variable with the highest changeable level can be obtained for modification and adjustment, and then when the variable with the highest changeable level cannot meet the requirement of overlapping two watermark blocks after being adjusted, the variable with the second highest changeable level is modified and adjusted. The changeable grade is set for each adjustable variable in the watermark type, so that different sequential adjustment actions of a certain watermark type in the combined watermark are realized, and the watermark adjustment actions can be set more reasonably in a self-defined manner to combine the watermarks for adjustment so as to avoid mutual influence.
In a specific embodiment, the generating of the watermark picture is to generate the watermark picture according to attribute information configured by each watermark under the configuration of the watermark template. And the system acquires the configuration information of all watermarks under the template according to the selected/configured template and circularly tracks the configuration information of each watermark. If the watermark is a character watermark or a two-dimension code/bar code watermark, the system can analyze the watermark content and user input variables, global variables and fixed contents to generate final watermark content. The two-dimension code/bar code can be drawn according to the watermark content to generate a bar code/two-dimension code picture, and the bar code/two-dimension code watermark type is changed into a picture watermark type. Then generating a watermark picture according to watermark configuration, which mainly comprises the following steps:
a transparent watermark template background is drawn with a java. According to the definition (for example, the definition is n), the length and the width of the template background need to be n times of the document page to be watermarked, and the larger the value of n, the larger the background pixels, and the higher the definition of the final generated watermark template image. When all watermarks under the template are generated, the length and the width of a picture, the size of characters, the offset distance and the like are also amplified by n times. And then slicing the background of the template according to the tiling configuration. E.g. 2 x 3, i.e. 2 watermarks are tiled per row and 3 watermarks are tiled per column, then 6 tiles are needed. The width of each slice is half of the width of the template background, and the height of each slice is one third of the height of the template background. The upper left corner position coordinates of each sheet are then recorded, as well as the width and height of each sheet.
In case of text watermarking, the system needs to create a java.aawt.font object according to the font style, font color, and font size configured by the watermark, where the font size needs to be enlarged according to the definition, and the enlargement ratio of the font is, if the definition n × 3/4. And then creating and generating a java. Then, a java.aawt.dimension object is created according to the java.aawt.fontmetrics and the watermark content, and then the height and width of the character watermark are obtained according to the java.aawt.dimension object. Where java.aawt.font is used to define font information such as font size, font type, font lines. java, at, graphics2d is used to define a painting brush, which can define the painting range, i.e. the length and width of the background picture of the watermark, whether the background picture is transparent, the color of the painting brush, and other information. Font measurement attribute of java, at, fontmetrics, the font measurement information can be obtained by specifying the brush attribute and the font attribute and calculating.
Dimension information of java, a wt, dimension can define the font content, and the length and width of the specified font content can be obtained by combining the font measurement attribute.
If the image watermark is the image watermark, the system firstly obtains the image object and amplifies the length and the width of the image by n times according to the definition n. And if the height of the watermark of the picture is configured, scaling according to the proportion of the actual height of the picture to the configured height, and then acquiring the height and the width of the watermark picture.
And then circularly dividing the slices according to the position coordinates of the upper left corner of each slice. And generating an upper left corner coordinate object java. It should be noted here that the starting position of the offset is different, and the direction of the offset is also different. And then acquiring the coordinates of the upper left corner of the watermark on each fragment according to java. And circulating the coordinates of the upper left corner of each watermark, judging whether a rotation angle rotate is configured, rotating the rotation angle rotate by the coordinates of the center of each watermark, and then drawing the watermark picture or the watermark character on the background. It should be noted here that when the watermark of the next segment is drawn, the center of the above segment of watermark is taken as the center of the circle to reversely rotate, and then the center of the current segment of watermark is rotated. The upper left corner of each slice is a watermark tiling slice, and then the central position of the watermark is positioned according to the upper left corner coordinate of each slice, the offset position and the length and width of the watermark, and the watermark rotates by taking the central position of the watermark as the center of a circle. And finally combining the watermarks to generate a template watermark picture, namely, circulating the steps, and placing all the watermark pictures under the template on the same watermark template background to finally generate a watermark template picture.
Step S3, converting the document to be processed into a target document in PDF format, reading each page of the target document circularly, adjusting the layout of different watermark blocks in the watermark template according to the content position of the page, and adding the watermark blocks to the corresponding page of the target document to generate a watermark document.
As shown in fig. 4, the step S3 includes: the method comprises the steps of obtaining the page size of a target document, adjusting the size of a watermark template to a preset multiple of a target document page, and amplifying a first watermark block and a second watermark block in the watermark template by the same multiple in equal proportion.
In this embodiment, the step further includes:
step S31, identifying each page of the target document to be added with the watermark, and acquiring the region of the text content in each page; and marking the target document page as a plurality of page types respectively according to the layout of the text content in each page, and identifying the maximum text area in the first page type as the text page. Wherein the maximum text area is a rectangular area where the text is located.
Meanwhile, pages with the same maximum text area in the target document page can be marked as a first page type, other pages can be marked as a second page type, and the maximum text area is a rectangular area. In a document, pages with the largest text area are often text pages, so the text pages are marked as a first page type, and other pages are marked as a second page type, wherein the second page type can be other pages such as a directory page, an index page, a content partition page and the like.
Step S32, judging whether at least one second watermark block exists in the initial watermark template, if so, calculating a second area of the second watermark block 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 the input parameters of the second type watermark. If the initial watermark template only has the first watermark block, generating a first area of the first watermark block arranged on the initial watermark template according to the page distribution parameters and the arrangement rules of the first watermark type, and adding the initial watermark template to each target page marked as the first page type.
Step S33, if the second region and the maximum text region overlap or the overlap region does not conform to 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. And 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 to each target page marked as the second page type.
In this embodiment, the step S33 may further include the following steps: if the second area and the maximum character area have coincidence or the coincidence area does not accord with the set coincidence rule, judging whether the line number in the watermark layout parameter in the second watermark type is more than 2, if so, modifying the line number of the layout parameter to be 2. And modifying the watermark position parameters in the second watermark type, and respectively modifying the two second watermark blocks positioned at the upper part and the lower part to enable the corresponding second areas to move upwards and downwards to form two second watermark adjusting blocks. And the second area corresponding to the second watermark adjusting block does not coincide with the maximum character area or the coinciding area accords with a set coinciding rule. And replacing the second watermark block with a second watermark adjusting 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. Specifically, the area where the generated two-dimensional code watermark belonging to the second watermark type is located on the page text, which may cause the two-dimensional code partial pattern to coincide with the text, so that the text may damage the two-dimensional code pattern, thereby possibly causing the reduction of the two-dimensional code identification efficiency. Therefore, the position of the two-dimensional code watermark needs to be adjusted, and the position of the two-dimensional code watermark can be moved upwards or downwards to a header or footer area of a page, so that the interference of text content on the two-dimensional code watermark is avoided.
In the embodiment, the watermark template is selected/configured, so that the watermark templates used at different positions can be configured and bound according to different service requirements, and the corresponding watermark template is taken out for use according to the configuration binding information when in use; some watermark templates can be more flexibly brought out with authority, and the watermark template to be used is selected by self. Each different position refers to different functional points in the system, and the bound watermark template is obtained according to a certain rule (binding information configuration) of the service system, which is a flexible application mode of a use scene. The document file to be processed is converted into pdf, in some embodiments, word conversion pdf can also be realized by jaclob, and the template watermark is added to pdf through itextpdf, so as to finally generate a new document.
Specifically, for example, a watermark is required, a text watermark is added to the upper left corner of a file, 2 x 2 picture watermarks are tiled on the content of the file, and a two-dimensional code watermark is added to the lower right corner of the file. The system is equivalent to a watermark template and is provided with three watermarks, the type of the first watermark is a character, the defined position is at the upper left corner, and the system firstly prints the character on the upper left corner of the transparent template through character configuration information. The second watermark is a picture watermark, and because the second watermark needs to be tiled, the picture is firstly sliced and positioned, then the picture is based on the transparent template on which the character watermark is drawn, and then 4 picture watermarks are repeatedly drawn at 2 x 2 positions. The third watermark is a two-dimension code watermark, the configured two-dimension code content is firstly analyzed, then a two-dimension code picture is generated, and then the two-dimension code picture watermark is drawn based on the transparent template on which the character watermark and the picture watermark are drawn. The final watermark template is a watermark picture integrating characters, pictures and two-dimensional codes, and then the additional watermark is zoomed according to the pdf page length and width information.
The embodiment is a method for adding the customized watermark to the documents of types such as word, excel, ppt, txt, image and the like in batch. Then, the watermarks are combined to generate a watermark template, the position information, the content information, the display style and the like of each watermark forming the template can be defined by users, and the watermark template previewing function is provided. When the watermark template is used, according to the variable defined by each watermark in the template, manually inputting the variable data of the template, automatically adding constant data in a background, and analyzing the constant data and the fixed content together to generate the final content. And generating each character watermark or two-dimension code/bar code watermark according to the content, processing each watermark in the template according to parameters such as position tiling rules of each watermark and the like, and writing the processed watermark into the same PNG picture with transparent background to generate a template watermark picture. Then the document to be watermarked is converted into pdf, and a new document is generated by adding a watermark template picture to each page of the pdf in a loop reading mode and returning. The method is suitable for projects and products needing to add the watermarks to the documents, and can meet the requirements of clients on complicated watermark adding scenes and watermarks without customized development and the adding requirements of various complicated combined watermarks of the clients through configuration. The difficulty and the workload of adding the multi-type combined watermark to the document are reduced. The change of the watermark requirement is convenient for a client to change due to the change of the requirement or the change of the document, and the secondary development is not required to be carried out by contacting a developer. The method solves the problems that the existing watermark setting is all fixedly written in the code, each watermark change or some complex watermarks need to be developed for the second time frequently, and huge software service cost is brought to pharmaceutical enterprises.
In another embodiment, a system for generating a customized multi-watermark combination is also disclosed, comprising: the watermark template configuration module is used for acquiring input parameters of each selected watermark type and inquiring the watermark database according to the selected watermark type to acquire preset parameters of the corresponding type; the watermark template generating module is used for generating a plurality of watermark blocks of different types according to the input parameters and the preset parameters of the watermarks of the different types respectively and adding the watermark blocks of the different types to the same substrate with the transparent background to form a watermark template; and the watermark adding module is used for converting the document to be processed into a target document in a PDF format, circularly reading each page of the target document, adjusting the layout of different watermark blocks in the watermark template according to the content position of the page, and adding the watermark blocks to the corresponding page of the target document to generate a watermark document.
In this embodiment, the watermark template generating module includes: the configuration acquisition module is used for acquiring configuration information of all watermarks under a template according to a configured watermark template and circularly configuring parameters of each watermark type, wherein the watermark types comprise a first type watermark and a second type watermark; the first watermark generating module is used for generating at least one first watermark block according to the input parameters and the preset parameters corresponding to the first type watermark; and the second watermark generating module is used for generating at least one second watermark block containing the bar code or the two-dimensional code picture according to the input parameters of the second type of watermark.
In this embodiment, the watermark template generating module is further configured to obtain page distribution parameters and layout rule parameters in the first type of watermark and the second type of watermark, copy the first watermark block and the second watermark block by corresponding numbers according to the respective page distribution parameters, and add and arrange the first watermark block and the second watermark block on the substrate in sequence according to the respective layout rule parameters to form the watermark template.
The specific functions of the above-mentioned system for generating a customized multi-watermark combination correspond to the method for generating a customized multi-watermark combination disclosed in the foregoing embodiments one to one, so that detailed descriptions are not repeated here, and reference may be made to the embodiments of the method for generating a customized multi-watermark combination disclosed in the foregoing embodiments. It should be noted that, in the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
In other embodiments, there is also provided a custom multi-watermark combination generating apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps of the custom multi-watermark combination generating method described in the above embodiments.
The customized multi-watermark combination generation device can include, but is not limited to, a processor and a memory. The server may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that the schematic diagram is merely an example of a server and is not intended to limit the server device, and that it may include more or less components than those shown, or some components may be combined, or different components, for example, the server device may also include input output devices, network access devices, buses, etc.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is the control center of the server device and connects the various parts of the overall server device using various interfaces and lines.
The memory may be used to store the computer programs and/or modules, and the processor may implement the various functions of the server device by running or executing the computer programs and/or modules stored in the memory, as well as by invoking data stored in the memory. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function, and the like, and the memory may include a high speed random access memory, and may further 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 memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
The self-defined multi-watermark combination generation method can be stored in a computer readable storage medium if the self-defined multi-watermark combination generation method is realized in the form of a software functional unit and is sold or used as an independent product. Based on such understanding, all or part of the flow of the method according to the embodiments of the present invention may also be implemented by a computer program, which may be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer-readable medium may contain suitable additions or subtractions depending on the requirements of legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer-readable media may not include electrical carrier signals or telecommunication signals in accordance with legislation and patent practice.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
In summary, the above-mentioned embodiments are only preferred embodiments of the present invention, and all equivalent changes and modifications made in the claims of the present invention should be covered by the claims of the present invention.

Claims (10)

1. A self-defined multi-watermark combination generation method is characterized by comprising the following steps:
s1, acquiring input parameters of each selected watermark type, and inquiring a watermark database according to the selected watermark type to acquire preset parameters of the corresponding type;
s2, generating a plurality of different types of watermark blocks according to the input parameters and preset parameters of each type of watermark, and adding the different types of watermark blocks into the same substrate with the transparent background to form a watermark template;
s3, converting the document to be processed into a target document in PDF format, circularly reading each page of the target document, adjusting the layout of different watermark blocks in the watermark template according to the content position of the page, and adding the watermark blocks to the corresponding page of the target document to generate the watermark document.
2. The method for generating customized multi-watermark combination according to claim 1, wherein the step S2 includes:
acquiring configuration information of all watermarks under a template according to a configured watermark template, and circularly configuring parameters of each watermark type, wherein the watermark types comprise a first type watermark and a second type watermark;
generating at least one first watermark block according to input parameters corresponding to the first type watermark and preset parameters, wherein the first watermark block is configured to be a watermark picture which is generated according to the input parameters of the first type watermark and contains input characters;
and generating at least one second watermark block containing the bar code or the two-dimensional code picture according to the input parameters of the second type of watermark, wherein the second watermark block is configured to be the watermark picture containing the bar code or the two-dimensional code generated according to the input parameters of the second type of watermark.
3. The method for generating customized multi-watermark combination according to claim 2, wherein the step S2 further includes:
respectively acquiring page distribution parameters and arrangement rule parameters in the first type watermark and the second type watermark, copying the first watermark block and the second watermark block by corresponding quantity according to the respective page distribution parameters, and then sequentially adding and arranging on the substrate according to the respective arrangement rule parameters to form the watermark template.
4. The method for generating a customized multi-watermark combination according to claim 3, wherein the step S3 includes: the method comprises the steps of obtaining the page size of a target document, adjusting the size of a watermark template to a preset multiple of the page of the target document, and simultaneously amplifying a first watermark block and a second watermark block in the watermark template by the same multiple in equal proportion.
5. The method for generating a customized multi-watermark combination according to claim 3 or 4, wherein the step S2 further comprises:
acquiring page distribution parameters and layout rule parameters of the second type of watermarks, and calculating the second area position of each second watermark block on the substrate;
the method comprises the steps of obtaining page distribution parameters and layout rule parameters of a first type watermark, calculating a first initial area of each first watermark block arranged on a substrate, judging whether the first initial area and a second area are overlapped, calculating a superposition coefficient of the overlapped corresponding first watermark block if the first initial area and the second area are overlapped, not adjusting the position of the first initial area if the superposition coefficient is lower than a preset value, or moving the first initial area to the direction of reducing the superposition until the first initial area is separated from the superposition, wherein the superposition coefficient is the proportion of the overlapped part of the first initial area and the second area in the area of the second area, and adding the corresponding first watermark block and the second watermark block in the first initial area and the second area on the substrate if the first initial area and the second area are not overlapped.
6. A customized multi-watermark combination generation system is characterized by comprising:
the watermark template configuration module is used for acquiring input parameters of each selected watermark type and inquiring the watermark database according to the selected watermark type to acquire preset parameters of the corresponding type;
the watermark template generating module is used for generating a plurality of watermark blocks of different types according to the input parameters and the preset parameters of the watermarks of the different types respectively and adding the watermark blocks of the different types to the same substrate with the transparent background to form a watermark template;
and the watermark adding module is used for converting the document to be processed into a target document in a PDF format, circularly reading each page of the target document, adjusting the layout of different watermark blocks in the watermark template according to the content position of the page, and adding the watermark blocks to the corresponding page of the target document to generate a watermark document.
7. The custom multi-watermark combination generation system of claim 6, wherein the watermark template generation module comprises:
the configuration acquisition module is used for acquiring configuration information of all watermarks under a template according to a configured watermark template and circularly configuring parameters of each watermark type, wherein the watermark types comprise a first type watermark and a second type watermark;
the first watermark generating module is used for generating at least one first watermark block according to input parameters corresponding to the first type of watermark and preset parameters, wherein the first watermark block is configured to be a watermark picture which is generated according to the input parameters of the first type of watermark and contains input characters;
and the second watermark generating module is used for generating at least one second watermark block containing a bar code or a two-dimensional code picture according to the input parameters of the second type of watermark, wherein the second watermark block is configured to be a watermark picture containing the bar code or the two-dimensional code generated according to the input parameters of the second type of watermark.
8. The system of claim 7, wherein the watermark template generation module is further configured to obtain page distribution parameters and layout rule parameters in the first type of watermark and the second type of watermark, respectively, copy the first watermark block and the second watermark block by a corresponding number according to the respective page distribution parameters, and then add and arrange the first watermark block and the second watermark block on the substrate in sequence according to the respective layout rule parameters to form the watermark template.
9. A custom multi-watermark combination generating device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: the processor when executing the computer program realizes the steps of the method according to any of claims 1-5.
10. A computer-readable storage medium storing a computer program, characterized in that: the computer program when executed by a processor implementing the steps of the method as claimed in any one of claims 1 to 5.
CN202210658685.3A 2022-06-12 2022-06-12 User-defined multi-watermark combination generation method, system and storage medium Pending CN114943065A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210658685.3A CN114943065A (en) 2022-06-12 2022-06-12 User-defined multi-watermark combination generation method, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210658685.3A CN114943065A (en) 2022-06-12 2022-06-12 User-defined multi-watermark combination generation method, system and storage medium

Publications (1)

Publication Number Publication Date
CN114943065A true CN114943065A (en) 2022-08-26

Family

ID=82908879

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210658685.3A Pending CN114943065A (en) 2022-06-12 2022-06-12 User-defined multi-watermark combination generation method, system and storage medium

Country Status (1)

Country Link
CN (1) CN114943065A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116127916A (en) * 2022-11-18 2023-05-16 百望股份有限公司 Method and device for dynamically adding watermark

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116127916A (en) * 2022-11-18 2023-05-16 百望股份有限公司 Method and device for dynamically adding watermark

Similar Documents

Publication Publication Date Title
AU2018247213B2 (en) Robust and efficient method for generating high-quality triangle mesh representation for geometry bounded by bezier splines
CN108052491B (en) Automatic processing method and device for certificate document
US20070136660A1 (en) Creation of semantic objects for providing logical structure to markup language representations of documents
US20050057566A1 (en) Rich graphic visualization generation from abstract data representation
US8009316B2 (en) Methods and apparatus for efficient sheetside bitmap processing using meta-data information
GB2406674A (en) Specifying scanned image document layout definition
CN113609820B (en) Method, device and equipment for generating word file based on extensible markup language file
JP2007049388A (en) Image processing apparatus and control method thereof, and program
CN111553131A (en) PSD file analysis method, device, equipment and readable storage medium
CN114943065A (en) User-defined multi-watermark combination generation method, system and storage medium
CN112686015A (en) Chart generation method, device, equipment and storage medium
AU2021201489B2 (en) System and Process for generating an internet application
CN116776850A (en) Document processing method, device, computer equipment and storage medium
CN111768822A (en) Continuous printing method, device, equipment and storage medium for electronic medical record documents
CN115935917A (en) Data processing method, device and equipment for visual chart and storage medium
KR101984058B1 (en) Template application system and method using the file format svg
CN115147858A (en) Method, device, equipment and medium for generating image data of handwritten form
CN111079399B (en) Image-text data processing method, image-text data processing device, computer equipment and storage medium
CN114943066A (en) Watermark template management method, device and storage medium
CN107273961A (en) A kind of method that color 2 D code is automatically generated according to template
KR20220014326A (en) GIS point data rendering method, apparatus, computer device and storage medium
Cvrčková From data to illustrations: common (free) tools for proper image data handling and processing
CN111222517A (en) Test sample generation method, system, computer device and storage medium
KR20210060808A (en) Document editing device to check whether the font applied to the document is a supported font and operating method thereof
CN113448522B (en) Variable data printing output method and device, terminal equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination