A method for adding a digital blind watermark to a PDF file
Patent Information
- Application Number
- CN202311135646.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-05
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2043-09-05
AI Technical Summary
[0010]现有的技术方案虽已实现了PDF文件盲水印的添加,但其覆盖面仅限非透明像素,不能文字和图像两者兼顾,更没达到全文,甚至全页面覆盖的效果,同时文件需要特定的解码过程才能提取嵌入的水印信息,当PDF文件泄漏仅为一部分截图时,难以提取其中水印信息,无法溯源
1、本发明的盲水印能够全文覆盖、全页面覆盖,任意排版的PDF文件都能嵌入该数字盲水印。本发明水印采用图片平铺的方式嵌入PDF文件最上层,铺满整个PDF文件,包括页眉、页脚,肉眼无法分辨,隐蔽效果好。
Smart Images

Figure CN117151965B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information security technology, and in particular to a method for adding digital blind watermarks to PDF files. Background Technology
[0002] Digital watermarking is a method of embedding hidden information into digital media (such as images, audio, video, and text). This information can be used for purposes such as copyright protection and identity verification. Digital watermarks can be visible or invisible. Blind watermarking is the invisible part of digital watermarking; it embeds information identifiers into images in a way that is not visible to the naked eye, achieving document protection and tracking without damaging the original work.
[0003] PDF is a widely used file format for reliably presenting and exchanging electronic documents. Currently, a large number of documents, official documents, and materials are distributed in PDF format. To track file flow and verify file access behavior, digital watermarks are typically added to PDF files.
[0004] Existing technologies for blind watermarking of PDF files mainly focus on the following areas: 1. Text tweaking: Making minor adjustments to the text in a PDF file, such as fine-tuning character spacing, glyph details, or color values. These minor modifications have little impact on text readability but can embed information as a watermark.
[0005] 2. Image Fine-tuning: Similar to text fine-tuning, image fine-tuning involves adjusting the image within the PDF to embed watermark information. This method typically embeds the watermark in the details of the PDF image, having a limited impact on the image's visual appearance.
[0006] 3. Frequency Domain Embedding: This involves embedding watermark information into the frequency domain representation of the image in a PDF file, such as through Fourier transform. Typically, watermark data is embedded in the low-frequency region of the image to minimize its impact on image quality.
[0007] 4. Blur Effect Embedding: A slight blur effect is added to the image area to embed watermark information. This method usually has a minor impact on the visual effect.
[0008] 5. Embedding on specific pages: Embed watermarks on specific pages, image areas, or text paragraphs in PDF files, making them visually easy to ignore, thus ensuring the security and confidentiality of the watermark.
[0009] 6. Embed watermark information into the PDF file based on the statistical characteristics of the text or images. This method uses the statistical distribution of text characters, image pixels, etc., to represent the watermark.
[0010] While existing technical solutions have enabled the addition of blind watermarks to PDF files, their coverage is limited to non-transparent pixels, and they cannot cover both text and images, let alone achieve full text or even full page coverage. In addition, the file requires a specific decoding process to extract the embedded watermark information. When a PDF file is leaked and only a portion of the screenshot is available, it is difficult to extract the watermark information and trace the source. Summary of the Invention
[0011] To address the shortcomings of existing technologies, the purpose of this invention is to provide a method for adding digital blind watermarks to PDF files. The method generates blind watermarks using specific techniques and embeds them into PDF files without affecting visual presentation. The watermark covers the entire text and page. The detection and extraction processes are more efficient, eliminating the need for complex decoding steps. Watermark information can be extracted from only a partial screenshot of the file.
[0012] To achieve the above objectives, the technical solution adopted by the present invention is as follows: This invention discloses a method for adding a digital blind watermark to a PDF file, comprising the following steps: (1) Convert each page of the PDF file into a new image file; obtain the RGB values of the pixels in the image file, and combine the obtained RGB values of the pixels into an image set according to the pixel order; (2) Generate a watermark image with a transparent background of a specified size, and cut the image file generated in step (1) into several image blocks of the same size as the watermark image; (3) Set the traversal order that can traverse all image blocks; (4) Obtain the RGB values of each pixel of the currently traversed image block from the image collection in traversal order; (5) Obtain the RGB values of the pixels of the watermark image and compare the RGB values of the pixels of the current image block with the RGB values of the pixels of the watermark image at the corresponding position. (6) Determine whether the size of the image block is smaller than the watermark image. If the image block is smaller than the watermark image, cut the watermark image into image blocks of the same size and then execute step (7). If the image block is equal to the watermark image, execute step (7) directly. (7) Set a random similarity value for replacing the opaque pixels in the watermark image with the RGB values of the corresponding image block pixels; (8) After replacing all the pixels, a new watermark image is obtained. The RGB values of the pixels of the watermark image are stored as an element in the order of pixel arrangement and stored in the watermark set in the traversal order. If there is no watermark set, an empty set is created as the watermark set. (9) Update the watermark image in step (8) to the same watermark image as in step (2), and return to step (4) to traverse to the next image block until all image blocks have been traversed; (10) Lay the watermark set on top of the PDF file in traversal order.
[0013] Furthermore, the watermark image is a PNG format image.
[0014] Furthermore, the specified size refers to 100 pixels. 70.
[0015] Furthermore, the watermark image contains watermark information written in black text.
[0016] Furthermore, the method for determining the random similarity value is as follows: take the value of one random channel of R, G, or B ±5. If the selected channel value is ≤5, take the value +5; if the selected channel value is ≥250, take the value -5.
[0017] Furthermore, the traversal order is as follows: the top left vertex of the PDF file page is denoted as (0,0), the size of the PDF file page is defined as width and height, the width of the watermark image is x, and the height of the watermark image is y. The PDF file page is traversed line by line, starting from vertex (0,0), until the bottom of the PDF file page is reached.
[0018] Furthermore, the pixels are arranged in a row-major order, with each row of pixels arranged sequentially.
[0019] Furthermore, it also includes a method for extracting watermarks, which includes the following steps: obtaining a screenshot of the PDF file, placing the screenshot into any image processing tool, and using the tool to adjust the image saturation, brightness, and image curves to reveal the watermark.
[0020] Compared with the prior art, the beneficial effects of the present invention are: 1. The blind watermark of this invention can cover the entire text and page, and can be embedded in PDF files of any layout. The watermark of this invention is embedded in the top layer of the PDF file in a tiled image manner, covering the entire PDF file, including the header and footer, and is indistinguishable to the naked eye, with a good concealment effect.
[0021] 2. The watermark extraction method is simple. Since the watermark covers the entire document, extraction only requires a partial page screenshot. The watermark is a difference watermark based on the page display effect (RGB values) of the PDF file. Simply adjust the saturation, brightness, and image curves of the screenshot using an image editing tool to reveal the watermark. Extraction is simple and convenient. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart of the method according to an embodiment of the present invention.
[0024] Figure 2 These are the effect diagrams of adding a digital blind watermark to a PDF file and the effect diagram of extracting the watermark, according to an embodiment of the present invention. (A) is the effect diagram of adding a digital blind watermark to a PDF file; (B) is the effect diagram of extracting the watermark. Detailed Implementation
[0025] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0026] The following specific examples illustrate the embodiments disclosed in this invention. Those skilled in the art can easily understand other advantages and effects of this disclosure from the content disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. This invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this invention. It should be noted that, in the absence of conflict, the following embodiments and features in the embodiments can be combined with each other. All other embodiments obtained by those skilled in the art based on the embodiments in this disclosure without creative effort are within the scope of protection of this disclosure.
[0027] like Figure 1 As shown in this embodiment, a method for adding a digital blind watermark to a PDF file includes the following steps: (1) Convert each page of the PDF file into a new image file; obtain the RGB values of the pixels in the image file, and arrange them in pixel order to form an image set A. The watermark image is a PNG image.
[0028] (2) Generate a watermark image with a transparent background of a specified size. Cut the image file generated in step (1) into several image blocks of the same size as the watermark image; the specified size refers to 100 pixels. 70. The watermark information is written in black text on the watermark image.
[0029] (3) Set the traversal order that can traverse all image blocks; the traversal order is denoted as (0,0) with the top left vertex of the PDF file page as (0,0), and the size of the PDF file page is defined as width and height; the width of the watermark image is x, and the height of the watermark image is y. Assume that the PDF file page is traversed line by line in a row-major manner, starting from vertex (0,0) until the bottom of the PDF file page is reached. The traversal order is as follows: 0,0 x,0 2x,0 ... width-x,0 0,yx,y 2x,y ... width-x,y ... ... ... ... ... 0,height-y... ...width-x,height-y.
[0030] (4) Obtain the RGB values of each pixel of the currently traversed image block from the image set according to the traversal order; that is, extract set A from image set A. n , where n is the current iteration number.
[0031] (5) Obtain the RGB values of the pixels of the watermark image and compare the RGB values of the pixels of the current image block with the RGB values of the pixels of the watermark image at the corresponding position. (6) Determine whether the size of the image block is smaller than the watermark image. If the image block is smaller than the watermark image, cut the watermark image into image blocks of the same size and then execute step (7). If the image block is equal to the watermark image, execute step (7) directly. (7) Set a random similarity value for replacing the opaque pixels in the watermark image with the RGB values of the corresponding image block pixels; the method for taking the random similarity value is: take the value of one random channel of R, G, B ±5. If the channel value taken is ≤5, take the value +5. If the channel value taken is ≥250, take the value -5.
[0032] (8) After replacing all pixels, a new watermark image is obtained. The RGB values of the pixels in the watermark image are stored as elements in the watermark set B according to the pixel arrangement order. n , where n is the current iteration count. If there is no watermark set, a new empty set is created as the watermark set; the pixels are arranged in row-major order, with pixels in each row arranged sequentially.
[0033] (9) Update the watermark image from step (8) to be exactly the same as the watermark image from step (2), return to step (4) and traverse to the next image block until all image blocks have been traversed; finally obtain the watermark set B1, B2, ..., B k , where k is the number of image blocks.
[0034] (10) Set the watermark set B1, B2, ..., B k Tile the PDF file to the top layer in traversal order.
[0035] This invention includes a method for extracting watermarks, the method comprising the following steps: obtaining a screenshot of a PDF file; placing the screenshot into any image processing tool; and using the tool to adjust the image saturation, brightness, and image curves, such as... Figure 2 As shown, the watermark will then be displayed.
[0036] The above provides a detailed description of a method for adding digital blind watermarks to PDF files. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for adding a digital blind watermark to a PDF file, characterized in that, Includes the following steps: (1) Convert each page of the PDF file into a new image file; obtain the RGB values of the pixels in the image file, and combine the obtained RGB values of the pixels into an image set according to the pixel order; (2) Generate a watermark image with a transparent background of a specified size, and cut the image file generated in step (1) into several image blocks of the same size as the watermark image; (3) Set the traversal order that can traverse all image blocks; (4) Obtain the RGB values of each pixel of the currently traversed image block from the image collection in traversal order; (5) Obtain the RGB values of the pixels of the watermark image and compare the RGB values of the pixels of the current image block with the RGB values of the pixels of the watermark image at the corresponding position. (6) Determine whether the size of the image block is smaller than the watermark image. If the image block is smaller than the watermark image, cut the watermark image into image blocks of the same size and then execute step (7). If the image block is equal to the watermark image, execute step (7) directly. (7) Set a random similarity value for replacing the opaque pixels in the watermark image with the RGB values of the corresponding image block pixels; (8) After replacing all the pixels, a new watermark image is obtained. The RGB values of the pixels of the watermark image are stored as an element in the order of pixel arrangement and stored in the watermark set in the traversal order. If there is no watermark set, an empty set is created as the watermark set. (9) Update the watermark image in step (8) to the same watermark image as in step (2), and return to step (4) to traverse to the next image block until all image blocks have been traversed; (10) Lay the watermark set on top of the PDF file in traversal order.
2. The method for adding a digital blind watermark to a PDF file according to claim 1, characterized in that, The watermark image is a PNG format image.
3. The method for adding a digital blind watermark to a PDF file according to claim 1, characterized in that, The specified size refers to 100 pixels.
70.
4. The method for adding a digital blind watermark to a PDF file according to claim 1, characterized in that, The watermark image contains watermark information written in black text.
5. The method for adding a digital blind watermark to a PDF file according to claim 1, characterized in that, The method for determining the random similarity value is as follows: take the value of one random channel of R, G, or B ±5. If the selected channel value is ≤5, take the value +5; if the selected channel value is ≥250, take the value -5.
6. The method for adding a digital blind watermark to a PDF file according to claim 1, characterized in that, The traversal order is as follows: the top left vertex of the PDF file page is denoted as (0,0), the size of the PDF file page is width and height, the width of the watermark image is x and the height of the watermark image is y, and the PDF file page is traversed line by line starting from vertex (0,0) in a row-major manner until the bottom of the PDF file page is reached.
7. The method for adding a digital blind watermark to a PDF file according to claim 1, characterized in that, The pixels are arranged in a row-major order, with each row of pixels arranged sequentially.
8. A method for adding a digital blind watermark to a PDF file according to claim 1, characterized in that, It also includes a method for extracting watermarks, which includes the following steps: taking a screenshot of the PDF file, placing the screenshot in any image processing tool, and using the tool to adjust the image saturation, brightness, and image curves to reveal the watermark.
Citation Information
Patent Citations
Picture file tracking method
CN102622545A
Low-chromatic aberration watermark processing method and system for information leakage tracking
CN107316269A