CN116109465A - Text document processing method and device, storage medium and electronic equipment - Google Patents

Text document processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN116109465A
CN116109465A CN202211649071.5A CN202211649071A CN116109465A CN 116109465 A CN116109465 A CN 116109465A CN 202211649071 A CN202211649071 A CN 202211649071A CN 116109465 A CN116109465 A CN 116109465A
Authority
CN
China
Prior art keywords
document
watermark
target
color
text document
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
CN202211649071.5A
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.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp 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 China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN202211649071.5A priority Critical patent/CN116109465A/en
Publication of CN116109465A publication Critical patent/CN116109465A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database

Abstract

The application discloses a text document processing method and device, a storage medium and electronic equipment. Wherein the method comprises the following steps: acquiring a first text document in an image format; determining a document watermark to be added, wherein the document watermark information comprises the following steps: watermark content and watermark orientation; and adding a document watermark at a target position of each page of image file in the first text document to obtain a target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in a first target color range. The method and the device solve the technical problem that the document watermark generated by the related technology is easy to clear, so that the document security is low.

Description

Text document processing method and device, storage medium and electronic equipment
Technical Field
The application relates to the technical field of knowledge management, in particular to a text document processing method and device, a storage medium and electronic equipment.
Background
In the construction and operation process of the knowledge management platform, how to balance the protection degree of intellectual property and the convenience of knowledge acquisition becomes a difficult problem which is difficult to perfectly solve. If a method of grouping users and setting corresponding authorities is adopted, the method is suitable for small enterprises, but a large amount of workload is generated for large enterprises, and the convenience of knowledge acquisition is seriously affected; if the users are not grouped and corresponding permissions are set, enterprise knowledge may be revealed.
Therefore, related technicians typically use digital watermarking technology to mark documents on a knowledge management platform to prevent enterprise knowledge from disclosure, and store the documents in the form of scanned documents, the types of the documents can be divided into PDF (Portable Document Format ) and images, wherein for PDF documents, users can easily clear watermarks in the documents on corresponding software; for image documents, users can acquire RGB values of watermark images through images and modify the RGB values into background colors of the documents, so that watermark information is easily removed, and important files in enterprise knowledge are easily revealed.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the application provides a text document processing method and device, a storage medium and electronic equipment, which at least solve the technical problem that document watermarks generated by related technologies are easy to clear, so that the document security is low.
According to one aspect of the embodiments of the present application, there is provided a text document processing method, including: acquiring a first text document in an image format; determining a document watermark to be added, wherein the document watermark information comprises the following steps: watermark content and watermark orientation; and adding a document watermark at a target position of each page of image file in the first text document to obtain a target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in a first target color range.
Optionally, obtaining the first text document in the image format includes: acquiring a text document to be processed, and judging the document type of the text document to be processed, wherein the document type comprises: image format and PDF format; when the document type of the text document to be processed is PDF format, converting the text document to be processed into a first text document in image format; and when the document type of the text document to be processed is in the image format, determining that the text document to be processed is a first text document.
Optionally, determining the document watermark to be added includes: and setting watermark content and watermark direction of each page of image file in the first text document according to a preset watermark rule.
Optionally, adding a document watermark at a target location of each page of image file within the first text document, to obtain a target text document, including: for each page of image file in the first text document, scanning each pixel point at the target position in sequence, and determining the target color of the pixel point; when the target color is white, determining to adjust the target color of the pixel point to any color in a first target color range to obtain a document watermark, and adding the document watermark at a target position to obtain a target text document; and when the target color is black, maintaining the target color of the pixel point to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document.
Optionally, when the target color is white, determining to adjust the target color of the pixel point to any color in the first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document, including: when the RGB value of the pixel point is equal to the first numerical value, determining that the target color is white; adjusting the target color of each pixel point at the target position to be any color in a first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document; or sequentially setting the target color of each pixel point at the target position as the color in the first target color range to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
Optionally, when the target color is black, maintaining the target color of the pixel point to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document, including: when the RGB value of the pixel point is equal to the second value, determining that the target color is black; and maintaining the target color of the pixel point to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document.
Optionally, when the target color is black, adjusting the target color of each pixel point corresponding to the document information content at the target position to any color in a second target color range to obtain a target text document; or sequentially setting the target color of each pixel point corresponding to the document information content at the target position to be the color in the second target color range to obtain the target text document.
According to another aspect of the embodiments of the present application, there is also provided a text document processing apparatus, including: the acquisition module is used for acquiring a first text document in an image format; the determining module is used for determining the document watermark to be added, wherein the document watermark information comprises the following components: watermark content and watermark location; and the generating module is used for adding the document watermark at the target position of each page of image file in the first text document to obtain the target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in the first target color range.
According to another aspect of the embodiments of the present application, there is further provided a non-volatile storage medium, where the non-volatile storage medium includes a stored program, and a device where the non-volatile storage medium is located executes the above-mentioned text document processing method by running the program.
According to another aspect of the embodiments of the present application, there is also provided an electronic device including: the text document processing device comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the text document processing method through the computer program.
In the embodiment of the application, a first text document in an image format is acquired; determining a document watermark to be added, wherein the document watermark information comprises the following steps: watermark content and watermark orientation; and adding a document watermark at a target position of each page of image file in the first text document to obtain a target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in a first target color range. Therefore, the document watermark is set to be in gradual change color or irregular color, so that the document watermark is difficult to eliminate, and the technical problem that the document watermark generated by the related technology is easy to clear, and the document security is low is solved.
Drawings
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 and do not constitute an undue limitation to the application. In the drawings:
FIG. 1 is a schematic diagram of an alternative text watermark of the related art;
FIG. 2 is a flow chart of an alternative text document processing method according to an embodiment of the present application;
fig. 3 is a schematic structural view of an alternative text document processing apparatus according to an embodiment of the present application.
Detailed Description
In order to make the present application solution better understood by those skilled in the art, the following description will be made in detail and with reference to the accompanying drawings in the embodiments of the present application, it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and the accompanying drawings are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For a better understanding of the embodiments of the present application, some nouns or translations of terms that appear during the description of the embodiments of the present application are explained first as follows:
RGB values: RGB refers to the optical three primary colors, red (Red), green (Green) and Blue (Blue), respectively, and RGB values are specifically reflecting luminance (i.e., intensity values), which are generally expressed by integers of 0 to 255, wherein 255 corresponds to the maximum luminance and 0 corresponds to the minimum luminance, and thus R, G, B each has 256-level luminance.
Example 1
For documents with large business value or confidential documents in enterprises or organizations, such as business contracts, agreement documents, personnel qualification documents in organizations and the like, protection is needed to avoid malicious leakage of a knowledge management platform of the enterprises or organizations.
At present, a commonly adopted method is to mark a document through a data watermarking technology so as to distinguish a user of the document and a responsible person for illegal distribution, and the method is used for performing post-mortgage on the responsible person for illegal distribution. However, since such watermarked documents are typically stored in the form of scanned items, their file types are typically divided into two categories, PDF format and image format.
For the PDF format document, the watermark can be added in the PDF format document through a PDF Reader, such as an Acrobat Reader and a Fuxin Reader, but the user can also use the same software or the software with the same brand and a higher-order version to remove the document watermark in the PDF format document. Or a large number of text boxes are inserted into the PDF format document, watermark text information is input into the text boxes and stored, but the method only works for Acrobat Reader and Fuxin readers without editing rights, otherwise, related personnel with editing rights can easily remove the watermark through the PDF Reader software. Whereas for documents in image format, image editing software may be used to form the watermark image shown in fig. 1. However, since the watermark color and the background color of the document are distinguished in detail, a user can acquire the RGB value of the watermark image through the image file and modify the RGB value into the background color of the document, so that the watermark information is easily removed.
Thus, the document watermark generated by the related art is easy to clear, resulting in lower document security.
In order to solve the above-mentioned problems, the embodiments of the present application provide a text document processing method, which makes it difficult to eliminate a document watermark by setting the document watermark to a gradation color or an irregular color.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is illustrated in the flowcharts, in some cases the steps illustrated or described may be performed in an order other than that illustrated herein.
FIG. 2 is a flow chart of an alternative text document processing method according to an embodiment of the present application, as shown in FIG. 2, the method at least includes steps S202-S206, wherein:
step S202, a first text document in an image format is acquired.
In the technical solution provided in the above step S202 of the present invention, the first text document in the image format may be a scanned document of a text document such as a business contract, a corporate qualification, a protocol contract, etc., where the image format may be, but is not limited to, a JPG image or a PNG image, etc., and is not limited herein.
Step S204, determining a document watermark to be added, wherein the document watermark information comprises: watermark content and watermark location.
In the technical scheme provided in the step S204, the document watermark to be added is used for writing the attribution information or the information of the downloader for the document on the premise of ensuring that the reading of the document is not influenced, so as to play a role in protecting the document copyright and avoiding the leakage of the document caused by secondary forwarding.
In step S206, a document watermark is added at a target position of each page of image file in the first text document, so as to obtain a target text document, wherein the color of each pixel point corresponding to the document watermark is any color in the first target color range.
In the technical scheme provided in the step S206, the color of each pixel point corresponding to the watermark of the document can be any color within the first target color range, wherein the first target color needs to be distinguished from the background (i.e. white) of the document, so that the user is prevented from obtaining the RGB value of the watermark image from the image file and modifying the RGB value into the background color of the document, and the user can easily clear the watermark of the document.
In the embodiment of the application, a first text document in an image format is acquired; determining a document watermark to be added, wherein the document watermark information comprises the following steps: watermark content and watermark orientation; and adding a document watermark at a target position of each page of image file in the first text document to obtain the target text document, wherein the color of each pixel point corresponding to the document watermark is any color in a first target color range. Therefore, the document watermark is set to be in gradual change color or irregular color, so that the document watermark is difficult to eliminate, and the technical problem that the document watermark generated by the related technology is easy to clear, and the document security is low is solved.
The specific implementation steps of this embodiment are described in detail below.
As an optional implementation manner, in the technical solution provided in step S202 of the present invention, the method includes: acquiring a text document to be processed, and judging the document type of the text document to be processed, wherein the document type comprises: image format and PDF format; when the document type of the text document to be processed is PDF format, converting the text document to be processed into a first text document in image format; and when the document type of the text document to be processed is in the image format, determining that the text document to be processed is a first text document.
In this embodiment, after the document watermark is added to the text document, the document watermark is usually saved in a PDF format scanner or an image format scanner, so when the text document is processed, a software package such as PyMuPDF package of Python can be used to convert the PDF format text document into the image format text document first, so that the document watermark can be conveniently added to the image format text document later.
For example, when a user sends a download request for a first text document to the knowledge management platform of the enterprise, the knowledge management platform may identify text document information in the first text document and determine whether the first text document is in PDF format or image format, and if the first text document is in PDF format, use the PyMuPDF package of Python to convert each page of the first text document into an image file, thereby obtaining the first text document in image format.
As an optional implementation manner, in the technical solution provided in step S204 of the present invention, the method includes: determining a document watermark to be added, comprising: and setting watermark content and watermark direction of each page of image file in the first text document according to a preset watermark rule.
In this embodiment, the watermark rule may set the position and content of the watermark of the document in each page of the image file, and may set the watermark content as copyright attribution information or information of a downloader according to actual needs, for example, when a user needs to download the text document, in order to distinguish the user of the text document from a responsible person who illegally distributes the text document, the watermark content of the text document may be set as related attribute information such as a name of the downloader; when a text document to which an individual belongs needs to be uploaded to a public platform such as a webpage, in order to avoid being stolen by other people, watermark content equipment of the text document can be used as related attribute information such as the name of the attribution.
For example, when the user sends a download request for the text document one to the knowledge management platform of the enterprise, information that can uniquely identify the document downloadable may be obtained, where the information includes a name, an ID, a mobile phone number, a download time, and the like that can uniquely identify the document downloadable. The knowledge management platform may generate corresponding document watermarks with such information as: zhang three 001587 15313033316 2022-05-26 00:12:25 is used for marking a document download person so as to perform post-responsibility following the illicit distribution responsibility person when accidents such as document leakage occur.
As an optional implementation manner, in the technical solution provided in step S206 of the present invention, the method includes: for each page of image file in the first text document, scanning each pixel point at the target position in sequence, and determining the color of the pixel point; when the target color is white, determining to adjust the target color of the pixel point to any color in a first target color range to obtain a document watermark, and adding the document watermark at a target position to obtain a target text document; and when the target color is black, maintaining the target color of the pixel point to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document.
In the embodiment, in order to avoid that a user easily removes the document watermark processed at the target position, selecting to sequentially scan the colors of each pixel point, when the color of the pixel point is white, namely the RGB value is RGB (255, 255, 255), indicating that the pixel point corresponds to the document background, determining to adjust the target color of the pixel point to any color in the first target color range at this time to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document; when the color of the pixel point is black, namely the RGB value is RGB (0, 0), the pixel point is corresponding to the document content information, and at the moment, in order to avoid the document watermark covering the document content information and affecting the viewing of a user, the color of the document watermark is not changed, and the document watermark with the target color is continuously added at the position, so that the target text document is obtained.
As an optional implementation manner, in the technical solution provided in step S206 of the present invention, the method further includes: when the RGB value of the pixel point is equal to the first numerical value, determining that the target color is white; adjusting the target color of each pixel point at the target position to be any color in a first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document; or sequentially setting the target color of each pixel point at the target position as the color in the first target color range to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
In this embodiment, when the RGB values of the pixel points are equal to RGB (255, 255, 255), the target color is determined to be white, and the target color of each pixel point at the target position is randomly set to any color within the first target color range, or the target color of each pixel point at the target position is sequentially set to the color within the first target color range, so that the document watermark color is irregularly set and gradually set, so that the document watermark is no longer single, and the document watermark is prevented from being easily removed by others by setting the RGB values of the watermark to the RGB values of the document background color. The first target color range may be any color from RGB (90, 90, 90) to RGB (255, 255, 255).
For example, the color of the document watermark "confidential" in the image file shown in fig. 2 may be set to any one of the colors in the first target color range corresponding to RGB (90, 90, 90) to RGB (255, 255, 255), making it difficult for the watermarking software to distinguish the document information content from the document watermark information, or the color of the document watermark "confidential" in the image file may be set for each of the colors in the first target color range corresponding to RGB (90, 90, 90) to RGB (255, 255, 255) in a cyclic manner.
As an optional implementation manner, in the technical solution provided in step S206 of the present invention, the method further includes: when the RGB value of the pixel point is equal to the second value, determining that the target color is black; and maintaining the target color of the pixel point to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document.
In this embodiment, when the RGB value of the pixel is equal to RGB (0, 0), it is determined that the target color is black, and this indicates that the pixel is a pixel corresponding to the document information content, so as to avoid the watermark of different colors from blocking the document information content, and therefore, the target color of the pixel is continuously maintained, so as to obtain the document watermark.
Further, in order to prevent a user from distinguishing black background document content and document background color of the same color, when the target color is black, the embodiment of the application adjusts the target color of each pixel point corresponding to the document information content at the target position to any color in a second target color range to obtain a target text document; or sequentially setting the target color of each pixel point corresponding to the document information content at the target position to be the color in the second target color range to obtain the target text document.
For example, for the original document content information, the target color of each pixel point corresponding to the document information content at the target position may be adjusted to any gray color in the second target color range corresponding to RGB (10, 10, 10) to RGB (110, 110, 110), or the color of the document information content in the image file may be set for each color in the second target color range corresponding to RGB (10, 10, 10) to RGB (110, 110, 110) by recycling.
In the embodiment of the application, the irregular distribution or gradual distribution of the document watermark color is realized by setting the document watermark color added to the text document as any color within a first target color range or sequentially setting the document watermark color added to the text document as the color within the first target color range, so that the document background color and the document watermark color can be distinguished; in addition, the color of the document information content in the text document is set to be any color in the second target color range, or the color of the document information content in the text document is sequentially set to be the color in the second target color range, so that irregular distribution or gradual distribution of the document information content is realized, irregular distribution or gradual distribution of the document information content color is realized, the document background color and the document information content color can be distinguished, and the technical problem that the document watermark generated by the related technology is easy to clear, and the document security is low is solved.
Example 2
According to an embodiment of the present application, there is further provided a text document processing apparatus for implementing the above text document processing method, and fig. 3 is a schematic structural diagram of an alternative text document processing apparatus according to an embodiment of the present application, where the text document processing apparatus includes at least an obtaining module 31, a determining module 32 and a generating module 33, as shown in fig. 3, where:
an obtaining module 31 is configured to obtain a first text document in an image format.
As an alternative embodiment, the obtaining module 31 may obtain the first text document in the image format by: acquiring a text document to be processed, and judging the document type of the text document to be processed, wherein the document type comprises: image format and PDF format; when the document type of the text document to be processed is PDF format, converting the text document to be processed into a first text document in image format; and when the document type of the text document to be processed is in the image format, determining that the text document to be processed is a first text document.
After the document watermark is added, the text document is usually stored in a scanning piece in a PDF format or in an image format, so that when the text document is processed, a software package such as PyMuPDF package of Python can be used for converting the text document in the PDF format into the text document in the image format, and the document watermark can be conveniently added to the text document in the image format later.
For example, when a user sends a download request for a first text document to the knowledge management platform of the enterprise, the knowledge management platform may identify text document information in the first text document and determine whether the first text document is in PDF format or image format, and if the first text document is in PDF format, use the PyMuPDF package of Python to convert each page of the first text document into an image file, thereby obtaining the first text document in image format.
A determining module 32, configured to determine a document watermark to be added, where the document watermark information includes: watermark content and watermark location.
As an alternative embodiment, the determining module 32 may determine the document watermark to be added by: determining a document watermark to be added, comprising: and setting watermark content and watermark direction of each page of image file in the first text document according to a preset watermark rule.
The watermark rule can set the position and the content of the watermark of the document in each page of image file, and can set the watermark content as copyright attribution information or information of a downloader according to actual needs, for example, when a user needs to download the text document, in order to distinguish the user of the text document and the responsible person for illegal distribution of the text document, the watermark content of the text document can be set as related attribute information such as the name of the downloader; when a text document to which an individual belongs needs to be uploaded to a public platform such as a webpage, in order to avoid being stolen by other people, watermark content equipment of the text document can be used as related attribute information such as the name of the attribution.
For example, when the user sends a download request for the text document one to the knowledge management platform of the enterprise, information that can uniquely identify the document downloadable may be obtained, where the information includes a name, an ID, a mobile phone number, a download time, and the like that can uniquely identify the document downloadable. The knowledge management platform may generate corresponding document watermarks with such information as: zhang three 001587 15313033316 2022-05-26 00:12:25 is used for marking a document download person so as to perform post-responsibility following the illicit distribution responsibility person when accidents such as document leakage occur.
And the generating module 33 is configured to add a document watermark at a target position of each page of image file in the first text document, so as to obtain a target text document, where a target color of each pixel corresponding to the document watermark is any color in the first target color range.
As an alternative embodiment, the generating module 33 may obtain the target text document by: for each page of image file in the first text document, scanning each pixel point at the target position in sequence, and determining the color of the pixel point; when the target color is white, determining to adjust the target color of the pixel point to any color in a first target color range to obtain a document watermark, and adding the document watermark at a target position to obtain a target text document; and when the target color is black, maintaining the target color of the pixel point to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document.
In order to avoid that a user easily removes the document watermark processed at the target position, sequentially scanning the colors of all pixel points, when the colors of the pixel points are white, namely RGB values are RGB (255, 255, 255), indicating that the pixel points correspond to the document background, determining to adjust the target colors of the pixel points to any color in a first target color range at the moment to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document; when the color of the pixel point is black, namely the RGB value is RGB (0, 0), the pixel point is corresponding to the document content information, and at the moment, in order to avoid the document watermark covering the document content information and affecting the viewing of a user, the color of the document watermark is not changed, and the document watermark with the target color is continuously added at the position, so that the target text document is obtained.
Optionally, when the RGB value of the pixel point is equal to the first value, determining that the target color is white; adjusting the target color of each pixel point at the target position to be any color in a first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document; or sequentially setting the target color of each pixel point at the target position as the color in the first target color range to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
In this embodiment, when the RGB values of the pixel points are equal to RGB (255, 255, 255), the target color is determined to be white, and the target color of each pixel point at the target position is randomly set to any color within the first target color range, or the target color of each pixel point at the target position is sequentially set to the color within the first target color range, so that the document watermark color is irregularly set and gradually set, so that the document watermark is no longer single, and the document watermark is prevented from being easily removed by others by setting the RGB values of the watermark to the RGB values of the document background color. The first target color range may be any color from RGB (90, 90, 90) to RGB (255, 255, 255).
Optionally, when the RGB value of the pixel point is equal to the second value, determining that the target color is black; and maintaining the target color of the pixel point to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document.
In this embodiment, when the RGB value of the pixel is equal to RGB (0, 0), it is determined that the target color is black, and this indicates that the pixel is a pixel corresponding to the document information content, so as to avoid the watermark of different colors from blocking the document information content, and therefore, the target color of the pixel is continuously maintained, so as to obtain the document watermark.
Further, in order to prevent a user from distinguishing black background document content and document background color of the same color, when the target color is black, the embodiment of the application adjusts the target color of each pixel point corresponding to the document information content at the target position to any color in a second target color range to obtain a target text document; or sequentially setting the target color of each pixel point corresponding to the document information content at the target position to be the color in the second target color range to obtain the target text document.
For example, for the original document content information, the target color of each pixel point corresponding to the document information content at the target position may be adjusted to any gray color in the second target color range corresponding to RGB (10, 10, 10) to RGB (110, 110, 110), or the color of the document information content in the image file may be set for each color in the second target color range corresponding to RGB (10, 10, 10) to RGB (110, 110, 110) by recycling.
It should be noted that, each module in the text document processing device in the embodiment of the present application corresponds to each implementation step of the text document processing method in embodiment 1 one by one, and since the detailed description has been already made in embodiment 1, details that are not partially shown in this embodiment may refer to embodiment 1, and will not be repeated here.
Example 3
According to an embodiment of the present application, there is also provided a non-volatile storage medium including a stored program, where a device in which the non-volatile storage medium is located executes the text document processing method of embodiment 1 by running the program.
Specifically, the device where the nonvolatile storage medium is located executes the following steps by running the program: acquiring a first text document in an image format; determining a document watermark to be added, wherein the document watermark information comprises the following steps: watermark content and watermark orientation; and adding a document watermark at a target position of each page of image file in the first text document to obtain a target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in a first target color range.
Optionally, when the target color is white, determining to adjust the target color of the pixel point to any color in the first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document, including: when the RGB value of the pixel point is equal to the first numerical value, determining that the target color is white; adjusting the target color of each pixel point at the target position to be any color in a first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document; or sequentially setting the target color of each pixel point at the target position as the color in the first target color range to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
Optionally, when the target color is black, adjusting the target color of each pixel point corresponding to the document information content at the target position to any color in a second target color range to obtain a target text document; or sequentially setting the target color of each pixel point corresponding to the document information content at the target position to be the color in the second target color range to obtain the target text document.
According to an embodiment of the present application, there is also provided a processor for running a program, wherein the program executes the text document processing method in embodiment 1.
Specifically, the program execution realizes the following steps: acquiring a first text document in an image format; determining a document watermark to be added, wherein the document watermark information comprises the following steps: watermark content and watermark orientation; and adding a document watermark at a target position of each page of image file in the first text document to obtain a target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in a first target color range.
Optionally, when the target color is white, determining to adjust the target color of the pixel point to any color in the first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document, including: when the RGB value of the pixel point is equal to the first numerical value, determining that the target color is white; adjusting the target color of each pixel point at the target position to be any color in a first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document; or sequentially setting the target color of each pixel point at the target position as the color in the first target color range to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
Optionally, when the target color is black, adjusting the target color of each pixel point corresponding to the document information content at the target position to any color in a second target color range to obtain a target text document; or sequentially setting the target color of each pixel point corresponding to the document information content at the target position to be the color in the second target color range to obtain the target text document.
According to an embodiment of the present application, there is also provided an electronic device including: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the text document processing method in embodiment 1 by the computer program.
In particular, the processor is configured to implement the following steps by computer program execution: acquiring a first text document in an image format; determining a document watermark to be added, wherein the document watermark information comprises the following steps: watermark content and watermark orientation; and adding a document watermark at a target position of each page of image file in the first text document to obtain a target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in a first target color range.
Optionally, when the target color is white, determining to adjust the target color of the pixel point to any color in the first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document, including: when the RGB value of the pixel point is equal to the first numerical value, determining that the target color is white; adjusting the target color of each pixel point at the target position to be any color in a first target color range to obtain a document watermark, and adding the document watermark at the target position to obtain a target text document; or sequentially setting the target color of each pixel point at the target position as the color in the first target color range to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
Optionally, when the target color is black, adjusting the target color of each pixel point corresponding to the document information content at the target position to any color in a second target color range to obtain a target text document; or sequentially setting the target color of each pixel point corresponding to the document information content at the target position to be the color in the second target color range to obtain the target text document.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of units may be a logic function division, and there may be another division manner in actual implementation, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution, in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application and are intended to be comprehended within the scope of the present application.

