PDF (Portable Document Format) file directory bookmark generation method and device

By identifying and processing the directory page text fields and printed page numbers in PDF electronic files, the problem that the existing technology cannot effectively reconstruct the PDF file directory bookmarks is solved, and more accurate and efficient directory bookmark generation is achieved, improving the readability of PDF files.

CN119538866APending Publication Date: 2025-02-28SHANGHAI INVESTIGATION DESIGN & RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411591317.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-08
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

The prior art cannot effectively reconstruct the directory bookmarks in PDF files converted from paper files, resulting in poor readability of PDF files.

Method used

By identifying the directory page in the PDF electronic file, the text fields and printed page numbers in the directory page text are extracted, and the electronic file page numbers are determined based on this information, and then the accurate PDF file directory bookmark is combined.

Benefits of technology

It improves the efficiency of the generation of PDF file directory bookmarks, allowing users to quickly locate chapters and understand the document structure, and enhances the reading experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119538866A_ABST
    Figure CN119538866A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of document data processing, and discloses a PDF file directory bookmark generation method and device, and the method comprises the steps: obtaining a PDF electronic file, recognizing a directory page in the PDF electronic file, and obtaining directory page characters; extracting character fields in the directory page characters, and performing identification grading on the character fields to obtain character fields after combination processing; extracting a printing page number in the directory page characters, and determining an electronic file page number based on the printing page number; and combining the character field, the printing page number and the electronic file page number after combination processing to obtain the PDF file directory bookmark. According to the method and the device, reconstruction of the PDF file directory bookmark is realized, rapid positioning of chapters and sections and understanding of a document structure can be realized by utilizing the PDF file directory bookmark, and the reading experience is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of document data processing, and in particular to a method and device for generating a PDF file directory bookmark. Background Art

[0002] PDF (Portable Document Format) files are widely used, such as various books and manuals. When reading the contents of a PDF file, the directory bookmarks of the PDF file can quickly locate specific chapters, understand the document structure, and enhance the reading experience.

[0003] PDF files have the following two major characteristics: they are scanned from paper documents; the paper documents themselves have a directory page, which already contains very accurate directory information; however, the relevant PDF directory generator cannot reconstruct the directory bookmarks in the PDF file based on the two major characteristics of the PDF file, resulting in poor readability of the PDF file converted from the paper document. Summary of the invention

[0004] In view of this, the present invention provides a method and device for generating directory bookmarks for a PDF file, so as to solve the problem that a related PDF directory generator cannot reconstruct directory bookmarks in a PDF file according to two major features of the PDF file.

[0005] In a first aspect, the present invention provides a method for generating a directory bookmark of a PDF file, the method comprising:

[0006] Obtain a PDF electronic file, identify the catalog page in the PDF electronic file, and obtain the text of the catalog page;

[0007] Extracting text fields from the catalog page text, marking and grading the text fields, and obtaining combined text fields;

[0008] Extract the printed page number from the text on the catalog page, and determine the page number of the electronic file based on the printed page number;

[0009] The combined text fields, printed page numbers and electronic file page numbers are combined to obtain PDF file directory bookmarks.

[0010] The present embodiment provides a method for generating a directory bookmark for a PDF file. The method identifies the directory page in a PDF electronic file to obtain the text of the directory page, extracts the text fields and printed page numbers in the directory page text, and then analyzes and processes the text fields and printed page numbers respectively, and combines the combined text fields, printed page numbers and electronic file page numbers to obtain a PDF file directory bookmark. For a PDF file converted from a scanned paper file, the directory page in the original document is reconstructed using the characteristics of the PDF file itself. The generated PDF file directory bookmark is more accurate, and the efficiency of generating PDF file directory bookmarks is improved. Users can quickly locate chapters and understand the document structure, thereby enhancing the reading experience.

[0011] In an optional implementation, extracting text fields from the catalog page text, marking and grading the text fields, and obtaining the combined text fields include:

[0012] Extract the text fields in the table of contents page, and extract the digital chapter number based on the text fields;

[0013] Grading the digital chapter numbers to get the level of the text fields;

