A PDF document high frame rate rendering parsing and editing system and device
By employing multi-model collaborative parsing and deep learning technologies, this system addresses the shortcomings of existing PDF parsing tools in terms of compatibility, structured extraction, version management, and customized processing for professional fields. It achieves a high frame rate rendering PDF document parsing and editing system, improving parsing accuracy, efficiency, and flexibility.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA AUTOMOTIVE SOFTWARE (SHENZHEN) CO LTD
- Filing Date
- 2025-12-15
- Publication Date
- 2026-04-21
AI Technical Summary
Existing PDF parsing tools are inadequate in terms of compatibility, structured extraction, version management, editing functions, and customized processing for professional fields, and cannot meet the complex document needs of the telecommunications industry for financial contracts and tax documents.
It employs multi-model collaborative parsing technology, including MinerU, LayoutLMv3, and PaddleOCR, combined with deep learning models for document type recognition and content extraction. Through block-level order determination and coordinate repair, it achieves atomic-level paragraph selection and clause number editing, and supports version history management.
It improves the accuracy and efficiency of PDF document parsing, enhances the structured extraction capabilities of complex document layouts, enables iterative tracking and editing flexibility, reduces the cost of secondary format adjustments, and strengthens customized processing capabilities in professional fields.
Smart Images

Figure CN121328486B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of PDF document parsing and editing technology, specifically to a PDF document high frame rate rendering parsing and editing system and device. Background Technology
[0002] PDF, as a standardized document format that is cross-platform and cross-device, is widely used in professional scenarios such as financial contracts and tax documents in the communications industry. However, because PDF documents have various types such as text, layer, and scanned versions, and the layout complexity and content structure of different documents vary greatly, there is currently no PDF parsing tool that perfectly adapts to all scenarios.
[0003] All existing PDF parsing tools must make trade-offs in terms of features based on design principles such as decentralization, energy saving, and security. By strengthening the advantages of a single dimension (such as improving parsing speed and optimizing compatibility) to adapt to specific use cases, they make it difficult to meet the needs of multiple document types, structured extraction accuracy, version management, and customized editing. As a result, they present an overall situation of "prominent single feature and insufficient comprehensive performance".
[0004] In the scenario of optimizing taxation for financial contracts in the telecommunications industry, existing routine operations mostly rely on traditional single PDF parsing tools: First, general parsing tools (such as basic OCR tools and simple text extraction plugins) are used to extract content from PDF documents of financial contracts and tax certificates. For text-based documents, text information is directly extracted, while for scanned documents, only basic image recognition and text conversion are performed. Second, the extracted content is formatted and structured manually or using simple spreadsheet tools, and core tax-related information (such as contract amount, tax rate clauses, payment terms, etc.) is manually selected. Finally, local file backups or basic cloud storage are used to record document versions. Editing operations are mostly focused on overall text modification and format adjustment, without specifically adapting to the clause numbering rules and national standard metadata specifications of financial contracts in the telecommunications industry.
[0005] However, this type of existing conventional operation method has significant technical shortcomings, with the core problems concentrated in five points:
[0006] First, there is insufficient compatibility with complex document types. For layered financial contracts and high-resolution scanned tax vouchers commonly used in the communications industry, problems such as missing text extraction and formatting errors are likely to occur.
[0007] Secondly, complex structural formats are difficult to extract, making it impossible to accurately identify the hierarchy of contract terms and the relationships between tax-related metadata. This requires a lot of manual intervention and is inefficient.
[0008] Third, there is a lack of version management and iteration traceability capabilities. It can only record the overall modification time of the document, but cannot trace the modification history of specific clauses or the responsible parties, making it difficult to meet the traceability requirements of financial contract tax audits.
[0009] Fourth, the editing function lacks atomicity and flexibility, making it impossible to achieve precise selection and editing at the paragraph or clause level. It also makes it difficult to perform operations such as modifying specific clauses and replacing data, which are required for tasks such as tax optimization.
[0010] Fifth, the ability to customize processing in professional fields is weak. Most of the specified clause numbering rules, metadata extraction standards, and the screening and verification of core information in related fields all need to be done manually, which is prone to errors and has poor adaptability.
[0011] In summary, due to the uncertainty of uploaded document size, existing PDF parsing tools all have their own advantages and disadvantages. The various parsing mechanisms of PDF parsing tools can be considered as sacrificing some features to enhance others, thereby adapting to specific scenarios.
[0012] Therefore, this application proposes a high frame rate rendering parsing and editing system and device for PDF documents, which can achieve high overall operating efficiency based on specified design principles including decentralization, energy saving and security, and make trade-offs according to characteristics, so as to solve the above-mentioned technical problems. Summary of the Invention
[0013] The main objective of this invention is to address the five core problems existing in the field of PDF document parsing and editing (insufficient compatibility with complex document types, difficulty in extracting complex layout structures, lack of version management and iteration tracking capabilities, insufficient atomicity and flexibility of editing functions, and weak ability to customize professional documents). This invention provides a high-frame-rate rendering parsing and editing system and device for PDF documents that integrates multi-model collaborative parsing, intelligent structured processing, version management, and customized editing, thereby solving the technical problems mentioned in the background section.
[0014] The present invention solves the above-mentioned technical problems by adopting the following technical solutions:
[0015] A high frame rate rendering and parsing editing system for PDF documents, comprising:
[0016] The file list upload module is used to upload PDF files and display a version history list and PDF file version information;
[0017] The document parsing logic module is used to read PDF document information and parse the PDF document. Then, the data obtained from the model parsing is input into the processing pipeline to determine the block-level order, delete useless elements, and sort and assemble the content according to the layout.
[0018] The PDF original document display module performs the following operations sequentially within the uploaded PDF file: displaying the PDF file title, cropping the file display page, generating a file directory, and displaying the document parsing results. During the file directory generation operation, the multi-level numerical numbering of the post-processed document is captured, and the numbering type is automatically classified according to the matching results of different capture groups in the regular expression. Then, the numbering is processed according to the specified level mapping rules to finally obtain the file directory number.
[0019] Preferably, before processing the PDF document, the document parsing logic module first reads the PDF's metadata information through MinerU to identify its type, such as text, layer, or scanned PDF, and performs corresponding preprocessing, such as detecting garbled characters and identifying whether it is a scanned document.
[0020] For the parsing processing operations of the document parsing logic module:
[0021] Text-based and layer-based documents use deep learning-based models, including LayoutLMv3, to perform region detection, identify different regions in the document, including images, tables, titles, and text, and locate the positions of different elements in the document.
[0022] For scanned PDFs, OCR technologies, including PaddleOCR, are used to recognize the text content in the document.
[0023] Preferably, the document parsing logic module also performs operations including coordinate repair, high IOU processing, merging of image and table descriptions, formula replacement, icon dumping, and layout sorting during the post-processing operation.
[0024] Preferably, the specific operation process for cropping the document display page includes:
[0025] After performing OCR recognition on the document content, it is cropped to obtain a preliminary file display page. Then, the browser API element acquisition tool is called to obtain the DOM of the page where the current PDF document is located.
[0026] The html2canvas conversion script tool renders DOM elements into a canvas. By using specified movement events (such as mousedown, mousemove, mouseup), including mouse or touch events, you can drag, scale, and rotate the clipping box (usually a rectangular area) on the canvas and calculate the position (coordinates) and size (width and height) of the clipping box in real time.
[0027] Then, the captured pixel data is drawn onto a new set of Canvas, and converted into a Base64 format image URL using the toDataURL() method;
[0028] Finally, the Markdown content is extracted according to the document parsing logic.
[0029] Preferably, the specific operation process of the directory generation operation includes:
[0030] The marked component is used to identify the original "#" symbol in the markdown file to determine the heading level of the directory, obtain the clause number and clause title of the file directory, and assign a unique ID to it according to the order of acquisition. The initial clause number file is then obtained through its operation.
[0031] The document is matched using three capture groups: Chinese and English (matching the corresponding format of "English appendix identifier" and "Chinese appendix identifier" in the document (e.g., Annex A / Appendix A, Annex 1. / Appendix B)), English abbreviation or abbreviation (matching the abbreviation or abbreviation of "first letter + . + subsequent number / letter" in English (e.g., US, AB, A.1)), and multi-level numbering (capturing multi-level numbering such as "1.1", "2.3.4", "5.6.7" (supporting levels 1-∞, with spaces before and after the period)).
[0032] Based on the matching results of different capture groups in the regular expression, the numbering type is automatically classified (matching capture group 1 is determined to be an appendix number, matching capture group 2 is determined to be an alphabetic number, and matching capture group 3 is determined to be a numeric number). At the same time, a unified hierarchical mapping rule is established, which maps appendix numbers to the highest level by default (e.g., "Appendix A" corresponds to a level value of 0, which is the "#" level heading in Markdown). Alphabetic and numeric numbers are strictly mapped according to the rule of total number of levels - 1, to ensure that the hierarchical relationship of different types of numbers is clear and consistent and to avoid hierarchical confusion.
[0033] To address common irregularities in numbering, including redundant spaces (such as "1.2.3" and "Appendix B"), mixed uppercase and lowercase letters (such as "Appendix b" and "Ac"), and skipped number levels (such as "2.1.3" directly connecting to "2.3" and "B.1" directly connecting to "B.3.1"), this system employs preprocessing techniques such as space removal, unified uppercase and lowercase letter conversion (converting to uppercase format, e.g., "Appendix b" to "Appendix B"), and independent hierarchical calculation. This approach thoroughly eliminates the impact of formatting deviations on the parsing results, ensuring that all types of non-standard documents can be correctly recognized and the final capture group numbered file is obtained.
[0034] Compare the captured group number files with the initial number files one by one:
[0035] For content with the same number, map the ID of the initial number file to the capture group number file corresponding to the number;
[0036] For content with inconsistent numbers, if the capture group number file exists but the initial number file does not, the capture group number is directly retained; otherwise, the current number is split to calculate the level independently ("1" splits to an array length of 1, the result is 1, and the level value is 0; "1.2.2" splits to an array length of 3, the result is 1, 2, 2, and the level value is 2). Then, the number position corresponding to the capture group is obtained through the previous level of this number, and it is split accordingly.
[0037] If the initial number of a file is at the same level as or lower than the current level, the contents are compared one by one by the sequence number of the split contents (e.g., capture group 1.2.1, split result is 1, 2, 1). If they are consecutive, they are inserted after this capture group number; otherwise, they are discarded. If the number is higher than the current number, they are compared with the next level of the current number in the same way and inserted consecutively; otherwise, they are discarded.
[0038] Modify the content of the clause title in the numbering to obtain the final capture group number file. Introduce a positive assertion, which requires that the position is immediately followed by a newline character, a separator, or a period, with the period being the last character of the text. This clearly limits the termination condition of the title text to "newline", "period", or "end of document", effectively avoiding including redundant information such as the beginning of the body text after the title, irrelevant punctuation marks (such as commas and semicolons), and annotation content in the title recognition scope, thereby improving the accuracy of numbering and title extraction.
[0039] Preferably, the specific operation process for displaying the document parsing results includes:
[0040] Simultaneously create canvas and SVG page elements, convert the uploaded PDF file into a file stream format, obtain the page numbers of the PDF file using the pdfjs-dist tool, traverse the page numbers, and combine the canvas to display the original PDF document on the page;
[0041] Obtain the coordinates of the content after parsing the document using the parsing logic, and then use the polygon tool in SVG to select the content.
[0042] The browser API element retrieval tool is used to obtain the DOM width and height of the document display page, calculate the canvas width and height, divide the DOM width by the canvas width to get the scaling ratio, and then scale the canvas and SVG according to the scaling ratio.
[0043] The frames are differentiated by color according to the content being displayed: the blue frame (#096dd9) is used to display the text content of the document, the yellow frame (#ffc069) is used to display the image content of the document, and the green frame (#389e0d) is used to display the table content of the document.
[0044] Preferably, it also includes a markup processing module, used to perform addition, modification, and deletion operations on the parsed content of the file, and to export and store the modified content. The markup processing module includes a content display unit and a Markdown processing unit, wherein:
[0045] The content display unit is used to remove the original document's homepage, table of contents, and preface, and directly render the content starting from the main text. The rendered content is then combined with the file directory generation logic to mark the directory and hierarchy, and the content is displayed in the order of appearance. When encountering inline_equation or interline_equation, the line containing them needs to be displayed using the mathjax-full tool.
[0046] The Markdown processing unit consists of a heading formatting component, a paragraph operation component, a text paragraph editing component, and an editing trigger component. The heading formatting component is used to switch the highlighting status of headings according to hierarchical conditions. The paragraph operation component is used to perform merge or split operations on the marked target paragraphs. The text paragraph editing component is used to automatically identify the number in the heading and classify the table of contents and clause items according to whether the content contains punctuation marks. The editing trigger component is used to enter the text paragraph modification mode through a trigger operation.
[0047] The table, formula, and image processing unit is used to process the table content, formula data, and image resources obtained after parsing the PDF file and display them in list form. It also optimizes the content display effect through a clarity display component, enabling operation and processing of the target content.
[0048] Preferably, during the rendering process, the content display unit obtains basic parsing data from the document parsing logic module and categorizes the data into five types: image, table, inline_equation, block-level_equation, and text. Among these, image, table, and inline_equation can be stored independently within the text, while inline_equation and text appear synchronously, meaning that text contains inline_equation and they need to be stored together.
[0049] Preferably, the specific operation process of the paragraph operation component performing merge or split operations on the marked target paragraphs includes:
[0050] Embed an independent radio button (such as a checkbox) before each paragraph to form a binding relationship between the paragraph and the selector;
[0051] Atomic-level selection is achieved by marking the target paragraph with the control state (selected / unselected): single-paragraph and multi-paragraph cross-region selection is supported, breaking through the limitations of traditional "continuous drag selection" (such as skipping the middle paragraphs to select the 1st and 5th paragraphs).
[0052] The selected paragraphs' text content and formatting information are aggregated into a single paragraph using a set of merging components;
[0053] A single paragraph can be split into multiple paragraphs based on user-specified delimiters using a set of splitting components, while automatically inheriting the original paragraph formatting.
[0054] This requires balancing "preserving individual formatting" with "overall consistency" to avoid the cost of secondary formatting adjustments.
[0055] Preferably, in the specific operation of classifying the table of contents and clause items, the text paragraph editing component uses a three-level progressive regular expression matching to extract the following title numbering format across all scenarios:
[0056] Numerical numbering (e.g., "1.1", "2.3.4"): Matches hierarchical numbers consisting of numbers and decimal points, separating the initial numerical number from the subsequent text, and does not match combinations of numbers and full-width right brackets (e.g., refuses to match "1.2.3)xxx", but matches "1.2.3xxx", "1.2xxx", etc.).
[0057] Appendix subheading numbering (e.g., “A.1”, “B.2.3”): Matches appendix subheading numbers with alphanumeric hierarchical combinations and automatically processes and unifies the numbering format (e.g., extracts “A.1” directly as a standard number).
[0058] Appendix main title number (e.g., "Appendix A", "Appendix B"): Matches main titles with the appendix prefix, supporting any space between the number and the appendix (e.g., "Appendix A" is automatically converted to "Appendix B").
[0059] Unnumbered headings: Headings that do not match the above format are automatically marked as having no table of contents number, ensuring that all headings can be structured.
[0060] Preferably, the edit trigger component supports modifications to the following:
[0061] (1) Clause number: Supports editing of numbering in formats including numerical labels; Clause number is the core basis for judging the text paragraph title attribute. By modifying the clause number and adjusting the selection parameters of the subordinate directory and directory coordinates, the synchronous update of the PDF original document directory display unit can be triggered.
[0062] (2) Subordinate directory: Supports adjusting parameters for the directory level to which a paragraph belongs;
[0063] (3) Table of Contents Coordinates: Supports editing the coordinate parameters of paragraphs in the table of contents;
[0064] (4) Clause title: Supports modification of subsequent related content (such as "scope" text) of the clause number;
[0065] (5) Clause requirements: Support editing of core content sections that are not title attributes.
[0066] Preferably, the table, formula, and image processing unit, taking table processing as an example, is configured with a table data extraction component, a table list rendering component, and a table operation component. The specific operation flow includes:
[0067] Table data extraction component: Extracts structured table data from parsed file data;
[0068] Table list rendering component: renders and displays the extracted table data in list format;
[0069] Table operation component: Supports operations such as adding, modifying, and deleting table data, and updates the list display content synchronously after the operation command is triggered.
[0070] Preferably, the tagging processing module further includes a metadata processing unit, used to extract and modify relevant metadata information in the parsed content of a specified regulatory document through a metadata extraction component and a metadata editing component. Its specific execution flow includes:
[0071] The metadata extraction component scans the parsed content of the file to identify and extract metadata information related to specified regulations.
[0072] Configure a metadata editing component to support parameter modification of the extracted metadata information. After the modification is completed, the data can be stored through the "Save Edits" function option.
[0073] In another aspect, the present invention also discloses a PDF document high frame rate rendering parsing and editing device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor causes the processor to perform the steps of the operation method in the PDF document high frame rate rendering parsing and editing system described above.
[0074] As can be seen from the above technical solution, the present invention provides a PDF document high frame rate rendering parsing and editing system and device. Compared with the prior art, the present invention has the following advantages:
[0075] 1. This invention identifies PDF types through the MinerU preprocessing module, accurately extracts content by calling corresponding models including LayoutLMv3 and PaddleOCR, and restores the text structure and position through post-processing operations including block-level order determination and coordinate repair; it also performs operations including atomic-level paragraph selection, clause number editing, and specified metadata extraction, and can achieve iterative traceability by combining a complete version history, effectively solving the problems of inaccurate parsing, low editing efficiency, and poor professional adaptation of traditional tools.
[0076] 2. This invention can accurately parse various types of PDF documents using corresponding models, with an accuracy rate approximately 30% higher than traditional OCR. For documents with complex layouts, it restores the logical structure of titles, paragraphs, and tables through layout analysis and reading order sorting, solving the technical problem of paragraph breaks in traditional tools. It also utilizes version management functions to achieve iterative traceability through metadata, avoiding the problem of unrecoverable accidental modifications. Furthermore, it supports single / multi-segment cross-region selection and atomic-level modification operations using editing functions, reducing the cost of secondary format adjustments by approximately 40%. For professional documents, it achieves efficient and accurate identification of clause levels and numbers under high frame rate rendering conditions through metadata extraction and three-layer progressive regular expression matching, solving the problem of difficult clause level identification in traditional tools.
[0077] It should be understood that the descriptions in this section are not intended to identify key or essential features of embodiments of the invention, nor are they intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Of course, implementing any product of the invention does not necessarily require achieving all of the advantages described above simultaneously. Attached Figure Description
[0078] The accompanying drawings, which form part of this application, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0079] Figure 1 This is a schematic diagram of the overall data processing system framework for PDF documents according to the present invention;
[0080] Figure 2 This is a schematic diagram of the system framework of the document parsing logic module of the present invention;
[0081] Figure 3 This is a schematic diagram of the PDF original document display module system framework of the present invention;
[0082] Figure 4 This is a schematic diagram of the system framework of the tagging processing module of the present invention;
[0083] Figure 5 This is a diagram of the system front-end operation page interface of the present invention;
[0084] Figure 6 This is an example diagram of the operation interface for displaying the system front-end document parsing results according to the present invention;
[0085] Figure 7 This is an example diagram of the title highlighting switching operation interface of the title formatting component of the present invention;
[0086] Figure 8 This is an example diagram showing the result of the paragraph operation component of the present invention merging text paragraphs.
[0087] Figure 9 This is an example diagram showing the result of the paragraph modification operation interface of the text paragraph editing component of the present invention. Detailed Implementation
[0088] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0089] For details in the embodiments, please refer to Figures 1 to 9 .
[0090] like Figure 1 As shown in the embodiments of the present invention, the high frame rate rendering parsing and editing system for PDF documents is used to solve the technical problems in the prior art, such as insufficient compatibility with complex document types, difficulty in extracting complex layout structures, lack of version management and iteration tracking capabilities, insufficient atomicity and flexibility of editing functions, and weak ability to customize professional documents.
[0091] The specific system usage environment during its implementation is as follows:
[0092] The front-end uses Vue + ElementUI as the core framework, leveraging its component-based features to achieve efficient development and maintenance of complex interfaces. The text parsing tool integrates Canvas and SVG technologies. For large-scale document rendering, Canvas is used to achieve incremental drawing line by line and block by block, combined with virtual scrolling technology, maintaining high frame rates and smoothness even when handling hundreds of pages of documents. For document content rendering, pdfjs-dist is integrated to achieve high-performance parsing and rendering of PDF documents, supporting consistent display effects across platforms, including complex font embedding and vector graphics rendering. It also incorporates streaming loading technology to achieve fast previewing of large PDFs. For mathematical formulas contained in the documents, MathJax is used for accurate rendering, supporting multiple formula syntaxes such as LaTeX and MathML, ensuring aesthetically pleasing formula layout and consistency with the original text, meeting the needs of professional scenarios such as academic papers and engineering documents. At the build level, Webpack combined with Vite is used to achieve ultra-fast hot updates and production-environment code compression (Gzip / Brotli dual compression), keeping the first-screen loading time within 1.5 seconds.
[0093] The backend uses Python + FastAPI to build the POC API service. The main component is MinerU. MinerU is a tool that converts PDFs into machine-readable formats (such as Markdown and JSON), easily extracting data into any format. The main modules used are:
[0094] The layout check uses doclayout_yolo;
[0095] The MFD model used for the expression is yolo_v8_mfd;
[0096] The mfr model for the expression uses unimernet_small;
[0097] The table model uses rapid_table;
[0098] OCR recognition uses Baidu's PaddleOCR.
[0099] Furthermore, the terminal user interface built by this system is as follows: Figure 5 As shown, its system modules include: a file list upload module, a PDF original document display module, and a document parsing logic and tag processing module, among which:
[0100] (1) File list upload module, used to upload or delete PDF files, and display a complete version history list and version information of PDF files uploaded by the user, and trace the time information of the file version iteration process through the upload time in the PDF file version information.
[0101] (2) The document parsing logic module first processes the PDF document. Before processing the PDF document, MinerU first reads the PDF's metadata information, identifies its type (e.g., text, layer, or scanned PDF), and performs corresponding preprocessing, such as detecting garbled characters and identifying whether it is a scanned document. For text and layered PDFs, deep learning-based models, such as LayoutLMv3, are used to perform region detection, identify different regions in the document such as images, tables, titles, and text, and locate the positions of different elements in the document. For scanned PDFs, OCR technologies such as PaddleOCR are used to recognize the text content in the document. The data parsed by the above models is input into the processing pipeline for post-processing, including determining the block-level order, deleting useless elements, sorting and assembling the content according to the layout to ensure the fluency of the main text, and also performing operations such as coordinate repair, high IOU processing, merging image and table descriptions, formula replacement, icon dumping, and layout sorting. Figure 2 As shown.
[0102] (3) The PDF original document display module, for PDF files uploaded by the file list upload module, is used to sequentially perform the following operations in the original document: displaying the PDF file title, cropping the file display page, generating the file table of contents, and displaying the document parsing results, such as... Figure 3 As shown.
[0103] in:
[0104] Display PDF file title: Used to show the original title of the uploaded file.
[0105] Document display page cropping operation: The original PDF document display module performs OCR recognition on the document content and then crops it to obtain a preliminary document display page.
[0106] The document display page cropping operation involves: First, using the browser API element retrieval tool, the DOM of the current PDF document page is obtained. Then, the html2canvas conversion script renders the DOM element into a canvas. Mouse / touch events (such as mousedown, mousemove, mouseup) allow the user to drag, scale, and rotate the cropping box (usually a rectangular area) on the canvas, calculating its position (coordinates) and size (width and height) in real time. The extracted pixel data is then drawn onto a new canvas and converted to a Base64 image URL using the toDataURL() method. Finally, Markdown content is extracted according to the document parsing logic.
[0107] File directory generation operation: The file directory mainly consists of two parts: clause number and clause title.
[0108] First, obtain the clause numbers. Marked, as an auxiliary tool for identifying Markdown files, relies on Markdown's native "#" symbol to determine the heading level. It then assigns unique IDs to each clause based on their order of appearance, and uses these operations to filter and obtain the initial clause number files.
[0109] The second step involves three capture groups: 1. Matching the corresponding format of "English appendix identifier" and "Chinese appendix identifier" in the document (e.g., Annex A / Appendix A, Annex 1. / Appendix B); 2. Matching abbreviations or shorthands in English using "first letter + . + subsequent numbers / letters" (e.g., US, AB, A.1); 3. Capturing multi-level numeric numbers such as "1.1", "2.3.4", "5.6.7" (supporting levels 1-∞, with spaces allowed before and after the period). Based on the matching results of different capture groups in the regular expression, the numbering type is automatically classified—matching capture group 1 indicates an appendix number, matching capture group 2 indicates a letter number, and matching capture group 3 indicates a numeric number. A unified hierarchical mapping rule is also established: appendix numbers are mapped to the highest level by default (e.g., "Appendix A" corresponds to level 0, i.e., Markdown's "#" level heading), while letter and numeric numbers are strictly mapped according to the rule of "total number of levels - 1," ensuring a clear and consistent hierarchical relationship between different numbering types and avoiding hierarchical confusion.
[0110] At this point, for common irregularities in numbering such as extra spaces (e.g., “1.2.3”, “Appendix B”), mixed uppercase and lowercase letters (e.g., “Appendix b”, “Ac”), and skipped number levels (e.g., “2.1.3” directly connects to “2.3”, “B.1” directly connects to “B.3.1”), the preprocessing stage removes spaces, unifies uppercase and lowercase letter conversion (unifying to uppercase format, e.g., “Appendix b” is converted to “Appendix B”), and performs independent calculations of levels. This completely eliminates the impact of format deviations on the parsing results, ensuring that all kinds of irregular documents can be correctly recognized and the final capture group numbered file is obtained.
[0111] The third step involves comparing the capture group number file with the initial number file one by one. For content with the same number, the ID in the initial number file is mapped to the corresponding capture group number file. For content with different numbers, if the capture group number file exists but the initial number file does not, the capture group number is directly retained. Otherwise, the current number is first split to independently calculate the level ("1" splits to an array length of 1, the result is 1, and the level value is 0; "1.2.2" splits to an array length of 3, the result is 1, 2, 2, and the level value is 2), and then the corresponding number position of the capture group is obtained through the previous level of this number, and it is split accordingly.
[0112] The initial numbering file is at the same or lower level than the current level. The content sequence numbers are compared one by one after splitting (e.g., capture group 1.2.1, split into 1, 2, 1). If there is continuity, it is inserted after this capture group number; otherwise, it is discarded. If the number is higher than the current number, it is compared with the next level after the current number, and inserted consecutively; otherwise, it is discarded. Next, the clause titles in the numbering are modified. The final capture group numbering file is obtained, and a positive assertion (?=\n|。|$) is introduced to explicitly limit the termination condition of the title text to "newline", "period", or "end of document". This effectively avoids including redundant information such as the beginning of the body text after the title, irrelevant punctuation marks (such as commas and semicolons), and annotation content in the title recognition scope, improving the accuracy of numbering and title extraction.
[0113] Document parsing and display results: Simultaneously create canvas and SVG page elements, convert the uploaded PDF file to a file stream format, obtain the PDF page numbers using the pdfjs-dist tool, iterate through the page numbers, and display the original PDF document on the page using the canvas. Obtain the content coordinates after parsing by the document parsing logic, and use the SVG's polygon tool to select the content. Call the browser API element retrieval tool to obtain the DOM width and height of the document display page, calculate the canvas width and height, divide the DOM width by the canvas width to obtain the scaling ratio, and scale the canvas and SVG according to the scaling ratio. Differentiate the frames based on the displayed content: blue frames (#096dd9) for displaying text content, yellow frames (#ffc069) for displaying images, and green frames (#389e0d) for displaying tables. Figure 6 As shown.
[0114] (4) Markdown processing module, used to perform operations such as adding, modifying, and deleting content after file parsing, and configured with three function options: "Export Markdown", "Export Results", and "Save Edits" to complete the export and storage of modified content. The module includes a content display unit, a Markdown processing unit, and table, formula, and image processing units, such as... Figure 4 As shown, where:
[0115] (a) Content Display Unit: This unit removes the original document's homepage, table of contents, preface, etc., and renders the content directly from the main text. To ensure the rendered result maintains the same structure as the original PDF document, a one-to-one correspondence between each line of content is required. First, basic parsing data is obtained from the document parsing logic module. The data is categorized into five types: image, table, inline_equation, interline_equation, and text. Image, table, and interline_equation can be stored independently within the document. Inline_equation and text appear synchronously; that is, text contains inline_equation and needs to be merged. The processed content is then processed using the same file directory generation logic, marking the directory and hierarchy. The content is then displayed sequentially, with lines containing inline_equation or interline_equation requiring the use of the mathjax-full tool for display.
[0116] (b) The Markdown processing unit consists of a heading formatting component, a paragraph operation component, and a text paragraph editing component. The heading formatting component is used to switch the highlighting status of headings according to hierarchical conditions. The paragraph operation component is used to perform merge or split operations on the marked target paragraphs. The text paragraph editing component is used to automatically identify the number in the heading and classify the table of contents and clause items according to whether the content contains punctuation marks.
[0117] Specifically:
[0118] (b1) A title formatting component is used to bold the marked titles and configure a set of marker control components. The triggering operation of these marker control components allows for switching the title's highlighting state based on hierarchical conditions. The system interface is as follows: Figure 7 As shown;
[0119] (b2) Paragraph manipulation components are used to embed independent radio buttons (such as checkboxes) before each paragraph, forming a one-to-one binding relationship between paragraphs and selectors. The target paragraph is marked by the control's state (selected / unselected), achieving: atomic-level selection: supporting single-paragraph and multi-paragraph cross-region selection, breaking through the limitations of traditional "continuous drag-and-drop selection" (e.g., skipping intermediate paragraphs to select paragraphs 1 and 5); the merging component aggregates the text content and formatting information of selected paragraphs into a single paragraph; the splitting component splits a single paragraph into multiple paragraphs based on user-specified separators, automatically inheriting the original paragraph format; balancing "preserving individual formatting" and "overall consistency," avoiding the cost of secondary formatting adjustments. The system interface is as follows: Figure 8 As shown;
[0120] At this point, a set of text paragraph editing components automatically recognizes the numbering in the title (such as numerical code, appendix number), and intelligently categorizes the "Table of Contents" and "Article Items" based on whether the content contains punctuation marks. The system interface is as follows: Figure 9 As shown, this text paragraph editing component is suitable for scenarios such as document structuring and content retrieval. It overcomes the limitations of traditional single-format matching by using a three-layer progressive regular expression matching method to cover four mainstream heading number formats, achieving full-scenario number extraction.
[0121] For numeric codes (such as "1.1" and "2.3.4"): match hierarchical codes consisting of numbers and decimal points, accurately separate the "initial numeric code" from the "subsequent text", and do not match combinations of "number + full-width right bracket" (e.g., refuse to match "1.2.3)xxx", but match "1.2.3xxx" and "1.2xxx", etc.).
[0122] Appendix subheading numbering (e.g., “A.1”, “B.2.3”): Matches appendix subheadings in “letter + number hierarchy” format, automatically processing and unifying the numbering format (e.g., extracting “A.1” directly as a standard number).
[0123] Appendix main title number (e.g., "Appendix A" "Appendix B"): Matches main titles with the prefix "Appendix", and supports any space between the number and "Appendix" (e.g., "Appendix A" is automatically converted to "Appendix A").
[0124] Unnumbered headings: Headings that do not match the above format are automatically marked as "No table of contents number" to ensure that all headings can be structured.
[0125] (b3) Edit trigger component, used to enter the text paragraph modification mode through the trigger operation of the edit trigger component. This mode supports modification of the following five items:
[0126] Clause Number: Supports editing of numbering in formats such as "1, 2, 1.1, 2.1, 1.1.1"; Clause number is the core basis for judging the text paragraph title attribute. By modifying the clause number and adjusting the selection parameters of the subordinate directory and directory coordinates, the synchronous update of the PDF original document's directory display unit can be triggered.
[0127] Subordinate directory: Supports adjusting parameters for the directory level to which a paragraph belongs;
[0128] Table of Contents Coordinates: Supports editing the coordinate parameters of paragraphs at their corresponding positions in the table of contents;
[0129] Clause Title: Supports modification of subsequent related content (such as "Scope" text) for clause numbers;
[0130] The terms require: support for editing core content sections that are not part of the title attribute.
[0131] (c) Table, formula, and image processing unit, used to process the table content, formula data, and image resources obtained after parsing the PDF file through the content list display component and display them in list form, and to optimize the content display effect through the clarity display component;
[0132] Technical Implementation Taking Table Processing Unit as an Example
[0133] The table processing unit is configured with a table data extraction component, a table list rendering component, and a table operation component:
[0134] Table data extraction component: Extracts structured table data from parsed file data;
[0135] Table list rendering component: renders and displays the extracted table data in list format;
[0136] Table manipulation component: Supports operations such as adding, modifying, and deleting table data, and synchronously updates the list display content after the operation command is triggered;
[0137] In a further embodiment, the tagging processing module may also include:
[0138] (d) Metadata processing unit, a dedicated processing unit for documents including national standards and regulations, is configured with metadata extraction and metadata editing components. It is used to extract and modify relevant metadata information from the parsed content of documents including national standards and regulations. Its technical execution flow includes:
[0139] The metadata extraction component scans the parsed content of the file to identify and extract relevant metadata information, including national standards and regulations. Then, the metadata editing component is used to modify the parameters of the extracted metadata information. After the modification is completed, the data is stored through the "Save Edits" function.
[0140] In summary, this application uses MinerU preprocessing to identify PDF types (text / layer / scanned), calls corresponding models such as LayoutLMv3 and PaddleOCR to accurately extract content, and restores the text structure and position through post-processing such as "block-level order determination" and "coordinate repair". It also supports customized operations such as "atomic-level paragraph selection", "clause number editing" and "national standard metadata extraction", and achieves iterative traceability with "complete version history", effectively solving the problems of "inaccurate parsing, low editing efficiency and poor professional adaptation" of traditional tools.
[0141] Compared to traditional tools, it offers comprehensive improvements in accuracy, efficiency, and flexibility: Multiple PDF document types are accurately parsed using corresponding models; for example, LayoutLMv3 is used to identify images and tables in text-based PDFs, improving accuracy by approximately 30% compared to traditional OCR. Complex document layouts are restored using "layout analysis" and "reading order sorting" to reconstruct the logical structure of "title-paragraph-table," solving problems like "paragraph breakage" found in traditional tools. Version management features use metadata such as "upload time" and "modifier" for iterative tracking, avoiding the problem of "unrecoverable accidental modifications." Editing functions support "single / multiple paragraph cross-region selection" and "atomic-level modification," reducing secondary formatting costs by approximately 40%. For professional documents (such as national standards and regulations), "metadata extraction components" and "three-layer progressive regular expression matching" enable efficient and accurate identification of clause levels and numbers under high frame rate rendering conditions, solving the problem of "difficult clause level identification" in traditional tools. This is particularly suitable for processing complex documents such as academic papers and national standards and regulations, demonstrating significant practical value and promotional significance.
[0142] On the other hand, the present invention also discloses a high frame rate rendering parsing and editing device for PDF documents, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor performs the steps of the method described above.
[0143] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute the method in any of the PDF document high frame rate rendering parsing and editing systems described in the above embodiments.
[0144] It is understood that the system provided in the embodiments of the present invention corresponds to the method provided in the embodiments of the present invention, and the explanation, examples and beneficial effects of the relevant content can be referred to the corresponding parts of the above methods.
[0145] This application also provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, communication interface, and memory communicate with each other via the communication bus.
[0146] Memory, used to store computer programs;
[0147] The processor, when executing a program stored in memory, implements the method described above in the high frame rate rendering parsing and editing system for PDF documents.
[0148] The communication bus mentioned in the above-mentioned electronic devices can be a standard bus for interconnecting peripheral components or an extended industrial standard structure bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc.
[0149] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0150] The memory may include random access memory or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0151] The processors mentioned above can be general-purpose processors, including central processing units, network processors, etc.; they can also be digital signal processors, application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0152] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0153] Furthermore, it should be noted that if any directional indication (such as up, down, left, right, front, back, etc.) is involved in the embodiments of the present invention, the directional indication is only used to explain the relative positional relationship and movement of each component in a specific posture. If the specific posture changes, the directional indication will also change accordingly.
[0154] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the meaning of "and / or" throughout the text includes three parallel solutions; for example, "A and / or B" includes solution A, solution B, or a solution where both A and B are satisfied simultaneously. Furthermore, in the embodiments of this invention, "multiple" refers to two or more. Moreover, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
Claims
1. A high frame rate rendering and parsing editing system for PDF documents, characterized in that, include: The file list upload module is used to upload PDF files and display a version history list and file version information; The document parsing logic module is used to read document information and parse the document. Then, the data obtained from the model parsing is input into the processing pipeline to determine the block-level order, delete useless elements, and sort and assemble the content according to the layout. The PDF original document display module performs the following operations in sequence for uploaded files: displaying the PDF file title, cropping the file display page, generating the file directory, and displaying the document parsing results. During the file directory generation operation, the multi-level numerical number of the document is captured, and the number type is classified according to the matching results of different capture groups in the regular expression. Then, the numbering is processed according to the specified level mapping rules to finally obtain the file directory number. The specific operation process for generating the directory includes: The marked component is used to identify the native "#" identifier of the markdown file to determine the heading level of the directory, obtain the clause number and clause title of the file directory, and assign a unique ID to it according to the order of acquisition. The initial clause number file is obtained through its operation. The document is captured by three capture groups: Chinese and English matching, English abbreviation or abbreviation matching, and multi-level numbering. Based on the matching results of different capture groups in the regular expression, the number type is automatically classified. At the same time, a unified hierarchical mapping rule is established, and the appendix number is mapped to the highest level by default. The letter number and the number number are strictly mapped according to the rule of the total number of levels minus one. To address common irregularities in numbering, such as extra spaces, mixed uppercase and lowercase letters, and skipped number levels, the preprocessing stage eliminates the impact of format deviations on the parsing results, resulting in the final capture group number file. Compare the captured group number files with the initial number files one by one: For content with the same number, map the ID of the initial number file to the capture group number file corresponding to the number; For content with inconsistent numbers, if the capture group number file exists but the initial number file does not exist, the capture group number is directly retained; otherwise, the current initial file number is split and its level is calculated independently. Then, the position of the number file corresponding to the capture group is obtained through the previous level of this initial file number, and the capture group file number is split accordingly. If the initial number file level is the same as or lower than the current level, the content sequence numbers after splitting are compared one by one. If the initial number file level is continuous, it is inserted after this capture group number; otherwise, it is discarded. If the initial number file level is higher than the current number, the next level of the current capture group number is obtained, and this level is compared with the initial number file level to determine its continuity. If the continuity condition is met, it is inserted into the capture group; otherwise, it is discarded. Modify the content of the clause title in the numbering to obtain the final capture group number file. Introduce a positive assertion in which the clause title content is immediately followed by a newline character, a separator, or a period, with the period being the last character of the text, to explicitly limit the termination condition of the title text to a newline, a period, or the end of the document.
2. The PDF document high frame rate rendering parsing and editing system as described in claim 1, characterized in that, Before processing PDF documents, the document parsing logic module first reads the PDF's metadata information through MinerU to identify its type, including text-based, layered, or scanned PDFs, and then performs corresponding preprocessing. For the parsing processing operations of the document parsing logic module: Text-based and layer-based documents use deep learning-based models, including LayoutLMv3, to perform region detection, identify different regions in the document, including images, tables, titles, and text, and locate the positions of different elements in the document. For scanned PDFs, OCR technologies, including PaddleOCR, are used to recognize the text content in the document.
3. The PDF document high frame rate rendering parsing and editing system as described in claim 1, characterized in that, The specific operation process for cropping the document display page includes: After performing OCR recognition on the document content, it is cropped to obtain a preliminary file display page. Then, the browser API element acquisition tool is called to obtain the DOM of the page where the current PDF document is located. The html2canvas conversion script tool renders DOM elements into a canvas. By specifying movement events, the clipping box can be dragged, scaled, and rotated on the canvas, and the position and size of the clipping box can be calculated in real time. Then, the captured pixel data is drawn onto a new set of Canvas, and converted into a Base64 format image URL using the toDataURL() method; Finally, the Markdown content is extracted according to the document parsing logic.
4. The PDF document high frame rate rendering parsing and editing system as described in claim 3, characterized in that, The specific operation process for displaying the document parsing results includes: Simultaneously create canvas and SVG page elements, convert the uploaded PDF file into a file stream format, obtain the page numbers of the PDF file using the pdfjs-dist tool, traverse the page numbers, and combine the canvas to display the original PDF document on the page; Obtain the coordinates of the content after parsing the document using the parsing logic, and then use the polygon tool in SVG to select the content. The browser API element retrieval tool is used to obtain the DOM width and height of the document display page, calculate the canvas width and height, divide the DOM width by the canvas width to get the scaling ratio, and then scale the canvas and SVG according to the scaling ratio. The frames are differentiated by color based on the content being displayed: blue frames are used to display document text content, yellow frames are used to display document image content, and green frames are used to display document table content.
5. The PDF document high frame rate rendering parsing and editing system as described in claim 1, characterized in that, It also includes a markup processing module, used to perform addition, modification, and deletion operations on the parsed content of the file, and to export and store the modified content. The markup processing module includes a content display unit and a Markdown processing unit, wherein: The content display unit is used to remove the original document's homepage, table of contents, and preface, and directly render the content starting from the main text. The rendered content is then combined with the file directory generation logic to mark the directory and hierarchy, and the content is displayed in the order of appearance. The Markdown processing unit consists of a heading formatting component, a paragraph operation component, and a text paragraph editing component. The heading formatting component is used to switch the highlighting status of headings according to hierarchical conditions. The paragraph operation component is used to perform merging or splitting operations on the marked target paragraphs. The text paragraph editing component is used to automatically identify the number in the heading and classify the table of contents and clause items according to whether the content contains punctuation marks. The table, formula, and image processing unit is used to process the table content, formula data, and image resources obtained after parsing the PDF file and display them in list form. The content display effect is optimized through the clarity display component.
6. The PDF document high frame rate rendering parsing and editing system as described in claim 5, characterized in that, During the rendering process, the content display unit obtains basic parsing data from the document parsing logic module and divides the data into five categories according to type: image, table, inline_equation, block-level_equation, and text. Among them, image, table, and inline_equation are stored independently in the text, while inline_equation and text are stored together when they appear simultaneously.
7. The PDF document high frame rate rendering parsing and editing system as described in claim 5, characterized in that, The specific operation process of the paragraph manipulation component to perform merging or splitting operations on the marked target paragraphs includes: Embed an independent radio button before each paragraph to form a binding relationship between the paragraph and the selector; By marking the target paragraph with the control's state, atomic-level support for single-paragraph and multi-paragraph cross-region selection is achieved; The selected paragraphs' text content and formatting information are aggregated into a single paragraph using a set of merging components; A single paragraph can be split into multiple paragraphs based on user-specified delimiters using a set of splitting components, while automatically inheriting the original paragraph format.
8. The PDF document high frame rate rendering parsing and editing system as described in claim 5, characterized in that, The text paragraph editing component implements the specific operation of categorizing table of contents and clause items by using three-level progressive regular expression matching to extract the following title numbering format across all scenarios: Numbering: Matches hierarchical numbers consisting of numbers and decimal points, separates the initial numbering from the subsequent text, and does not match combinations of numbers and full-width right brackets; Appendix subheading numbering: Matches appendix subheadings with a combination of letters and numbers, and automatically processes and standardizes the numbering format; Appendix main title number: Matches main titles with the appendix prefix; Unnumbered headings: Headings that do not match the above format are automatically marked as having no table of contents number.
9. A PDF document high frame rate rendering parsing and editing device, characterized in that, The system includes a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform internal operating method steps based on the PDF document high frame rate rendering parsing and editing system as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Document processing method and system and related equipment
CN116992855A
PDF extraction method and system based on deep learning and layout analysis
CN119598971A
Document layout reconstruction method, device and system and storage medium
CN119962479A