Claims (10)

1. A text document processing method, comprising:
acquiring a first text document in an image format;
determining a document watermark to be added, wherein the document watermark information comprises the following steps: watermark content and watermark orientation;
and adding a document watermark at a target position of each page of image file in the first text document to obtain a target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in a first target color range.
2. The method of claim 1, wherein obtaining the first text document in the image format comprises:
acquiring a text document to be processed, and judging the document type of the text document to be processed, wherein the document type comprises: image format and PDF format;
when the document type of the text document to be processed is the PDF format, converting the text document to be processed into a first text document in the image format;
And when the document type of the text document to be processed is in an image format, determining that the text document to be processed is the first text document.
3. The method of claim 1, wherein determining the document watermark to be added comprises:
and setting the watermark content and the watermark direction of each page of image file in the first text document according to a preset watermark rule.
4. The method of claim 1, wherein adding a document watermark at a target location of each page of image files within the first text document results in a target text document, comprising:
for each page of image file in the first text document, scanning each pixel point at the target position in sequence, and determining the target color of the pixel point;
when the target color is white, determining to adjust the target color of the pixel point to any color in the first target color range, obtaining the document watermark, and adding the document watermark at the target position to obtain the target text document;
and when the target color is black, maintaining the target color of the pixel point to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
5. The method of claim 4, wherein determining to adjust the target color of the pixel to any color within the first target color range when the target color is white results in the document watermark, and adding the document watermark at the target location results in the target text document, comprises:
when the RGB value of the pixel point is equal to a first numerical value, determining that the target color is the white;
adjusting the target color of each pixel point at the target position to any color in the first target color range to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document;
or sequentially setting the target color of each pixel point at the target position to be the color in the first target color range to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
6. The method of claim 4, wherein maintaining the target color of the pixel when the target color is black, obtaining the document watermark, and adding the document watermark at the target location, obtaining the target text document, comprises:
When the RGB value of the pixel point is equal to a second numerical value, determining that the target color is the black color;
and maintaining the target color of the pixel point to obtain the document watermark, and adding the document watermark at the target position to obtain the target text document.
7. The method according to claim 4, characterized in that the method comprises:
when the target color is black, adjusting the target color of each pixel point corresponding to the document information content at the target position to any color in a second target color range to obtain the target text document;
or sequentially setting the target color of each pixel point corresponding to the document information content at the target position to be the color in the second target color range to obtain the target text document.
8. A text document processing apparatus, comprising:
the acquisition module is used for acquiring a first text document in an image format;
the determining module is used for determining the document watermark to be added, wherein the document watermark information comprises the following components: watermark content and watermark location;
and the generating module is used for adding a document watermark at the target position of each page of image file in the first text document to obtain a target text document, wherein the target color of each pixel point corresponding to the document watermark is any color in a first target color range.
9. A non-volatile storage medium, characterized in that the non-volatile storage medium comprises a stored program, wherein a device in which the non-volatile storage medium is located performs the text document processing method according to any one of claims 1 to 7 by running the program.
10. An electronic device, comprising: a memory and a processor, wherein the memory stores a computer program, the processor being configured to execute the text document processing method of any one of claims 1 to 7 by the computer program.
CN202211649071.5A 2022-12-21 2022-12-21 Text document processing method and device, storage medium and electronic equipment Pending CN116109465A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211649071.5A CN116109465A (en) 2022-12-21 2022-12-21 Text document processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211649071.5A CN116109465A (en) 2022-12-21 2022-12-21 Text document processing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN116109465A true CN116109465A (en) 2023-05-12