[0014] Based on the level of the text field, a leading space is added before the text field to generate a combined text field.

[0015] The present embodiment provides a method for generating a PDF file directory bookmark, which obtains the level of a text field by grading digital chapter numbers, and then adds a leading space before the text field according to the level of the text field to generate a combined text field, so that the PDF file directory bookmark has a hierarchical structure, which can help users quickly locate specific chapters, understand the document structure, and enhance the reading experience.

[0016] In an optional implementation, the digital chapter numbers are graded to obtain the levels of the text fields, including:

[0017] A judgment function is obtained, the number of periods in the digital chapter number is determined using the judgment function, and the level of the text field is determined based on the number of periods.

[0018] In an optional implementation, extracting the printed page number from the text on the catalog page and determining the page number of the electronic file based on the printed page number includes:

[0019] A preset value is obtained, and the page number of the electronic file is determined based on the printed page number and the preset value.

[0020] In an optional implementation, the combined text field, printed page number and electronic file page number are combined to obtain a PDF file directory bookmark, including:

[0021] Obtaining a directory bookmark text format, and combining the combined text field, the printed page number, and the electronic file page number according to the directory bookmark text format to obtain a combined text;

[0022] Store the combined text as a txt file and create a PDF file directory bookmark based on the txt file.

[0023] The present embodiment provides a PDF file directory bookmark generation method, which stores the combined text formed by the combined text field, printed page number and electronic file page number as a txt file, and then creates a PDF file directory bookmark based on the txt file, thereby realizing the standardized processing of the PDF file directory bookmark format, so that the generated PDF file directory bookmark can be directly applied to the PDF file.

[0024] In an optional implementation, before extracting the text fields in the catalog page text, identifying and grading the text fields, and obtaining the combined text fields, the method further includes:

[0025] Remove impurities from the catalog page text to obtain purified catalog page text.

[0026] The present embodiment provides a method for generating a PDF file directory bookmark, which removes impurities in the text on the directory page, thereby making subsequent processing of text fields and printed page numbers in the PDF file more accurate, thereby achieving accurate reconstruction of the PDF file directory bookmark.

[0027] In a second aspect, the present invention provides a device for generating a directory bookmark of a PDF file, the device comprising:

[0028] The recognition module is used to obtain the PDF electronic file, recognize the catalog page in the PDF electronic file, and obtain the text of the catalog page;

[0029] A classification module is used to extract text fields from the catalog page text, identify and classify the text fields, and obtain the combined text fields;

[0030] A determination module, used to extract the printed page number from the text on the catalog page and determine the page number of the electronic file based on the printed page number;

[0031] The combination module is used to combine the text fields, printed page numbers and electronic file page numbers after combination processing to obtain PDF file directory bookmarks.

[0032] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the PDF file directory bookmark generation method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0033] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the PDF file directory bookmark generation method of the first aspect or any corresponding embodiment thereof.

[0034] In a fifth aspect, the present invention provides a computer program product, including computer instructions, where the computer instructions are used to enable a computer to execute the PDF file directory bookmark generation method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 It is a flowchart of a method for generating a PDF file directory bookmark according to an embodiment of the present invention;

[0037] Figure 2 is a flowchart of another method for generating a PDF file directory bookmark according to an embodiment of the present invention;

[0038] Figure 3 is a flowchart of another method for generating a directory bookmark of a PDF file according to an embodiment of the present invention;

[0039] Figure 4 is a schematic diagram of a scanned catalog page in a PDF electronic file according to an embodiment of the present invention;

[0040] Figure 5 is a flowchart of specific steps of a method for generating a directory bookmark for a PDF file according to an embodiment of the present invention;

[0041] Figure 6 is a schematic diagram of a PDF file directory bookmark according to an embodiment of the present invention;

[0042] Figure 7 is a structural block diagram of a PDF file directory bookmark generation device according to an embodiment of the present invention;

[0043] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0045] Related PDF catalog generation methods include:

[0046] 1) Process the directory chapter data of the editable PDF file, write it using the web page markup language, and then output the directory PDF.

