Automatic PDF (Portable Document Format) document desensitization system and method, electronic equipment and computer program product
Through multimodal content analysis and data desensitization modules, the problems of low PDF document desensitization efficiency and high misrecognition rate in existing technologies are solved, and efficient and accurate sensitive information processing is achieved to ensure the logical integrity of the document.
Patent Information
- Application Number
- CN202511171536.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-10-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies have problems in PDF document desensitization processing, such as low efficiency, high misrecognition rate, and lack of dynamic control capabilities. Especially when processing PDF documents containing images and tables, manual processing is difficult and automated tools have poor processing effects.
It adopts a multimodal content parsing engine module and a multimodal data desensitization module, uses an image recognition model to identify different levels of content in PDF documents, and combines the multimodal data desensitization module to perform dynamic processing according to desensitization rules, including precise desensitization of text layer, image layer and table layer. It uses optical character recognition, image semantic analysis and table structure extraction modules to dynamically adjust the desensitization strategy and perform confidence scoring.
It achieves efficient and accurate PDF document desensitization, reduces the error rate of misidentification, improves the efficiency of sensitive information desensitization, and ensures the logical integrity and usability of the desensitized documents.
Smart Images

Figure CN120744981A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of document desensitization, and in particular relates to a PDF document automatic desensitization system, method, electronic equipment and computer program product. Background Art
[0002] In the era of information explosion, data security has become a top priority. Desensitizing PDF documents containing sensitive information is a key step in ensuring data security. Currently, the commonly used desensitizing technologies on the market are mainly divided into the following three types: The first method relies on manual processing to identify and desensitize sensitive information within documents. However, processing large numbers of PDF documents requires significant manpower and time. Manual processing is also prone to oversights and errors, resulting in incomplete desensitization or the accidental deletion of important information. The difficulty of manual processing is exponentially increased when dealing with PDF documents containing numerous images and tables, requiring even more time and effort to identify and process sensitive information.
[0003] The second method involves using commonly used automatic desensitization tools (such as the Adobe Acrobat plug-in). While automatic desensitization tools can desensitize text at the text level, they cannot effectively process tables in scanned documents, requiring manual selection of sensitive areas, which significantly reduces processing efficiency. Tests show that processing a 20-page document takes an average of 45 minutes, which is too time-consuming for processing large volumes of documents.
[0004] The third approach uses an open-source solution combining Apache PDFBox (an open-source PDF tool) with Tesseract (an OCR (Optical Character Recognition) engine) to identify and desensitize content within PDF documents. However, data shows that the table recognition error rate is as high as 32%, which means that when processing PDF documents containing a large number of tables, a large number of misidentifications may occur, resulting in poor desensitization results. Furthermore, this solution lacks dynamic range control capabilities and cannot be flexibly adjusted to different document content and sensitive information types, significantly affecting the accuracy and reliability of the desensitization process.
[0005] Therefore, existing PDF document desensitization solutions all have their own technical characteristics and drawbacks. Manual processing is inefficient and error-prone; the Adobe Acrobat plug-in has limited image and table processing capabilities; and the open-source solution using Apache PDFBox combined with Tesseract has a high recognition error rate and lacks dynamic control capabilities. These issues severely impact the effectiveness and efficiency of PDF document desensitization. Summary of the Invention
[0006] In view of the shortcomings of the above-mentioned prior art, the purpose of the present invention is to provide a PDF document automatic desensitization system, method, electronic device and computer program product that realizes automatic desensitization processing of the target text to be desensitized, reduces the error rate of desensitization misrecognition and the probability of incomplete desensitization, and improves the efficiency of desensitizing sensitive information.
[0007] To achieve the above-mentioned and other related purposes, in a first aspect, an embodiment of the present application provides a PDF document automatic desensitization system, comprising: A data acquisition module is used to obtain the desensitization rules corresponding to the PDF document to be desensitized and at least one target desensitization object; A rule and document parsing module, connected to the data acquisition module, is used to parse the PDF document to be desensitized and identify the type of the target desensitization object based on an image recognition model; A multimodal content parsing engine module, connected to the rule and document parsing module, is used to parse the specific content of the target desensitized object in the PDF document according to the type of the identified target desensitized object; A multimodal data desensitization module, connected to the multimodal content parsing engine module and the data acquisition module, respectively, for performing desensitization processing according to the parsed specific content and the desensitization rules corresponding to the target desensitization object; The PDF reconstruction module is connected to the multimodal data desensitization module and is used to reconstruct the desensitized content into a desensitized target PDF document.
[0008] In one embodiment, the multimodal data desensitization module is further configured to perform in-situ replacement or overwriting of the original text layer according to the parsed start coordinates, end coordinates, and page of the specific content when the type of the target desensitization object is text layer content; When the type of the target desensitized object is image layer content, a mask layer matching the size of the original image is generated based on the parsed bounding box coordinates of the image area where the target desensitized object is located; the mask layer includes pixel blocks or blurred areas for masking sensitive areas; the desensitization processing includes superimposing the mask layer on the corresponding coordinate position of the original image layer.
[0009] In one embodiment, the multimodal data desensitization module is configured with a rule mapping engine, which is used to match the corresponding desensitization rules according to the sensitive field type of the target desensitized object, and execute the atomic operation process bound to the desensitization rules, wherein the atomic operation process includes when the desensitization rule is a mask, retaining some characters at preset positions and replacing the remaining characters with specified symbols; when the desensitization rule is hash encryption, using a specified encryption algorithm to process the original data.
[0010] In one embodiment, the multimodal data desensitization module is also used to perform a confidence score on the specific content output by the multimodal content parsing engine module; wherein, when the confidence score is higher than a first threshold, the standard desensitization method specified by the desensitization rule is applied; when the confidence score is lower than the first threshold but higher than a second threshold, it is marked as pending review; when the confidence score is lower than the second threshold, the original content is retained and a log is recorded, wherein the first threshold and the second threshold are both pre-set specified thresholds.
[0011] In one embodiment, the rule and document parsing module further includes: Image preprocessing module, used to perform structure separation and image processing on PDF documents to be desensitized; A coordinate correction engine module, connected to the image preprocessing module, for correcting the coordinate position of the target desensitization object in the PDF document page according to the result output by the image preprocessing module; And a type identification module, connected to the coordinate correction engine module, is used to identify the type of the target desensitization object based on the image recognition model using the corrected coordinate position output by the coordinate correction engine module.
[0012] In one embodiment, the multimodal content parsing engine module includes: Optical character recognition module, used to extract the text content and coordinate position of the target desensitized object; Image semantic parsing module, used to identify graphic elements and sensitive areas in the target desensitization object; And the table structure extraction module is used to reconstruct the table data model and cell coordinates in the target desensitized object.
[0013] In one embodiment, the multimodal content parsing engine module includes a multimodal alignment module, which is used to establish position coordinates by extracting the multimodal position information of the target desensitized object, and convert the coordinate information of different modalities into a unified page coordinate system of the PDF document to be desensitized.
[0014] In a second aspect of the embodiments of the present application, a method for automatically desensitizing a PDF document is provided, comprising: Obtain the desensitization rules corresponding to the PDF document to be desensitized and at least one target desensitization object; Parse the PDF document to be desensitized and identify the type of the target desensitization object based on an image recognition model; According to the type of the identified target desensitization object, the specific content of the target desensitization object in the PDF document is parsed; Perform desensitization processing according to the parsed specific content and the desensitization rules corresponding to the target desensitization object; Reconstruct the desensitized content into a desensitized target PDF document.
[0015] In a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store a computer program executable by the processor; and the processor is used to execute the computer program in the memory to implement the functions of the above-mentioned system.
[0016] In a fourth aspect of the embodiments of the present application, a computer program product is provided, including a computer program, which implements the functions of the above-mentioned system when executed by a processor.
[0017] As described above, the present application provides a system, method, electronic device and computer program product for automatic desensitization of PDF documents. The present application uses a multimodal content parsing engine module and a multimodal data desensitization module to parse the specific content of the target desensitized object in the PDF document according to the type of the identified target desensitized object, and then performs desensitization processing according to the parsed specific content and the desensitization rules corresponding to the target desensitized object, so that the desensitization rate can reach 97%, reducing the error rate of desensitization misidentification and the probability of incomplete desensitization, and improving the efficiency of desensitization of sensitive information. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 Shown is a structural block diagram of a PDF document automatic desensitization system provided as an exemplary embodiment.
[0019] Figure 2 Shown is a structural block diagram of a rule and document parsing module provided by an exemplary embodiment.
[0020] Figure 3 Shown is a flowchart of a method for automatic desensitization of PDF documents provided by an exemplary embodiment.
[0021] Figure 4 It shows a schematic diagram of the structure of an electronic device.
[0022] Description Figure Numbers: 1. Data acquisition module; 2. Rule and document parsing module; 3. Multimodal content parsing engine module; 4. Multimodal data desensitization module; 5. PDF reconstruction module; 21. Image preprocessing module; 22. Coordinate correction engine module; 23. Type recognition module; 10. Electronic device; 11. Processor; 12. Memory. DETAILED DESCRIPTION
[0023] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.
[0024] It should be noted that the illustrations provided in the following embodiments are merely schematic illustrations of the basic concept of the present invention. Therefore, the illustrations only show components related to the present invention and are not drawn according to the number, shape, and size of components in actual implementation. In actual implementation, the type, quantity, and proportion of each component may be changed arbitrarily, and the component layout may also be more complex.
[0025] In addition to the technical problems existing in the above background technology, the present invention also has the following problems: In digital office and information processing, documents may contain sensitive information in various forms, including text, images, and tables (e.g., ID numbers, financial data, and seals). Existing technologies often employ unified strategies (such as global blurring or uniform masking) to process sensitive information, failing to fully consider the characteristics of different content modalities. This results in poor processing performance. For example, sensitive textual information must remain readable for subsequent analysis, while image-based seal information must be completely masked to prevent identification. Differences in handwriting can reduce recognition accuracy, making it difficult for existing technologies to dynamically adapt processing parameters.
[0026] In order to solve the technical problems existing in the prior art, this application provides a PDF document automatic desensitization system, such as Figure 1 As shown, it includes: a data acquisition module 1, a rule and document parsing module 2, a multimodal content parsing engine module 3, a multimodal data desensitization module 4 and a PDF reconstruction module 5.
[0027] The data acquisition module 1 is used to obtain the desensitization rules corresponding to the PDF document to be desensitized and at least one target desensitization object.
[0028] The desensitization rules are stored in a predefined rule library or configured by the user in real time. They include sensitive data type identifiers, regular expression rules, coding styles, encryption / watermarking options, etc. The target desensitization objects include, but are not limited to, one or more of: name, ID number, phone number, bank card number, address, email address, facial image, seal image, specific keywords, and specific organization name.
[0029] Optionally, the PDF document to be desensitized is a judicial-related text, wherein the target desensitization object may be identity card information, age, gender, address, name, and case facts (such as case facts involving privacy in criminal cases).
[0030] The rule and document parsing module 2 is connected to the data acquisition module 1 and is used to parse the PDF document to be desensitized and identify the type of the target desensitization object based on an image recognition model.
[0031] The image recognition model may be YOLO, Faster R-CNN, or Layout-parser.
[0032] Specifically, by parsing the PDF file structure, we can accurately identify and separate the different layers within the PDF file, categorizing the content into the text layer containing text information, the image layer containing image content, and the table content. Using the PDF parsing library (PyMuPDF), we can directly extract text paragraphs, images, and table data (preserving the original layout coordinates).
[0033] More specifically, users upload PDF files and desensitization rule configurations (including regular rules, coding styles, encryption / watermark options, etc.) to classify the content. Native content (non-image): Directly extract text paragraphs and table data (retain the original layout coordinates) through a PDF parsing library (such as PyMuPDF), extract all images embedded in the PDF (JPG / PNG and other formats), and enter [Image Content Analysis]. Use image processing algorithms (Canny detects edge features and HoughLines algorithm detects straight lines) to quickly determine whether the image contains a table structure. If it contains a table image, Alibaba Cloud TableOCR service is called first to identify the table row and column structure and extract cell text and coordinates. If there is no table, PaddleOCR service is called first to extract all text and corresponding coordinates in the image (retaining the position information of the text in the image).
[0034] In one embodiment, Figure 2 As shown, the rule and document parsing module 2 also includes: an image preprocessing module 21, which is used to perform structural separation and image processing on the PDF document to be desensitized; a coordinate correction engine module 22, which is connected to the image preprocessing module 21, and is used to correct the coordinate position of the target desensitized object in the PDF document page according to the result output by the image preprocessing module; and a type recognition module 23, which is connected to the coordinate correction engine module 22, and is used to identify the type of the target desensitized object based on the image recognition model using the corrected coordinate position output by the coordinate correction engine module 22.
[0035] Specifically, advanced image processing algorithms, such as median filtering or Gaussian filtering, can be used for scanned PDF images to effectively remove noise interference from scanned PDF images. This noise may be caused by limitations of the scanning equipment or defects in the document itself. The denoising operation can significantly improve the clarity of the image, making the text and image content easier to identify and process. Sharpening technology is used to enhance the edges and details of the image, making the outlines of text and graphics clearer. This helps to improve the accuracy and efficiency of subsequent information extraction from the image, ensuring that the processed image can clearly present the key information of the original document. By detecting the direction and angular deviation of the image, rotation correction operations are automatically performed. This step ensures that the image is displayed in the correct direction, avoiding information recognition errors caused by angular deviation during the scanning process.
[0036] In a specific embodiment, the multimodal data desensitization module 4 is configured with a rule mapping engine, which is used to match the corresponding desensitization rule according to the sensitive field type of the target desensitized object, and execute the atomic operation process bound to the desensitization rule, wherein the atomic operation process includes when the desensitization rule is a mask, retaining some characters at preset positions and replacing the remaining characters with specified symbols; when the desensitization rule is hash encryption, using the specified encryption algorithm to process the original data.
[0037] This embodiment decouples business requirements (how to desensitize) from technical implementation (how to execute) through a rule mapping mechanism, forming a configurable and scalable desensitization pipeline.
[0038] The multimodal content parsing engine module 3 is connected to the rule and document parsing module 2 and is used to parse the specific content of the target desensitized object in the PDF document according to the type of the identified target desensitized object.
[0039] Among them, the multimodal content parsing engine includes: an optical character recognition module, an image semantic parsing module and a table structure extraction module. The optical character recognition module is used to extract the text content and its coordinate position in the target desensitized object; the image semantic parsing module is used to identify the graphic elements and sensitive areas in the target desensitized object, and the table structure extraction module is used to reconstruct the table data model and cell coordinates in the target desensitized object.
[0040] For example, the text may be printed, handwritten, or digital text; the graphic element may be a natural image, an ID photo, a signature, or a seal; and the table may be a regular table or a merged cell table.
[0041] Setting the output results of the optical character recognition module, image semantic analysis module and table structure extraction module can better dynamically bind desensitization rules.
[0042] The multimodal content parsing engine module 3 may also include a multimodal alignment module, which establishes position coordinates by extracting multimodal position information of the target desensitized object and converts the coordinate information of different modalities into a unified page coordinate system of the PDF document to be desensitized.
[0043] For example, an optical character recognition engine locates the coordinates (x, y, width, height) of text box boundaries in a scanned PDF, generating geometric information for the text blocks. The coordinate information for the native text is then extracted from the original PDF structure. A table detection model (such as LayoutLMv3) is used to identify table cell boundaries and extract row and column coordinate information. Coordinate information from different modalities is converted to a unified PDF page coordinate system, eliminating coordinate deviations caused by scanning scaling or PDF page size variations. Overlapping text blocks or table cells are identified using collision detection algorithms (such as rectangular intersection calculations), prioritizing high-confidence optical character recognition results or native text. A topological structure diagram of the PDF layout is constructed based on this coordinate information, with text blocks and table cells as nodes and edges established through spatial adjacency (upper / lower / left / right). The rendering order of elements is adjusted based on the text block's area, position hierarchy (title → body → table), and optical character recognition confidence, simulating human reading habits.
[0044] This application can identify multi-page tables by analyzing the positional continuity of table cells in adjacent pages (such as the last row ends on the previous page and the first row starts on the next page), add temporal IDs to cross-page content (such as table_001_page1, table_001_page2), record its start / end page numbers and content offsets in the PDF, use graph neural networks (GNN) to build an association graph of cross-page elements, connect the same table cells on adjacent pages through temporal edges, and learn their semantic continuity.
[0045] This application can introduce temporal attention heads into the Transformer encoder, dynamically adjust the weights of cross-page content, ensure the accuracy of long-distance dependencies (such as the sum calculation of cross-page tables), merge cross-page content into a complete data stream based on temporal markers, and detect logical errors after splicing (such as column alignment misalignment) by comparing the table column widths, row heights and text content of adjacent pages. This solves the problem that traditional solutions cannot identify the semantic continuity of cross-page tables, resulting in a broken data structure after desensitization.
[0046] The multimodal data desensitization module 4 is connected to the multimodal content parsing engine module 3 and the data acquisition module 1 respectively, and is used to perform desensitization processing according to the parsed specific content and the desensitization rules corresponding to the target desensitization object.
[0047] In one embodiment, the multimodal data desensitization module 4 is also used to build a cross-modal association model, using semantic analysis and contextual understanding to associate and identify sensitive information in text, images, formulas, and tables. For example, when "ID number" is identified in text, the image recognition module is automatically triggered to find and associate the ID card photo in the image.
[0048] This embodiment solves the problem of contextual information loss caused by traditional single-modality desensitization, improves the accuracy and comprehensiveness of desensitization, maintains the logical integrity and usability of the document, and ensures that the desensitized document can still meet usage requirements.
[0049] In a specific embodiment, the multimodal data desensitization module 4 is also used to, when the type of the target desensitized object is text layer content, perform in-situ replacement or overwriting in the original text layer according to the parsed starting coordinates, ending coordinates and page of the specific content; when the type of the target desensitized object is image layer content, generate a mask layer that matches the original image size according to the parsed bounding box coordinates of the image area where the target desensitized object is located; the mask layer includes pixel blocks or blurred areas for blocking sensitive areas; the desensitization process includes superimposing the mask layer on the corresponding coordinate position of the original image layer.
[0050] For example, if the type of the target desensitization object detected is text, image, or table, when the type of the target desensitization object is text, sensitive content can be replaced with specific characters (such as *) or blurred. For example, the mobile phone number 13812345678 is desensitized to 138****5678, and the first 3 and last 4 digits of the ID number are retained, or some fields are dynamically hidden according to permissions, such as the customer service system only displays the last 4 digits of the mobile phone number, or the exact value is converted to a range description, such as the age of 25 is converted to 20-30 years old. Gaussian blur or mosaic processing is applied to sensitive areas (such as ID numbers) when the type of the target desensitization object is an image. When the type of the target desensitization object is a table, the entire column or row is dynamically hidden, such as hiding the ID number column.
[0051] Specifically, when the target desensitization object is a table, the row and column structure, cell boundaries, and content layout information of the table are identified and analyzed; according to the desensitization rules and cell content attributes, the following options are selected: (a) sensitive text in the cell is replaced with equal-width characters to keep the table column width unchanged; (b) for image cells containing sensitive information, image embedded text processing technology is applied; (c) after masking or replacing, the content or layout of adjacent cells is automatically adjusted to ensure that the overall structure of the table is clear and readable.
[0052] In a specific embodiment, the multimodal data desensitization module 4 is configured with a rule mapping engine for matching the corresponding desensitization rule according to the sensitive field type of the target desensitization object and executing the atomic operation process bound to the desensitization rule, wherein the atomic operation process includes: when the desensitization rule is a mask, retaining some characters at preset positions and replacing the remaining characters with specified symbols; when the desensitization rule is hash encryption, using a specified encryption algorithm to process the original data. The specified encryption algorithm can use algorithms such as AES and SHA-256 to encrypt text, and only authorized users can decrypt it.
[0053] In a specific embodiment, the multimodal data desensitization module 4 is also used to perform a confidence score on the specific content output by the multimodal content parsing engine module 3; wherein, when the confidence score is higher than a first threshold, the standard desensitization method specified by the desensitization rule is applied; when the confidence score is lower than the first threshold but higher than the second threshold, it is marked as pending review; when the confidence score is lower than the second threshold, the original content is retained and a log is recorded.
[0054] The first threshold and the second threshold are both pre-set designated thresholds, and the first threshold and the second threshold can be dynamically configured according to business scenarios, compliance requirements or risk levels.
[0055] In the above example, if the model's accuracy in identifying ID numbers is 98%, the first threshold can be set to 90%, ensuring a very low rate of false positives (e.g., ≤1%) for high-confidence content. If the model has a 5% probability of misclassifying non-sensitive content as sensitive, the second threshold can be set to 60%, ensuring a manageable risk of false negatives (e.g., ≤5%) for low-confidence content.
[0056] The above-mentioned embodiments achieve intelligent identification and tiered protection of sensitive data through multimodal fusion scoring, dynamic threshold grading, refined desensitization technology, and compliance assurance mechanisms. This not only meets stringent data security requirements but also preserves the business value of data through flexible strategies, making it applicable to privacy protection needs across multiple industries and scenarios.
[0057] Possibly, the multimodal data desensitizing module 4 further includes a log recording module for recording desensitized document information, identified sensitive object information, applied desensitizing rules, and processing results.
[0058] The PDF reconstruction module 5 is connected to the multimodal data desensitization module 4 and is used to reconstruct the desensitized content into a desensitized target PDF document. Because the PDF reconstruction module is modified based on the original format, the format error rate of the PDF reconstruction module of this application is <= 2%.
[0059] Specifically, the input PDF document to be desensitized is scanned to identify the type of sensitive information contained therein (such as ID number, bank card number, seal, financial data, etc.); according to the form of expression of sensitive information, it is divided into three modes: text, image, and table: Text mode: sensitive information in the form of printed or handwritten text (such as ID number, name); Image mode: sensitive information in the form of graphics (such as seals, photos); Table mode: sensitive information in the form of table structure (such as column data in financial statements); According to the sensitive type and content mode, the corresponding desensitization rules are matched; Text mode: call the "mask rule" to achieve masking through character replacement (such as using * to cover part of the number); Image mode: call the "blur processing" to reduce the sensitivity through algorithms such as Gaussian blur Image clarity; Table mode: call "column hiding" to directly hide the entire column containing sensitive information; perform parameter refinement adaptation on the processing results of text mode and image mode: detect whether the text mode is handwriting, if so, trigger the "DeepSeek Enhancement" rule: optimize the mask accuracy through the handwriting recognition algorithm to ensure that the key parts of the handwriting (such as the last 4 digits of the ID card number) are accurately masked while retaining the recognizability of the non-sensitive parts; detect whether the image mode is a seal, if so, trigger the "Mosaic Radius + 30%" rule: dynamically increase the mosaic radius of the blur processing (such as from the default 5px to 6.5px), completely eliminating the recognizability of the seal outline and text; integrate the adapted sensitive information processing results into the PDF document to generate the target PDF document.
[0060] Compared with the existing technology, in which manual processing is inefficient and error-prone, the Adobe Acrobat plug-in has limited image and table processing capabilities, and the open source solution using Apache PDFBox combined with Tesseract has a high recognition error rate and lacks dynamic control capabilities, this application uses a multimodal content parsing engine module 3 and a multimodal data desensitization module 4 to parse the specific content of the target desensitized object in the PDF document according to the type of the identified target desensitized object, and then performs desensitization processing based on the parsed specific content and the desensitization rules corresponding to the target desensitized object, thereby reducing the desensitization misidentification error rate and the probability of incomplete desensitization, and improving the efficiency of desensitizing sensitive information.
[0061] like Figure 3 As shown, this application provides a method for automatically desensitizing a PDF document, which specifically includes the following steps: S100: Obtain desensitization rules corresponding to a PDF document to be desensitized and at least one target desensitization object.
[0062] The desensitization rules are stored in a predefined rule library or configured by the user in real time. They include sensitive data type identifiers, regular expression rules, coding styles, encryption / watermarking options, etc. The target desensitization objects include, but are not limited to, one or more of: name, ID number, phone number, bank card number, address, email address, facial image, seal image, specific keywords, and specific organization name.
[0063] Optionally, the PDF document to be desensitized is a judicial-related text, wherein the target desensitization object may be identity card information, age, gender, address, name, and case facts (such as case facts involving privacy in criminal cases).
[0064] S200: Parse the PDF document to be desensitized, and identify the type of the target desensitization object based on an image recognition model.
[0065] The image recognition model may be YOLO, Faster R-CNN, or Layout-parser.
[0066] Specifically, by parsing the PDF file structure, we can accurately identify and separate the different layers within the PDF file, categorizing the content into the text layer containing text information, the image layer containing image content, and the table content. Using the PDF parsing library (PyMuPDF), we can directly extract text paragraphs, images, and table data (preserving the original layout coordinates).
[0067] More specifically, users upload PDF files and desensitization rule configurations (including regular rules, coding styles, encryption / watermark options, etc.) to classify the content. Native content (non-image): Directly extract text paragraphs and table data (retain the original layout coordinates) through a PDF parsing library (such as PyMuPDF), extract all images embedded in the PDF (JPG / PNG and other formats), and enter [Image Content Analysis]. Use image processing algorithms (Canny detects edge features and HoughLines algorithm detects straight lines) to quickly determine whether the image contains a table structure. If it contains a table image, Alibaba Cloud TableOCR service is called first to identify the table row and column structure and extract cell text and coordinates. If there is no table, PaddleOCR service is called first to extract all text and corresponding coordinates in the image (retaining the position information of the text in the image).
[0068] In a specific embodiment, the method of parsing the PDF document to be desensitized based on the deep learning model or the desensitization rule to determine the type of each target desensitization object also includes: preprocessing the PDF document to be desensitized.
[0069] Specifically, advanced image processing algorithms, such as median filtering or Gaussian filtering, can be used for scanned PDF images to effectively remove noise interference from scanned PDF images. This noise may be caused by limitations of the scanning equipment or defects in the document itself. The denoising operation can significantly improve the clarity of the image, making the text and image content easier to identify and process. Sharpening technology is used to enhance the edges and details of the image, making the outlines of text and graphics clearer. This helps to improve the accuracy and efficiency of subsequent information extraction from the image, ensuring that the processed image can clearly present the key information of the original document. By detecting the direction and angular deviation of the image, rotation correction operations are automatically performed. This step ensures that the image is displayed in the correct direction, avoiding information recognition errors caused by angular deviation during the scanning process.
[0070] In one specific embodiment, a comprehensive set of rule mappings can be established based on the sensitive field types and desensitization methods obtained through analysis, clarifying the specific processing logic and operational procedures for different types of sensitive fields under different desensitization methods. For example, for the ID card number field, if a masking method is used, it is determined which characters should be retained and which parts should be masked.
[0071] S300: According to the type of the identified target desensitized object, the specific content of the target desensitized object in the PDF document is parsed.
[0072] For example, an optical character recognition engine locates the coordinates (x, y, width, height) of text box boundaries in a scanned PDF, generating geometric information for the text blocks. The coordinate information for the native text is then extracted from the original PDF structure. A table detection model (such as LayoutLMv3) is used to identify table cell boundaries and extract row and column coordinate information. Coordinate information from different modalities is converted to a unified PDF page coordinate system, eliminating coordinate deviations caused by scanning scaling or PDF page size variations. Overlapping text blocks or table cells are identified using collision detection algorithms (such as rectangular intersection calculations), prioritizing high-confidence optical character recognition results or native text. A topological structure diagram of the PDF layout is constructed based on this coordinate information, with text blocks and table cells as nodes and edges established through spatial adjacency (upper / lower / left / right). The rendering order of elements is adjusted based on the text block's area, position hierarchy (title → body → table), and optical character recognition confidence, simulating human reading habits.
[0073] This application can identify multi-page tables by analyzing the positional continuity of table cells in adjacent pages (such as the last row ends on the previous page and the first row starts on the next page), add temporal IDs to cross-page content (such as table_001_page1, table_001_page2), record its start / end page numbers and content offsets in the PDF, use graph neural networks (GNN) to build an association graph of cross-page elements, connect the same table cells on adjacent pages through temporal edges, and learn their semantic continuity.
[0074] This application can introduce temporal attention heads into the Transformer encoder, dynamically adjust the weights of cross-page content, ensure the accuracy of long-distance dependencies (such as the sum calculation of cross-page tables), merge cross-page content into a complete data stream based on temporal markers, and detect logical errors after splicing (such as column alignment misalignment) by comparing the table column widths, row heights and text content of adjacent pages. This solves the problem that traditional solutions cannot identify the semantic continuity of cross-page tables, resulting in a broken data structure after desensitization.
[0075] S400: Perform desensitization processing according to the parsed specific content and the desensitization rules corresponding to the target desensitization object.
[0076] For example, if the type of the target desensitization object detected is text, image, or table, when the type of the target desensitization object is text, sensitive content can be replaced with specific characters (such as *) or blurred. For example, the mobile phone number 13812345678 is desensitized to 138****5678, and the first 3 and last 4 digits of the ID number are retained, or some fields are dynamically hidden according to permissions, such as the customer service system only displays the last 4 digits of the mobile phone number, or the exact value is converted to a range description, such as the age of 25 is converted to 20-30 years old. Gaussian blur or mosaic processing is applied to sensitive areas (such as ID numbers) when the type of the target desensitization object is an image. When the type of the target desensitization object is a table, the entire column or row is dynamically hidden, such as hiding the ID number column.
[0077] Specifically, when the target desensitization object is a table, the row and column structure, cell boundaries, and content layout information of the table are identified and analyzed; according to the desensitization rules and cell content attributes, the following options are selected: (a) sensitive text in the cell is replaced with equal-width characters to keep the table column width unchanged; (b) for image cells containing sensitive information, image embedded text processing technology is applied; (c) after masking or replacing, the content or layout of adjacent cells is automatically adjusted to ensure that the overall structure of the table is clear and readable.
[0078] When the type of the target desensitization object detected above is text, the text can be encrypted using algorithms such as AES and SHA-256, and only authorized users can decrypt it.
[0079] S500: Reconstruct the desensitized content into a desensitized target PDF document.
[0080] Specifically, the input PDF document to be desensitized is scanned to identify the type of sensitive information contained therein (such as ID number, bank card number, seal, financial data, etc.); according to the form of expression of sensitive information, it is divided into three modes: text, image, and table: Text mode: sensitive information in the form of printed or handwritten text (such as ID number, name); Image mode: sensitive information in the form of graphics (such as seals, photos); Table mode: sensitive information in the form of table structure (such as column data in financial statements); According to the sensitive type and content mode, the corresponding desensitization rules are matched; Text mode: call the "mask rule" to achieve masking through character replacement (such as using * to cover part of the number); Image mode: call the "blur processing" to reduce the sensitivity through algorithms such as Gaussian blur Image clarity; Table mode: call "column hiding" to directly hide the entire column containing sensitive information; perform parameter refinement adaptation on the processing results of text mode and image mode: detect whether the text mode is handwriting, if so, trigger the "DeepSeek Enhancement" rule: optimize the mask accuracy through the handwriting recognition algorithm to ensure that the key parts of the handwriting (such as the last 4 digits of the ID card number) are accurately masked while retaining the recognizability of the non-sensitive parts; detect whether the image mode is a seal, if so, trigger the "Mosaic Radius + 30%" rule: dynamically increase the mosaic radius of the blur processing (such as from the default 5px to 6.5px), completely eliminating the recognizability of the seal outline and text; integrate the adapted sensitive information processing results into the PDF document to generate the target PDF document.
[0081] Compared with the existing technology, in which manual processing is inefficient and error-prone, the Adobe Acrobat plug-in has limited image and table processing capabilities, and the open source solution using Apache PDFBox combined with Tesseract has a high recognition error rate and lacks dynamic control capabilities, this application uses a multimodal content parsing engine module 3 and a multimodal data desensitization module 4 to parse the specific content of the target desensitized object in the PDF document according to the type of the identified target desensitized object, and then performs desensitization processing based on the parsed specific content and the desensitization rules corresponding to the target desensitized object, and dynamically desensitizes the type of the target desensitized object, thereby reducing the desensitization misidentification error rate and the probability of incomplete desensitization, and improving the efficiency of desensitizing sensitive information.
[0082] In order to solve the technical problems existing in the prior art, such as Figure 4 As shown, an embodiment of the present application further proposes an electronic device 10, including a memory 12 and a processor 11, wherein the memory 12 stores a program for running on the processor 11, and when the program is executed by the processor, the electronic device implements the functions of the system mentioned in any of the above embodiments.
[0083] One embodiment of the present application further provides a computer-readable storage medium having a program stored therein. When executed, the program implements the functions of the system described in any of the above embodiments. Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments and all or part of the functions of the systems described in the above embodiments can be performed by instructing a processor through a program. The program can be stored in a computer-readable storage medium, which is a non-transitory medium such as random access memory, read-only memory, flash memory, a hard disk, a solid-state drive, magnetic tape, a floppy disk, an optical disc, or any combination thereof. The storage medium can be any available medium accessible by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, hard disk, or tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0084] One embodiment of the present application further provides a computer program product that can be directly loaded into the intelligent control device mentioned above. The computer program product has a program code mechanism so that when the computer program product is executed in the intelligent control device, it performs the functions of the system mentioned in any of the above embodiments. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computing device, the process or function described in accordance with the embodiment of the present application is generated in whole or in part. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, or data center to another website, computer, or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0085] When the computer program product is executed by a computer, the computer performs the functions of the system described in the above embodiment. The computer program product can be a software installation package. When the above system needs to be used, the computer program product can be downloaded and executed on the computer.
[0086] In summary, the present application provides a system, method, electronic device and computer program product for automatic desensitization of PDF documents. The present application realizes automatic desensitization processing of the target text to be desensitized through a data acquisition module, a rule and document parsing module, a multimodal content parsing engine module, a multimodal data desensitization module and a PDF reconstruction module, thereby reducing the error rate of desensitization misidentification and the probability of incomplete desensitization, and improving the efficiency of desensitization of sensitive information.
[0087] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the present invention. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical principles disclosed herein are intended to be covered by the claims of the present invention.
Claims
1. A PDF document automatic desensitization system, characterized by: include: A data acquisition module is used to obtain the desensitization rules corresponding to the PDF document to be desensitized and at least one target desensitization object; A rule and document parsing module, connected to the data acquisition module, is used to parse the PDF document to be desensitized and identify the type of the target desensitization object based on an image recognition model; A multimodal content parsing engine module, connected to the rule and document parsing module, is used to parse the specific content of the target desensitized object in the PDF document according to the type of the identified target desensitized object; A multimodal data desensitization module, connected to the multimodal content parsing engine module and the data acquisition module, respectively, for performing desensitization processing according to the parsed specific content and the desensitization rules corresponding to the target desensitization object; The PDF reconstruction module is connected to the multimodal data desensitization module and is used to reconstruct the desensitized content into a desensitized target PDF document.
2. The system according to claim 1, wherein: The multimodal data desensitization module is further configured to perform in-situ replacement or overwriting of the original text layer according to the parsed start coordinates, end coordinates, and page of the specific content when the type of the target desensitization object is text layer content; When the type of the target desensitized object is image layer content, a mask layer matching the size of the original image is generated based on the parsed bounding box coordinates of the image area where the target desensitized object is located; the mask layer includes pixel blocks or blurred areas for masking sensitive areas; the desensitization processing includes superimposing the mask layer on the corresponding coordinate position of the original image layer.
3. The system according to claim 2, characterized in that The multimodal data desensitization module is configured with a rule mapping engine, which is used to match the corresponding desensitization rule according to the sensitive field type of the target desensitized object, and execute the atomic operation process bound to the desensitization rule, wherein the atomic operation process includes when the desensitization rule is a mask, retaining some characters at preset positions and replacing the remaining characters with specified symbols; when the desensitization rule is hash encryption, using a specified encryption algorithm to process the original data.
4. The system according to claim 3, characterized in that The multimodal data desensitization module is also used to perform confidence scoring on the specific content output by the multimodal content parsing engine module; wherein, when the confidence score is higher than a first threshold, the standard desensitization method specified by the desensitization rule is applied; when the confidence score is lower than the first threshold but higher than a second threshold, it is marked as pending review; when the confidence score is lower than the second threshold, the original content is retained and a log is recorded, wherein the first threshold and the second threshold are both pre-set specified thresholds.
5. The system according to claim 1, wherein: The rule and document parsing module also includes: Image preprocessing module, used to perform structure separation and image processing on PDF documents to be desensitized; A coordinate correction engine module, connected to the image preprocessing module, for correcting the coordinate position of the target desensitization object in the PDF document page according to the result output by the image preprocessing module; And a type identification module, connected to the coordinate correction engine module, is used to identify the type of the target desensitization object based on the image recognition model using the corrected coordinate position output by the coordinate correction engine module.
6. The system according to claim 1, wherein: The multimodal content parsing engine module includes: Optical character recognition module, used to extract the text content and coordinate position of the target desensitized object; Image semantic parsing module, used to identify graphic elements and sensitive areas in the target desensitization object; And the table structure extraction module is used to reconstruct the table data model and cell coordinates in the target desensitized object.
7. The system according to claim 6, characterized in that The multimodal content parsing engine module includes a multimodal alignment module, which is used to establish position coordinates by extracting multimodal position information of the target desensitized object and converting the coordinate information of different modalities into a unified page coordinate system of the PDF document to be desensitized.
8. A method for automatically desensitizing a PDF document, characterized in that: include: Obtain the desensitization rules corresponding to the PDF document to be desensitized and at least one target desensitization object; Parse the PDF document to be desensitized and identify the type of the target desensitization object based on an image recognition model; According to the type of the identified target desensitization object, the specific content of the target desensitization object in the PDF document is parsed; Perform desensitization processing according to the parsed specific content and the desensitization rules corresponding to the target desensitization object; Reconstruct the desensitized content into a desensitized target PDF document.
9. An electronic device, characterized in that: The system comprises a memory and a processor, wherein the memory is used to store a computer program executable by the processor; and the processor is used to execute the computer program in the memory to implement the functions of the system according to any one of claims 1 to 7.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the functions of the system according to any one of claims 1 to 7 are realized.
Citation Information
Patent Citations
Multi-source multi-modal data processing system and method for applying system
CN111859451A
Log desensitization method and device and storage medium
CN112307512A
Data desensitization method and device, electronic equipment and readable storage medium
CN113032821A
Data desensitization method and device, storage medium and terminal
CN114398665A
Big data processing system and method based on hybrid engine
CN114625764A
Cited By
Bidding document total-factor blind-state desensitization method fused with multi-modal artificial intelligence
CN121118114A