Family

ID=86264857

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211649071.5A Pending CN116109465A (en) 2022-12-21 2022-12-21 Text document processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN116109465A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116542838A (en) * 2023-07-03 2023-08-04 平安银行股份有限公司 Watermark security processing method, device, system and medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116542838A (en) * 2023-07-03 2023-08-04 平安银行股份有限公司 Watermark security processing method, device, system and medium
CN116542838B (en) * 2023-07-03 2024-03-29 平安银行股份有限公司 Watermark security processing method, device, system and medium

Similar Documents

Publication Publication Date Title
US7171021B2 (en) Data processing apparatus and method, and storage medium therefor
CA2504299C (en) System and method for decoding digital encoded images
Arnold et al. Techniques and applications of digital watermarking and content protection
Singh et al. A survey of digital watermarking techniques, applications and attacks
JP4004528B2 (en) Digital image processing method and system
US7187781B2 (en) Information processing device and method for processing picture data and digital watermark information
US20060028689A1 (en) Document management with embedded data
CN1791175B (en) Equipment and method for detecting and protecting a copy guarded document
KR20080029933A (en) Electronic watermark embedding apparatus and detecting apparatus
CN116109465A (en) Text document processing method and device, storage medium and electronic equipment
JP2000106627A (en) Data distributing method
Hadmi et al. A robust and secure perceptual hashing system based on a quantization step analysis
US20120218284A1 (en) Dynamic thresholds for document tamper detection
KR102180924B1 (en) System and Method for Embedding and Extracting Digital Watermark Using QR Code
GB2439009A (en) Document management system, document management program, document management system configuration method, and server computer
Beamsley Securing digital image assets in museums and libraries: A risk management approach
CN115841413A (en) Image processing method and device
RU2699234C1 (en) Method of safe use of an electronic document
Macit et al. Tamper detection and recovery on RGB images
JP2010206399A (en) Image processing apparatus, method and program
Korzhik et al. Digital Watermarking System for Hard Cover Objects Against Cloning Attacks
KR102515362B1 (en) Method of protecting secure document leak by shooting security document displaying on display apparatus and system performing the same
RU2739936C1 (en) Method of adding digital labels to digital image and apparatus for realizing method
WO2024040474A1 (en) Encrypted image watermark processing method and apparatus, and display device
Vasil et al. Digital Image Processing and Recognition in Industrial and Public Environments

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