[0047] 2) Obtaining the original text paragraph set of each page of the PDF document; obtaining the current text paragraph set that meets the directory structure characteristics according to the digital queue of each original text paragraph set; converting the current text paragraph set into at least one binary matrix; scanning each binary matrix to obtain a scanning result.

[0048] However, most PDF files have the following two major characteristics: they are scanned from paper documents; the paper documents themselves have a directory page, which already contains very accurate directory information; therefore, the above-mentioned PDF directory generator cannot reconstruct the directory bookmarks in the PDF file based on the two major characteristics of the PDF file. The method involved is relatively complex, requires a certain depth of computer knowledge, and is relatively inconvenient to use.

[0049] To solve the above technical problems, an embodiment of the present invention provides a method for generating a directory bookmark of a PDF file, which increases the readability of a PDF file converted from a paper file by establishing a method for reconstructing a directory bookmark of a PDF file in a relatively simple manner.

[0050] The embodiment of the present invention provides a method for generating a PDF file directory bookmark. It should be noted that the execution subject of the PDF file directory bookmark generation method provided by the embodiment of the present invention can be a device for generating a PDF file directory bookmark. The device for generating a PDF file directory bookmark can be implemented as part or all of an electronic device through software, hardware, or a combination of software and hardware. The electronic device can be a server or a terminal. The server in the embodiment of the present application can be a server or a server cluster composed of multiple servers. The terminal in the embodiment of the present application can be a smart phone, a personal computer, a tablet computer, an intelligent robot, and other intelligent hardware devices. In the following method embodiments, the execution subject is an electronic device as an example for explanation.

[0051] According to an embodiment of the present invention, an embodiment of a method for generating a directory bookmark of a PDF file is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0052] In this embodiment, a method for generating a PDF file directory bookmark is provided, which can be used in the above-mentioned electronic device. Figure 1 is a flowchart of a method for generating a directory bookmark of a PDF file according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0053] Step S101, obtaining a PDF electronic file, identifying a directory page in the PDF electronic file, and obtaining text on the directory page.

[0054] Specifically, a PDF electronic file is a PDF file converted from a paper file and has a catalog page.

[0055] Furthermore, impurities are removed from the catalog page text to obtain purified catalog page text.

[0056] Furthermore, the text on the catalog page is purified to remove strange characters or unnecessary characters generated during the text recognition process.

[0057] Furthermore, text recognition software (such as optical character recognition software OCR, translation camera, etc.) is used to identify the directory page in the PDF electronic file, wherein the spaces in the PDF electronic file may be identified as placeholders. In the commonly used text editor file, all placeholders can be deleted to obtain a text file after preliminary processing; the text file after preliminary processing is pasted into the spreadsheet processing software. The text file is still mixed with impurity characters, such as separators, brackets next to page numbers, etc., so the substitute function (an Excel cell formula function) is used to remove the impurities.

[0058] Furthermore, you can nest substitute to remove multiple impurities. For example, apply the following formula to cell A13:

[0059] =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A11,"·",""),")",""),">","")

[0060] Step S102, extracting text fields from the text on the catalog page, marking and grading the text fields, and obtaining combined text fields.

[0061] Specifically, the text field includes a numerical chapter number and a chapter number with the word "No.".

[0062] Step S103, extracting the printed page number from the text on the catalog page, and determining the electronic file page number based on the printed page number.

[0063] Specifically, the printed page numbers in the text on the catalog page are the printed page numbers in the paper file, not the page numbers in the electronic file. Therefore, the printed page numbers in the text on the catalog page need to be adjusted to obtain the page numbers of the electronic file.

[0064] Step S104, combining the combined text field, printed page number and electronic file page number to obtain a PDF file directory bookmark.

[0065] The present embodiment provides a method for generating a directory bookmark for a PDF file. The method identifies the directory page in a PDF electronic file to obtain the text of the directory page, extracts the text fields and printed page numbers in the directory page text, and then analyzes and processes the text fields and printed page numbers respectively, and combines the combined text fields, printed page numbers and electronic file page numbers to obtain a PDF file directory bookmark. For a PDF file converted from a scanned paper file, the directory page in the original document is reconstructed using the characteristics of the PDF file itself. The generated PDF file directory bookmark is more accurate, and the efficiency of generating PDF file directory bookmarks is improved. Users can quickly locate chapters and understand the document structure, thereby enhancing the reading experience.

