Bookmark directory generation method and device and electronic equipment
By analyzing the PDF document structure, identifying the title and generating bookmarks, the cumbersome problem of manually adding directories is solved, and the search efficiency is improved.
Patent Information
- Application Number
- CN202410931382.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-08
AI Technical Summary
In the prior art, users need to manually add a bookmark directory of PDF documents, which is complicated and error-prone, resulting in inefficient efficiency in finding specific content.
By analyzing the structure information of the PDF document, identifying the title and automatically generating a bookmark directory, including a full text analysis of the title style level, traversing paragraph judgment, generating an outline and simplifying it, eliminating misjudgment elements, and finally adding the bookmark directory to the PDF document.
It realizes automatic generation of accurate bookmark directories, improves users' efficiency in browsing and searching PDF documents, and solves the cumbersome and errors of manually adding directories.
Smart Images

Figure CN118917279A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of document processing technology, and in particular, to a method, device, and electronic device for generating a bookmark directory. Background Art
[0002] PDF (Portable Document Format) is a commonly used electronic document format with the advantages of being cross-platform, easy to spread and protecting content. PDF files can encapsulate text, fonts, formats, colors, and graphics and images that are independent of equipment and resolution in one file. This format file can also contain electronic information such as hypertext links, sounds and dynamic images, and this format supports special-length files, with high integration and security reliability.
[0003] For longer PDF documents, if there is no bookmark directory navigation, users often need to spend more time to find specific content. PDF bookmarks are a function used to mark and navigate the content of PDF documents. It can help users quickly locate specific chapters, titles or other important content in the document. Through bookmarks, users can easily browse and find the content of PDF documents, improving reading and use efficiency. The same is true for PDF document directories. In mainstream PDF software products, adding a directory to a PDF document usually requires users to add it manually, which is cumbersome, time-consuming and labor-intensive. Summary of the invention
[0004] In view of the problems existing in the above-mentioned prior art, the embodiments of the present application provide a method, device, and electronic device for generating a bookmark directory, which can automatically generate a relatively accurate bookmark directory to improve the efficiency of users when browsing and searching for PDF document content.
[0005] In a first aspect, an embodiment of the present application provides a method for generating a bookmark directory, comprising:
[0006] Parsing structural information of the PDF document and identifying the title of the PDF document;
[0007] Automatically generate a bookmark directory for the PDF document based on the identified title of the PDF document; and
[0008] The generated bookmark directory is added to the PDF document.
[0009] Furthermore, the parsing of the structural information of the PDF document and identifying the title of the PDF document includes:
[0010] The title style level of the PDF document is fully analyzed to identify the title of the PDF document.
[0011] Furthermore, the step of automatically generating a bookmark directory of the PDF document according to the identified title of the PDF document comprises:
[0012] Traverse and obtain the paragraphs of the PDF document;
[0013] Determine whether the paragraph is the title; and
[0014] According to the judgment result, a bookmark directory of the PDF document is automatically generated.
[0015] Furthermore, before automatically generating the bookmark directory of the PDF document according to the judgment result, the method further includes:
[0016] According to the judgment result, an outline of the PDF document is automatically generated.
[0017] Furthermore, after automatically generating the outline of the PDF document according to the judgment result, the method further includes:
[0018] The outline of the PDF document is screened and simplified.
[0019] Furthermore, the outline of the PDF document includes a bookmark tree and / or a directory page.
[0020] Furthermore, after determining whether the paragraph is the title, the method further includes:
[0021] Make a secondary judgment to eliminate elements of misjudgment.
[0022] In a second aspect, the embodiment of the present application further provides a bookmark directory generating device, including:
[0023] A structure parsing module, used to parse the structure information of the PDF document and identify the title of the PDF document;
[0024] a directory generation module, configured to automatically generate a bookmark directory for the PDF document according to the identified title of the PDF document; and
[0025] The directory adding module is used to add the generated bookmark directory into the PDF document.
[0026] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is configured to implement the method for generating a bookmark directory according to the first aspect when executing the program.
[0027] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, wherein the computer program is used to implement the method for generating a bookmark directory according to the first aspect above.
[0028] In a fifth aspect, an embodiment of the present application further provides a computer program product on which a computer program is stored, wherein the computer program is used to implement the method for generating a bookmark directory according to the first aspect above.
[0029] The embodiments of the present application bring the following beneficial effects:
[0030] The method for generating a bookmark directory provided in the embodiment of the present application parses the structural information of a PDF document, identifies the title of the PDF document, and automatically generates a bookmark directory for the PDF document according to the identified title of the PDF document, and finally adds the generated bookmark directory to the PDF document. This method can solve the problem of being cumbersome and error-prone in manually adding a bookmark directory for a PDF document, thereby automatically generating a relatively accurate bookmark directory to improve the efficiency of users in browsing and searching for PDF document content. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0032] Figure 1 A flowchart of a method for generating a bookmark directory provided in an embodiment of the present application;
[0033] Figure 2 A structural block diagram of a bookmark directory generating device provided in an embodiment of the present application;
[0034] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0035] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments described in the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0037] In the specification and claims of this application and the above-mentioned drawings, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "multiple" means two or more. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to the specific circumstances.
[0038] Figure 1 FIG. 1 is a flow chart of a method for generating a bookmark directory according to an embodiment of the present application. Figure 1 As shown, the method for generating a bookmark directory in an embodiment of the present application includes the following steps:
[0039] S101: parsing structural information of the PDF document;
[0040] Specifically, PDF documents are a commonly used electronic document format with advantages such as cross-platform, easy dissemination and content protection. PDF files can encapsulate text, fonts, formats, colors, and graphics and images independent of devices and resolutions in one file. The structural information of PDF documents includes titles and chapters.
[0041] Parse the structural information of the PDF document, that is, count the font forms in each paragraph of the PDF document and perform statistical analysis. Preliminarily filter out the styles with high level and small stock as the styles that may be the document title.
[0042] If the paragraph is not empty, the paragraph style conforms to the title style, the paragraph is not too long, the number of lines is not too many, and the style level of the next adjacent paragraph is lower than that of the current paragraph, then the current paragraph is identified as a "title" and added to the title candidate list. Note that if the styles of adjacent paragraphs are the same, the adjacent paragraphs should be considered as a whole to perform the above conditional judgment.
[0043] S102: Automatically generate a bookmark directory of the PDF document according to the identified title of the PDF document;
[0044] Specifically, the bookmark directory is a navigation page of a PDF document, which can help quickly locate the content in a PDF document. When the title of the PDF document is recognized, the bookmark directory of the PDF document will be automatically generated, thereby facilitating users to quickly locate a specific location in the document according to the bookmark directory.
[0045] S103: Add the generated bookmark directory to the PDF document.
[0046] That is, after the bookmark directory is automatically generated, it is necessary to add the generated bookmark directory to the PDF document, and the specific placement of the bookmark directory depends on user needs.
[0047] Therefore, the method for generating a bookmark directory provided in the embodiment of the present application parses the structural information of a PDF document, identifies the title of the PDF document, and automatically generates a bookmark directory for the PDF document based on the identified title of the PDF document, and finally adds the generated bookmark directory to the PDF document. This can solve the problem of being cumbersome and error-prone in manually adding a bookmark directory for a PDF document, thereby automatically generating a more accurate bookmark tree or directory page to improve the efficiency of users when browsing and searching for PDF document content.
[0048] Furthermore, in some embodiments of the present application, parsing the structural information of the PDF document and identifying the title of the PDF document includes:
[0049] The title style level of the PDF document is fully analyzed to identify the title of the PDF document.
[0050] That is, the PDF document is encapsulated in a specific format. For PDF documents that comply with typesetting specifications, the hierarchy of title styles usually follows a pyramid structure, that is, the larger the font size, the higher the level. The first-level title has the largest font size, followed by the second-level title. If the font sizes are the same, the style level with features such as bold, italic, and centered is higher. Therefore, the method for generating a bookmark directory provided in an embodiment of the present application can analyze the title style hierarchy of the PDF document through the full text, identify the title of the PDF document, and thus automatically generate a bookmark directory for the PDF document, and finally add the generated bookmark directory to the PDF document, which can solve the cumbersome and error-prone problem of manually adding a bookmark directory for a PDF document, thereby automatically generating a more accurate bookmark tree or directory page to improve the efficiency of users when browsing and searching for PDF document content.
[0051] It should be noted that when conducting full text analysis, bullet points, numbers, and text semantic analysis can be combined to improve the accuracy of title recognition. At the same time, document structure recognition technology (such as table and chart recognition technology) can be combined to exclude table and chart elements to improve parsing accuracy.
[0052] Furthermore, in some embodiments of the present application, automatically generating a bookmark directory of the PDF document according to the identified title of the PDF document includes:
[0053] Traverse and obtain the paragraphs of the PDF document;
[0054] Determine whether the paragraph is the title; and
[0055] According to the determination result, a bookmark directory of the PDF document is generated.
[0056] Specifically, PDF documents are packaged in a specific format. For PDF documents that comply with typesetting specifications, the hierarchy of title styles usually follows a pyramid structure, that is, the larger the font size, the higher the level. The first-level title has the largest font size, followed by the second-level title. If the font size is the same, the style with features such as bold, italic, and centered will have a higher level.
[0057] The method for generating a bookmark directory provided in the embodiment of the present application can analyze the title style hierarchy of the PDF document through the full text, that is, traverse and obtain the paragraphs of the PDF document, identify the title of the PDF document, thereby automatically generating a bookmark directory for the PDF document, and finally adding the generated bookmark directory to the PDF document, which can solve the problem of being cumbersome and error-prone to manually adding a bookmark directory for a PDF document, thereby automatically generating a more accurate bookmark tree or directory page, so as to improve the efficiency of users in browsing and searching for PDF document content.
[0058] Furthermore, in some embodiments of the present application, before generating the bookmark directory of the PDF document according to the judgment result, the method further includes:
[0059] According to the determination result, an outline of the PDF document is generated.
[0060] That is, the outline of the PDF document is also the preliminary style of the bookmark directory of the PDF document. Before generating the bookmark directory of the PDF document, the outline of the PDF document needs to be generated to provide a template for the formation of the bookmark directory, thereby ensuring the accuracy of the bookmark directory.
[0061] Furthermore, in some embodiments of the present application, after generating the outline of the PDF document according to the judgment result, the method further includes:
[0062] The outline of the PDF document is screened and simplified.
[0063] Specifically, the document outline in which the candidate titles are organized into a tree structure follows the principles of order priority (sorted by page number and position) and clear hierarchy (the style level of the sub-node bookmark title is generally lower). And the generated document outline needs to be screened. If it is considered that the number of titles is too large, it can be streamlined by reducing the hierarchy, and then the corresponding bookmark tree or directory page is generated, and the jump position is specified as the paragraph position of the corresponding title, so as to provide a template for the formation of the bookmark directory, thereby ensuring the accuracy of the bookmark directory.
[0064] Furthermore, in some embodiments of the present application, the outline of the PDF document includes a bookmark tree and / or a directory page.
[0065] As described above, the streamlined PDF document outline includes a bookmark tree and / or a directory page, and the jump position is specified as the paragraph position where the corresponding title is located, thereby providing a template for the formation of the bookmark directory, thereby ensuring the accuracy of the bookmark directory.
[0066] Furthermore, in some embodiments of the present application, after determining whether the paragraph is the title, the method further includes:
[0067] Make a secondary judgment to eliminate elements of misjudgment.
[0068] Specifically, when traversing the full text of a PDF document, the accuracy of title recognition can be improved by combining bullet points, numbering, and text semantic analysis. At the same time, the document structure recognition technology (such as table and chart recognition technology) can be combined to exclude table and chart elements to improve parsing accuracy. After traversing the full text, "titles" with similar page positions and sizes (such as header and footer positions) and similar contents can be considered as headers, footers, watermarks, and other non-valid document title content, and excluded from the title candidate list to improve parsing accuracy.
[0069] That is, after determining whether the paragraph is the title, the method further includes: performing a secondary determination to exclude misjudged elements, such as excluding diagrams and tables, headers and footers, etc., so as to further improve the accuracy of the bookmark directory of the generated PDF document.
[0070] Figure 2 2 is a structural block diagram of the bookmark directory generating device 200 of the embodiment of the present application. Figure 2 As shown, the bookmark directory generating device 200 of the embodiment of the present application includes: a structure parsing module 210, a directory generating module 220 and a directory adding module 230, wherein:
[0071] The structure analysis module 210 is used to analyze the structure information of the PDF document and identify the title of the PDF document;
[0072] A directory generating module 220, configured to automatically generate a bookmark directory for the PDF document according to the identified title of the PDF document; and
[0073] The directory adding module 230 is used to add the generated bookmark directory to the PDF document.
[0074] The bookmark directory generating device provided in the embodiment of the present application parses the structural information of the PDF document, identifies the title of the PDF document, and automatically generates a bookmark directory for the PDF document according to the identified title of the PDF document, and finally adds the generated bookmark directory to the PDF document, which can solve the problem of tedious and error-prone manual addition of the bookmark directory of the PDF document, thereby automatically generating a more accurate bookmark tree or directory page, so as to improve the efficiency of users in browsing and searching for PDF document content.
[0075] It should be noted that the specific implementation of the bookmark directory generation device of the embodiment of the present application is similar to the specific implementation of the bookmark directory generation method of the embodiment of the present application. Please refer to the description of the method part for details, and no further details will be given here.
[0076] Figure 3 Schematic diagram of the structure of an electronic device 300 according to an embodiment of the present application.
[0077] like Figure 3 As shown, the electronic device 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from the storage part 302 to a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The CPU 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0078] The following components are connected to the I / O interface 305: an input section 306 including a keyboard, a mouse, etc.; an output section 307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed, so that a computer program read therefrom is installed into the storage section 308 as needed.
[0079] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a machine-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 309, and / or installed from a removable medium 311. When the computer program is executed by a central processing unit (CPU) 301, the above-mentioned functions defined in the electronic device of the present application are executed.
[0080] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electronic device, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0081] In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction-executing electronic device, apparatus, or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction-executing electronic device, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0082] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the processing receiving device, method and computer program product according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the aforementioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based electronic device that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0083] The units or modules involved in the embodiments of the present application may be implemented by software or hardware. The units or modules described may also be set in a processor, and the processor is used to implement the method for generating a bookmark directory when executing the program:
[0084] Parsing structural information of the PDF document and identifying the title of the PDF document;
[0085] Automatically generate a bookmark directory for the PDF document based on the identified title of the PDF document; and
[0086] The generated bookmark directory is added to the PDF document.
[0087] As another aspect, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiment; or may exist independently and not be installed in the electronic device. The above computer-readable storage medium stores one or more programs, and when the above programs are used by one or more processors to execute the method for generating a bookmark directory described in the present application:
[0088] Parsing structural information of the PDF document and identifying the title of the PDF document;
[0089] Automatically generate a bookmark directory for the PDF document based on the identified title of the PDF document; and
[0090] The generated bookmark directory is added to the PDF document.
[0091] As another aspect, the present application further provides a computer program product, which may be included in the electronic device described in the above embodiment; or may exist independently without being installed in the electronic device. The above computer program product stores one or more programs, and when the above programs are used by one or more processors to execute the method for generating a bookmark directory described in the present application:
[0092] Parsing structural information of the PDF document and identifying the title of the PDF document;
[0093] Automatically generate a bookmark directory for the PDF document based on the identified title of the PDF document; and
[0094] The generated bookmark directory is added to the PDF document.
[0095] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. All equivalent structural changes made by using the contents of the present application specification and drawings under the application concept of the present application, or directly / indirectly used in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for generating a bookmark directory, characterized in that: include: Parsing structural information of the PDF document and identifying the title of the PDF document; Automatically generate a bookmark directory for the PDF document according to the identified title of the PDF document; and The generated bookmark directory is added to the PDF document.
2. The method for generating a bookmark directory according to claim 1, characterized in that: The parsing of the structural information of the PDF document and identifying the title of the PDF document includes: The title style level of the PDF document is fully analyzed to identify the title of the PDF document.
3. The method for generating a bookmark directory according to claim 2, characterized in that: The step of automatically generating a bookmark directory of the PDF document according to the identified title of the PDF document comprises: Traverse and obtain the paragraphs of the PDF document; Determine whether the paragraph is the title; and According to the judgment result, a bookmark directory of the PDF document is automatically generated.
4. The method for generating a bookmark directory according to claim 3, characterized in that: Before automatically generating the bookmark directory of the PDF document according to the judgment result, the method further includes: According to the judgment result, an outline of the PDF document is automatically generated.
5. The method for generating a bookmark directory according to claim 4, characterized in that: After automatically generating the outline of the PDF document according to the judgment result, the method further includes: The outline of the PDF document is screened and simplified.
6. The method for generating a bookmark directory according to claim 5, characterized in that: The outline of the PDF document includes a bookmark tree and / or a table of contents page.
7. The method for generating a bookmark directory according to claim 3, characterized in that: After determining whether the paragraph is the title, the method further includes: Make a secondary judgment to eliminate elements of misjudgment.
8. A bookmark directory generating device, characterized in that: include: A structure parsing module, used to parse the structure information of the PDF document and identify the title of the PDF document; A directory generation module, used to automatically generate a bookmark directory of the PDF document according to the identified title of the PDF document; and The directory adding module is used to add the generated bookmark directory into the PDF document.
9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor is used to implement the method for generating a bookmark directory according to any one of claims 1 to 7 when executing the program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to implement the method for generating a bookmark directory according to any one of claims 1 to 7.
Citation Information
Cited By
PDF (Portable Document Format) file browsing method based on image compression and rapid decompression technology
CN120123296A