[0066] In this embodiment, a method for generating a table of contents bookmark for a PDF file is provided, which can be used in the above-mentioned electronic device. Figure 2 It is a flowchart of a method for generating a table of contents bookmark for a PDF file according to an embodiment of the present invention, as Figure 2 shown, and the process includes the following steps:

[0067] Step S201: Obtain a PDF electronic file, identify the table of contents page in the PDF electronic file, and obtain the text of the table of contents page. For details, please refer to Figure 1 step S101 of the embodiment shown, which will not be elaborated here.

[0068] Step S202: Extract the text fields in the text of the table of contents page, identify and classify the text fields, and obtain the text fields after combined processing.

[0069] Specifically, comprehensively analyze the chapter numbers in the text fields and the chapter numbers with the character "Chapter", add a necessary number of leading spaces, re-establish the text fields, and the re-established text fields are classified according to the number of leading spaces.

[0070] Further, the above step S202 includes:

[0071] Step S2021: Extract the text fields in the text of the table of contents page, and extract the digital chapter numbers based on the text fields.

[0072] Specifically, use the find function (search function) to find the position of two consecutive full stops "..", and use the left function (a computer language term used to return a specified number of characters starting from the first character of a text string) to extract the content from the first position on the left to between the double full stops "..", that is, the text field of each line of the table of contents; for the case where there is only one full stop or no full stop between the text field and the printed page number, if there is only one full stop, directly discard the full stop and the subsequent page number to obtain the text field of each line of the table of contents; if there is no full stop, directly discard the page number to obtain the text field of each line of the table of contents.

[0073] Further, extract the numbers in the text fields. For example, "1.1" in cell C12 or "1.1.1" in cell C13, and use the numbers as the digital chapter numbers.

[0074] Step S2022: Classify the digital chapter numbers to obtain the level of the text fields.

[0075] Specifically, obtain a judgment function, use the judgment function to determine the number of full stops in the digital chapter numbers, and determine the level of the text fields based on the number of full stops.

[0076] Furthermore, the digital chapter number contains at most two periods. The judgment function ISNUMBER (a function in the office software Excel) is used to determine the number of periods in the digital chapter number. If the number of periods in the digital chapter number is 0, the level of the corresponding text field is set to level one; if the number of periods in the digital chapter number is 1, the level of the corresponding text field is set to level two; if the number of periods in the digital chapter number is 2, the level of the corresponding text field is set to level three.

[0077] Step S2023, based on the level of the text field, a leading space is added before the text field to generate a combined text field.

[0078] Specifically, the text fields in each row of the directory are reorganized, and an appropriate number of spaces are added in front of the text fields according to the levels of the text fields to achieve a hierarchical effect in the PDF bookmark; for example, no space is added in front of the text field with "Chapter 1" (i.e., the first-level text field), one space is added in front of the text field with "1.1" (i.e., the second-level text field), and two spaces are added in front of the text field with "1.1.1" (i.e., the third-level text field).

[0079] Step S203, extracting the printed page number from the text on the catalog page, and determining the electronic file page number based on the printed page number.

[0080] Specifically, a preset value is obtained, and the page number of the electronic file is determined based on the printed page number and the preset value.

[0081] Furthermore, the Right function can be used to extract page numbers; for book files, the page number is generally at most 4 digits, so if the rightmost 4 characters are numbers, these 4 digits are taken as the page number; if not, continue to determine whether the rightmost 3 characters are numbers, if so, take these 3 digits as the page number, if not, continue to determine the rightmost 2 characters, ..., and so on, to obtain the printed page number in the recorded text.

[0082] Furthermore, since PDF files often contain contents such as the cover, copyright page, preface, and foreword, the page number of the electronic file is a fixed value larger than the printed page number; therefore, a preset value is determined based on the cover, copyright page, preface, and foreword, and then the page number of the electronic file is determined based on the sum of the printed page number and the preset value.

[0083] Step S204, combine the combined text field, printed page number and electronic file page number to obtain a PDF file directory bookmark. Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0084] The present embodiment provides a method for generating a PDF file directory bookmark, which obtains the level of a text field by grading digital chapter numbers, and then adds a leading space before the text field according to the level of the text field to generate a combined text field, so that the PDF file directory bookmark has a hierarchical structure, which can help users quickly locate specific chapters, understand the document structure, and enhance the reading experience.

[0085] In this embodiment, a method for generating a PDF file directory bookmark is provided, which can be used in the above-mentioned electronic device. Figure 3 is a flowchart of a method for generating a directory bookmark of a PDF file according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0086] Step S301, obtain a PDF electronic file, identify the directory page in the PDF electronic file, and obtain the directory page text. Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.

[0087] Step S302: extract the text fields in the catalog page text, identify and classify the text fields, and obtain the combined text fields. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.

[0088] Step S303: extract the printed page number from the text on the catalog page, and determine the page number of the electronic file based on the printed page number. Figure 2 Step S203 of the illustrated embodiment will not be described in detail here.

[0089] Step S304, combining the combined text field, printed page number and electronic file page number to obtain a PDF file directory bookmark.

[0090] Specifically, the above step S304 includes:

[0091] Step S3041, obtaining the directory bookmark text format, and combining the combined text fields, printed page numbers, and electronic file page numbers according to the directory bookmark text format to obtain a combined text.

[0092] Specifically, the combined text field, printed page number and electronic file page number are combined to form a new directory row, the printed page number and the electronic file page number are separated by a semicolon, and the electronic file page number is located after the semicolon.

[0093] Step S3042, storing the combined text as a txt file, and creating a PDF file directory bookmark based on the txt file.

[0094] Furthermore, the combined text is copied into a word processing software and saved as a txt file (a text format); in the PDF editing software, choose to create bookmarks by importing a txt file, and accurate directory bookmarks can be created for the PDF file, and directories at different levels are automatically graded.

[0095] Furthermore, different colors can be set for directories at different levels to further increase the sense of hierarchy.

[0096] Furthermore, for a PDF file converted from a paper document and having a table of contents page, the table of contents bookmark is rebuilt, and the bookmark has a hierarchical structure that can be expanded or collapsed, and the bookmark can form an accurate link jump with the corresponding text.

[0097] The present embodiment provides a PDF file directory bookmark generation method, which stores the combined text formed by the combined text field, printed page number and electronic file page number as a txt file, and then creates a PDF file directory bookmark based on the txt file, thereby realizing the standardized processing of the PDF file directory bookmark format, so that the generated PDF file directory bookmark can be directly applied to the PDF file.

[0098] The following is a specific example to illustrate the specific steps of a method for generating a PDF file directory bookmark.

[0099] Embodiment 1:

[0100] The scanned catalog page in the PDF electronic file is as follows Figure 4 As shown, Figure 5 As shown, the specific steps of the PDF file directory bookmark generation method include:

[0101] 1. First, use text recognition software to identify the text. The spaces may be identified as placeholders. Delete all placeholders.

[0102] 2. Paste the preliminarily processed text file into commonly used spreadsheet processing software (such as Excel, WPS, etc.), as shown in Table 1 below.

[0103] Table 1:

[0104]

[0105]

[0106] It can be seen from Table 1 above that there are still impurity characters in the text file after preliminary processing, such as separators, brackets next to page numbers, etc.

[0107] 3. Use the substitute function to remove impurities: You can nest substitute to remove a variety of common impurities, such as applying the following formula to cell A13:

[0108] =SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A11,"·",""),")",""),">","")

[0109] 4. The cleaned data is shown in column B of Table 2 below.

[0110] Table 2:

[0111]

[0112]

[0113] 5. Extract the text segments and printed page numbers from each row of the table of contents and place them in columns C and D respectively, as shown in Table 3 below.

[0114] Table 3:

[0115] C D 11 Chapter 1 Physical properties and engineering classification of soils 4 12 1.1 Soil formation 4 13 1.1.1 Products of rock weathering 4 14 1.1.2 Soil accumulation and transportation 5 15 1.2 Three-phase composition of soil 7 16 1.2.1 Solid particles 7 17 1.2.2 Water in soil 16 18 1.2.3 Gas in the soil 18 19 1.3 Physical state of soil 18 20 1.3.1 Proportional relationship of the three phase composition of soil 19 21 1.3.2 Physical state indicators of soil 24 22 1.4 Soil structure 30 23 1.4.1 Structure of coarse-grained soil 30 24 1.4.2 Structure of fine-grained soil 31 25 1.4.3 Two properties reflecting the structural characteristics of fine-grained soil 32

[0116] Among them, the Right function can be used to extract page numbers: for book files, the page number is generally at most 4 digits, and the auxiliary judgment logic is: if the rightmost 4 characters are numbers, take these 4 digits as the page number; if not, continue to judge whether the rightmost 3 characters are numbers, if so, take these 3 digits as the page number, if not, continue to judge the rightmost 2 characters, and so on.

[0117] Take cell D11 as an example, its formula is:

[0118] =IF(ISNUMBER(LEFT(RIGHT(B11,4))*1),RIGHT(B11,4)*1,IF(ISNUMBER(LEFT(RIGHT(B11,3)))*1 ),RIGHT(B11,3)*1,IF(ISNUMBER(LEFT(RIGHT(B11,2))*1),RIGHT(B11,2)*1,RIGHT(B11,1)*1)))

[0119] The method for extracting the text field is as follows: use the find function to find the position of two consecutive periods "..", and then use the left function to extract the content from the first position on the left to the double period "..", that is, the text field of each line of the directory; in special cases, there may be only one period or no period between the text segment and the page number. For the case of only one period, directly discard the period and the following page number to obtain the text field; for the case of no period, directly discard the page number to obtain the text field.

[0120] Taking C11 as an example, the formula is:

[0121] =IF(ISERR(LEFT(B11,FIND("..",B11)-1)),IF(RIGHT(SUBSTITUTE(B11,D11,""),1)=".", SUBSTITUTE(B11,"."&D11,""),SUBSTITUTE(B11,D11,"")),LEFT(B11,FIND("..",B11)-1))

[0122] 6. Extract the numeric chapter number in the text segment, such as "1.1" in cell C12 or 1.1.1 in cell C13. Generally, the chapter number in the table of contents is a three-level number containing at most two periods. You can use the judgment function ISNUMBER to select the processing method.

[0123] Taking E12 as an example, the formula is:

[0124] =IF(LEN(C12)-LEN(SUBSTITUTE(C12,".",))=1,IF(ISNUMBER(MID(C12,FI ND(".",C12),3)*1),LEFT(C12,FIND(".",C12)+2),IF(ISNUMBER(MID(C12,FIND(". ",C12),2)*1),LEFT(C12,FIND(".",C12)+1),LEFT(C12,FIND(".",C12)))),IF(LEN (C12)-LEN(SUBSTITUTE(C12,".",))=2,IF(ISNUMBER(MID(C12,FIND(".",C12,4),3 )*1),LEFT(C12,FIND(".",C12,4)+2),LEFT(C12,FIND(".",C12,4)+1)),IF(ISNUMBE R(LEFT(C12,3)*1),LEFT(C12,3),IF(ISNUMBER(LEFT(C12,2)*1),LEFT(C12,2),IF(ISNUMBER(LEFT(C12,1)*1),LEFT(C12,1),"")))))

[0125] The processing results are shown in Table 4 below, where column D represents the printed page numbers and column E represents the digital chapter numbers.

[0126] Table 4:

[0127]

[0128]

[0129] 7. Regroup the text fields in each line of the directory, and add an appropriate number of spaces before the text fields to achieve a hierarchical effect in the PDF bookmarks, such as no space before "Chapter 1", one space before "1.1" or "Section 1", and two spaces before "1.1.1". This can be achieved by using the ISNUMBER judgment function, LEFT text extraction function, MID, etc.

[0130] Taking F11 as an example, the formula is:

[0131] =IF(LEN(E11)-LEN(SUBSTITUTE(E11,".",""))=2,""&E11&""&RIGHT(C11,LEN(C11)-LEN(E11)),IF(LEN(E11)-LEN(SUBSTITUTE(E11,".",""))=1,""&E11&""&RIGHT(C11,LEN(C11)-LEN(E11)),IF(ISNUMBER(E11*1),""&E11&".

[0132] "&RIGHT(C11,LEN(C11)-LEN(E11)),IF(ISNUMBER(FIND("article",C11)),SUBSTITUTE(C11,"article","article",1),IF(ISNUMBER(FIND("chapter",C11)),SUBSTITUTE(C11,"chapter","chapter",1),IF(AND(ISNUMBER(FIND("section",C11)),NOT(ISNUMBER(FIND(".",C11)))),""&SUBSTITUTE(C11,"section","section",1),IF(LEFT(C11,2)="Appendix",SUBSTITUTE(C11,LEFT(C11,3),LEFT(C11,3)&""),IF(LEFT(C11,4)="C_Appendix",SUBSTITUTE(C11,LEFT(C11,5),LEFT(C11,5)&""),IF(AND(LEFT(C11,2)="C_",ISNUMBER(MID(C11,3,2)*1)),SUBSTITUTE(C11,LEFT(C11,4),LEFT(C11,4)&"

[0133] "),IF(AND(LEFT(C11,2)="C_",ISNUMBER(MID(C11,3,1)*1)),SUBSTITUTE(C11,LEFT(C11,3),LEFT(C11,3)&""),C11))))))))))

[0134] The text fields in each line of the reorganized table of contents are shown in column F of Table 5 below.

[0135] Table 5:

[0136]

[0137]

[0138] 8. Further combine the processed text segments, printed page numbers and actual page numbers of the electronic file to form a directory bookmark text.

[0139] The page numbers extracted in the previous steps are printed page numbers. Because PDF files often contain content such as cover pages, copyright pages, prefaces, and forewords, the page numbers of electronic files will be a fixed value larger than the printed page numbers. The actual page numbers of electronic files are placed at the end of the directory bookmark text, separated by a semicolon in front.

[0140] Taking G11 as an example, the formula is:

[0141] =F11&"_

"&D11&"

[0142] The 14 here means that the page number of the electronic file is 14 larger than the printed page number.

[0143] The processing results are shown in column G of Table 6 below.

[0144] Table 6:

[0145]

[0146]

[0147] 9. Copy the text in column G into a word processing software and save it as a txt file.

[0148] 10. In the PDF editing software, choose to create bookmarks by importing txt files, and you can create accurate directory bookmarks for PDF files, and the directories at different levels are automatically graded, such as Figure 6 shown.

[0149] In the above-mentioned embodiment 1, the PDF file directory bookmark generation process does not require advanced computer knowledge or programming knowledge, has clear logic, is easy to operate, and can be adjusted according to different directory types; the process file formed after the first operation can be reused, and can have the ability to quickly generate bookmarks, so that directory labels can be produced for a large number of existing and newly added PDF files, helping these PDF files to achieve greater value. This method has certain promotion and application value, and is suitable for processing a large number of PDF electronic files that do not yet have directory bookmarks, helping readers effectively grasp the structure of the file content and improving the reading experience.

[0150] In this embodiment, a PDF file directory bookmark generation device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0151] This embodiment provides a PDF file directory bookmark generation device, such as Figure 7 As shown, including:

[0152] The recognition module 701 is used to obtain a PDF electronic file, recognize the directory page in the PDF electronic file, and obtain the text of the directory page;

[0153] A classification module 702 is used to extract text fields from the catalog page text, identify and classify the text fields, and obtain the combined text fields;

[0154] A determination module 703 is used to extract the printed page number in the text of the catalog page and determine the page number of the electronic file based on the printed page number;

[0155] The combining module 704 is used to combine the combined text field, printed page number and electronic file page number to obtain a PDF file directory bookmark.

[0156] In some optional implementations, the grading module 702 includes:

[0157] An extraction unit, used to extract text fields from the text on the catalog page, and extract digital chapter numbers based on the text fields;

[0158] A grading unit is used to grade the digital chapter numbers to obtain the level of the text field;

[0159] The generating unit is used for adding a leading space before the text field based on the level of the text field to generate a combined text field.

[0160] In some optional implementations, the grading unit is specifically configured to obtain a determination function, use the determination function to determine the number of periods in the digital chapter number, and determine the level of the text field based on the number of periods.

[0161] In some optional implementations, the determination module 703 is specifically configured to obtain a preset value and determine the page number of the electronic file based on the printed page number and the preset value.

[0162] In some optional implementations, the combining module 704 includes:

[0163] A combining unit, used for obtaining the directory bookmark text format, combining the combined text field, the printed page number and the electronic file page number according to the directory bookmark text format to obtain a combined text;

[0164] Create a unit for storing the combined text as a txt file and creating a PDF file directory bookmark based on the txt file.

[0165] In some optional embodiments, the method further comprises:

[0166] The removal module is used to remove impurities from the catalog page text to obtain purified catalog page text.

[0167] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0168] In this embodiment, a PDF file directory bookmark generation device is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0169] The embodiment of the present invention also provides a computer device having the above Figure 7 A device for generating a directory bookmark of a PDF file is shown.

[0170] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0171] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0172] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0173] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0174] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0175] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.

[0176] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.

[0177] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0178] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0179] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for generating a PDF file directory bookmark, characterized in that: The method comprises: Obtaining a PDF electronic file, identifying a catalog page in the PDF electronic file, and obtaining text on the catalog page; Extracting text fields from the catalog page text, marking and grading the text fields, and obtaining combined text fields; Extracting the printed page number from the text on the catalog page, and determining the page number of the electronic file based on the printed page number; The combined text field, the printed page number and the electronic file page number are combined to obtain a PDF file directory bookmark.

2. The method according to claim 1, characterized in that The step of extracting text fields from the text on the catalog page, identifying and grading the text fields, and obtaining the combined text fields includes: Extracting a text field from the text on the catalog page, and extracting a digital chapter number based on the text field; Classifying the digital chapter numbers to obtain the levels of the text fields; Based on the level of the text field, a leading space is added before the text field to generate a combined text field.

3. The method according to claim 2, characterized in that The step of grading the digital chapter numbers to obtain the levels of the text fields includes: A judgment function is obtained, the number of periods in the digital chapter number is determined using the judgment function, and the level of the text field is determined based on the number of periods.

4. The method according to claim 1, characterized in that: The step of extracting the printed page number from the text on the catalog page and determining the page number of the electronic file based on the printed page number includes: A preset value is obtained, and the page number of the electronic file is determined based on the printed page number and the preset value.

5. The method according to claim 1, characterized in that The combining the combined text field, the printed page number and the electronic file page number to obtain a PDF file directory bookmark includes: Acquire a directory bookmark text format, and combine the combined text field, the printed page number, and the electronic file page number according to the directory bookmark text format to obtain a combined text; The combined text is stored as a txt file, and the PDF file directory bookmark is established based on the txt file.

6. The method according to claim 1, characterized in that Before extracting the text fields in the catalog page text and marking and grading the text fields to obtain the combined text fields, the method further includes: Impurities are removed from the catalog page text to obtain purified catalog page text.

7. A PDF file directory bookmark generation device, characterized in that: The device comprises: The recognition module is used to obtain a PDF electronic file, recognize the catalog page in the PDF electronic file, and obtain the text of the catalog page; A classification module, used for extracting text fields from the text on the catalog page, marking and classifying the text fields, and obtaining text fields after combination processing; A determination module, used for extracting the printed page number in the text of the catalog page, and determining the page number of the electronic file based on the printed page number; The combination module is used to combine the combined text field, the printed page number and the electronic file page number to obtain a PDF file directory bookmark.

8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are connected to each other for communication, the memory stores computer instructions, and the processor executes the PDF file directory bookmark generation method according to any one of claims 1 to 6 by executing the computer instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the PDF file directory bookmark generation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the PDF file directory bookmark generation method according to any one of claims 1 to 6.