Method and device for adding comments to PDF (Portable Document Format) files in batches, medium and electronic equipment
By splitting and joining PDF files and automatically adding annotations, the problem of low efficiency in batch adding annotations to PDF files in the existing technology is solved, and efficient and flexible annotation processing is achieved.
Patent Information
- Application Number
- CN202410721223.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-24
AI Technical Summary
In the prior art, batch adding annotations to PDF files is inefficient, requiring users to manually add text boxes to each page of content, resulting in cumbersome repetitive operations and reduced efficiency.
By obtaining the PDF file and annotation data file to be processed, split the PDF file into a single-page file group, generate a single-page PDF file with a transparent background based on the annotation data and positioning information, perform lamination and combination, automatically add annotations, and generate batch additions Annotated PDF files.
It realizes the automatic batch adding annotation operation without manually adding text boxes, improves the efficiency of batch adding annotations to PDF files, has high flexibility, and is suitable for various annotation contents.
Smart Images

Figure CN118690732A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of file processing, and in particular to a method, device, medium and electronic device for batch adding annotations to PDF files. Background Art
[0002] With the rapid development of information technology, portable document format (commonly known as "PDF") has been widely used around the world as a cross-platform, highly integrated, secure and reliable document format. PDF format can encapsulate text, fonts, graphics, images, colors, layouts and printing equipment related parameters in one file, thereby ensuring the integrity and consistency of page elements during network transmission, printing and plate-making output. In industries such as industry, medicine, and pharmaceuticals, most analytical reports are in PDF format to ensure the accuracy and readability of the reports. In practical applications, it is often necessary to annotate PDF reports in batches so that reviewers and auditors can quickly confirm the integrity of the report information.
[0003] In the prior art, batch annotations to PDF files require users to use a PDF file editor to edit each page one by one. This operation requires users to manually add text boxes to each page and enter annotation information. When faced with hundreds of pages of electronic reports, this operation requires repeated text box additions hundreds of times, which seriously reduces the efficiency of batch annotations to PDF files. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a method, device, medium, and electronic device for batch adding annotations to PDF files, the main purpose of which is to solve the problem of low efficiency in batch adding annotations to PDF files.
[0005] According to one aspect of the present application, a method for adding annotations to PDF files in batches is provided, the method comprising:
[0006] Acquire a PDF file to be processed and an annotation data file, wherein the annotation data file records at least one annotation data and location information of the annotation data;
[0007] Splitting the PDF file into a plurality of first file groups of single pages;
[0008] Based on the annotation data and the positioning information of the annotation data, a plurality of second file groups are generated, wherein the second file group is a single-page PDF file with a transparent background, and the single-page PDF file contains at least one of the annotation data set based on the positioning information;
[0009] Based on the page number information of the first file group and the positioning information of the annotation data set in the second file group, the first file group and the second file group are pasted together, and the pasted files are combined to obtain PDF files with batch annotations.
[0010] Optionally, obtaining the PDF file and annotation data file to be processed includes: displaying an operation panel, wherein an import control for a PDF file and an import control for an annotation data file are displayed on the operation panel; in response to an import operation for a PDF file, obtaining the PDF file to be processed, and extracting page number information of each page in the PDF file; in response to an import operation for an annotation data file, obtaining the annotation data file, and extracting annotation data and location information of the annotation data in the annotation data file, wherein the location information is used to represent the page number where the annotation data is located.
[0011] Optionally, the annotation data file is a table format file or a text format file, wherein the annotation data is stored in the annotation data file in columns, and the order of the rows where the annotation data are located is used as the positioning information of the annotation data; or the annotation data is stored in the annotation data file in a sequential input format, and the page identifier corresponding to the annotation data is used as the positioning information of the annotation data.
[0012] Optionally, the method further includes: in response to an import operation of a PDF file, displaying in real time the import progress of the PDF file and / or the generation progress of the first file group; and / or in response to an import operation of an annotation data file, displaying in real time the import progress of the annotation data file and / or the generation progress of the second file group; and / or displaying in real time the fitting progress of the first file group and the second file group.
[0013] Optionally, the operation panel also displays setting controls for annotation parameters; then, based on the annotation data and the positioning information of the annotation data, multiple second file groups are generated, including: in response to the setting operation of the annotation parameters, receiving at least one annotation parameter, wherein the annotation parameter includes at least one parameter of annotation coordinate position, annotation font, annotation font size and annotation font color; according to the annotation parameters, adding each of the annotation data in turn to multiple single-page PDF files with a transparent background to obtain multiple second file groups, wherein the page number information of the second file group is determined according to the positioning information of the annotation data set in the second file group.
[0014] Optionally, the method further includes: in response to a preview operation of the annotation data, displaying a preview interface, and displaying a display effect of the annotation data in the PDF file in the preview interface, wherein the display effect includes at least one of a display effect of the annotation coordinate position, a display effect of the annotation font, a display effect of the annotation font size, and a display effect of the annotation font color.
[0015] Optionally, the first file group and the second file group are pasted based on the page number information of the first file group and the positioning information of the annotation data set in the second file group, and the pasted files are combined to obtain a PDF file with batch annotations, including: searching for the first file group and the second file group corresponding to the page number sequence in sequence according to the page number sequence of the PDF file, and pasting the first file group and the second file group; when the first file group and / or the second file group corresponding to any page number sequence is not found, deleting the first file group, the second file group and the pasted single-page file, and displaying a prompt message that the batch annotation of the files has failed; when all the first file groups and the second file groups are pasted, combining the pasted files according to the page number sequence to obtain a PDF file with batch annotations, deleting the first file group, the second file group and the pasted single-page file, and displaying a prompt message that the batch annotation of the files has been successfully added.
[0016] According to another aspect of the present application, a device for adding annotations to PDF files in batches is provided, the device comprising:
[0017] A file acquisition module, used to acquire a PDF file and an annotation data file to be processed, wherein the annotation data file records at least one annotation data and location information of the annotation data;
[0018] A file splitting module, used for splitting the PDF file into a plurality of first file groups of single pages;
[0019] an annotation extraction module, configured to generate a plurality of second file groups based on the annotation data and the positioning information of the annotation data, wherein the second file group is a single-page PDF file with a transparent background, and the single-page PDF file contains at least one of the annotation data set based on the positioning information;
[0020] The file synthesis module is used to paste the first file group and the second file group based on the page number information of the first file group and the positioning information of the annotation data set in the second file group, and combine the pasted files to obtain PDF files with batch annotations.
[0021] According to another aspect of the present application, a storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method for adding batch annotations to PDF files is implemented.
[0022] According to another aspect of the present application, an electronic device is provided, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the above-mentioned method for adding batch annotations to PDF files when executing the program.
[0023] By means of the above technical scheme, the present application provides a method and device, medium, and electronic device for batch adding annotations to PDF files, which first obtains the PDF file to be processed and the annotation data file, and then splits the PDF file into multiple first file groups of single pages, and then generates multiple second file groups containing the annotation data and with transparent backgrounds based on the annotation data and the positioning information of the annotation data, and finally pastes the first file group and the second file group based on the page number information of the first file group and the positioning information of the annotation data set in the second file group, and combines the pasted files to obtain PDF files with batch adding annotations. The above method eliminates the need for repeated operations of adding text boxes, and only needs to input the annotation data to be added to each page of the PDF file into the annotation data file, and the operation of batch adding annotations can be automatically performed, and PDF files with batch adding annotations can be obtained. The above method does not need to restrict the content of the annotation data, can flexibly add various types of annotations, and can effectively improve the efficiency of batch adding annotations to PDF files.
[0024] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0026] Figure 1 A schematic diagram of a process for adding batch annotations to PDF files provided in an embodiment of the present application is shown;
[0027] Figure 2 A schematic diagram showing a flow chart of another method for adding annotations to PDF files in batches provided by an embodiment of the present application;
[0028] Figure 3 A schematic diagram of an interface of an operation panel provided in an embodiment of the present application is shown;
[0029] Figure 4 A schematic diagram of a preview interface provided by an embodiment of the present application is shown;
[0030] Figure 5 A schematic diagram of multiple pages of a PDF file to be processed provided by an embodiment of the present application is shown;
[0031] Figure 6 A single-page schematic diagram of a PDF file to be processed provided by an embodiment of the present application is shown;
[0032] Figure 7 A schematic diagram of a page of an annotation data file provided in an embodiment of the present application is shown;
[0033] Figure 8 A schematic diagram of multiple pages of a PDF file with batch annotations provided by an embodiment of the present application is shown;
[0034] Fig. 9 A single-page schematic diagram of a PDF file with batch annotations provided in an embodiment of the present application is shown;
[0035] Fig.10 A schematic diagram of the structure of a device for adding batch annotations to PDF files provided in an embodiment of the present application is shown;
[0036] Fig.11 A schematic structural diagram of another device for adding annotations to PDF files in batches provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0037] The present application will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0038] In the prior art, to add annotations to PDF files in batches, users need to use a PDF file editor to edit the content of each page one by one. There are two main editing methods: the first method is to add a text box to each page of the PDF file and enter the annotation information to be added in the text box; the second method is to insert a header or footer into each page of the PDF file and enter the annotation information to be added in the header or footer. The first method requires manually adding a text box to each page of the PDF file, which is too repetitive; and although the second method can add annotations in batches, the annotation data on each page of the PDF file is the same, there are too many restrictions on the annotation data, and the annotation content cannot be flexibly changed.
[0039] In view of the technical problems of low efficiency and poor flexibility in batch adding annotations to PDF files, in one embodiment, Figure 1 As shown, a method for adding annotations to PDF files in batches is provided, and the method is described by taking the application of the method to a computer device such as a server as an example, and includes the following steps:
[0040] Step 101 : obtaining a PDF file to be processed and an annotation data file, wherein the annotation data file records at least one piece of annotation data and location information of the annotation data.
[0041] Among them, the PDF file to be processed refers to a file in a portable file format to which annotations are to be added. The file can be a single-page file or a multi-page file, and the file content is not limited. Further, the annotation data file refers to a file containing annotation content, which can be a file in any format, such as a file in the table format xls, xlsx, csv or a file in the text format txt, doc, docx, etc. Among them, the annotation data can be any customized content, usually text content, and other forms of content such as graphics, images, hypertext links, audio, and video are not excluded. For each piece of annotation data, corresponding positioning information is set, and the positioning information can be automatically generated according to the location of the annotation data, or it can be manually added by the user. The positioning information can be used to characterize the page number where the annotation data is located in the PDF file to be processed. In addition, optionally, the positioning information of the annotation data can also include the coordinate information of the annotation data in the single-page PDF file, so as to locate the coordinate position of the annotation data in the single-page PDF file. In this embodiment, the annotation data corresponding to a positioning information can be one or more.
[0042] Specifically, the computer device can obtain the PDF file to be processed and the annotation data file by importing, dragging, and other methods, wherein the PDF file to be processed and the annotation data file can be obtained simultaneously or separately. When obtaining the PDF file, the file content and page number of each page in the PDF file can be obtained; when obtaining the annotation data file, each annotation data in the annotation data file and the location information of each annotation data can be obtained for subsequent matching and pasting processing.
[0043] Step 102: split the PDF file into a plurality of first file groups of single pages.
[0044] Specifically, the computer device can use a PDF processing tool to split the PDF file to be processed into a series of independent single-page PDF files, thereby obtaining multiple first file groups. Each first file group is a single-page PDF file, and the single-page PDF file contains all the content on the page file and the page number information of the page. In this embodiment, the operation of splitting the PDF file can ensure that annotations can be added to each page of the PDF file separately later without affecting the content of other pages.
[0045] Step 103 : generating a plurality of second file groups based on the annotation data and the positioning information of the annotation data, wherein the second file group is a single-page PDF file with a transparent background, and the single-page PDF file contains at least one annotation data set based on the positioning information.
[0046] Specifically, for each annotation data and its positioning information in the annotation data file, a PDF editing or generating software can be used to create several single-page PDF files with transparent backgrounds, and each annotation data is sequentially set in each single-page PDF file, so as to obtain multiple second file groups. Among them, each second file group is a single-page PDF file with transparent background, and the single-page PDF file contains at least one annotation data set according to the positioning information. In this embodiment, the purpose of setting the second file group is to set a transparent layer in each single-page PDF file, and add annotation text on the transparent layer to ensure that the original PDF file format remains unchanged and only the annotation information is added. In addition, when the positioning information also includes detailed location information such as coordinate information, the computer device can also accurately place the annotation data on the transparent PDF file page according to the coordinate information in the positioning information to ensure that the position, size and appearance of the annotation meet the design requirements of the annotation information. In this embodiment, the page number information corresponding to the annotation data set in the same second file group (i.e., the same single-page PDF file) is the same, and the coordinate information can be different.
[0047] Step 104 , based on the page number information of the first file group and the location information of the annotation data set in the second file group, the first file group and the second file group are pasted together, and the pasted files are combined to obtain PDF files with batch annotations.
[0048] Specifically, the computer device can search for each page of the original PDF file (i.e., the first file group) and the transparent PDF page with annotations corresponding to each page of the original PDF file (i.e., the second file group) according to the page number information of the first file group and the page number information indicated by the positioning information of the annotation data set in the second file group, so as to use the page number information to ensure that the annotation data is correctly superimposed on the corresponding position of each page of the PDF file. In this embodiment, when the first file group and the second file group are pasted, the transparent PDF file (i.e., the second file group) can be used as a watermark or an overlay to accurately align with the original PDF page (i.e., the first file group) to complete the pasting. Further, after the pasting is completed, the PDF merger tool can be used to reassemble the single-page PDF file with annotations into a complete PDF document. This step can ensure that all pages are arranged in the order of page numbers, and each page of the PDF file has been added with corresponding annotations, and finally a whole PDF file with batch annotations can be formed.
[0049] By applying the technical solution of this embodiment, firstly, the PDF file and the annotation data file to be processed are obtained, and then the PDF file is split into multiple first file groups of single pages, and then based on the annotation data and the positioning information of the annotation data, multiple second file groups containing the annotation data and with transparent backgrounds are generated, and finally based on the page number information of the first file group and the positioning information of the annotation data set in the second file group, the first file group and the second file group are pasted, and the pasted files are combined to obtain a PDF file with batch annotations. The above method eliminates the need for repeated operations of adding text boxes. It only needs to input the annotation data to be added to each page of the PDF file into the annotation data file, and the operation of adding annotations in batches can be automatically performed to obtain a PDF file with batch annotations. The above method does not need to limit the content of the annotation data, can flexibly add various types of annotations, and can effectively improve the efficiency of adding annotations in batches to PDF files.
[0050] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, another method for adding annotations to PDF files in batches is provided, such as Figure 2 As shown, the method includes:
[0051] Step 201 : displaying an operation panel, wherein the operation panel displays an import control for a PDF file and an import control for an annotation data file.
[0052] Specifically, the computer device can execute the above-mentioned method of adding batch annotations to PDF files through an application. After the application is started, the computer device can display an operation panel, wherein the operation panel displays an import control for PDF files and an import control for annotation data files. Through the import control for PDF files, the user can import the PDF file to be processed, so that the computer device can obtain the PDF file; through the import control for annotation data files, the user can import the annotation data file, so that the computer device can obtain the annotation data file.
[0053] It is understandable that the styles of the PDF file import control and the annotation data file import control can be designed according to the actual form of the product. Figure 3 , the PDF file import control can be designed as a "PDF file" style, and clicking the control can import the PDF file to be processed; the annotation data file import control can be designed as an "EXCEL file" style, and clicking the control can import the annotation data file in EXCEL format. In other embodiments, the two controls can also be designed in other styles, which are not limited here.
[0054] Step 202: In response to the PDF file import operation, a PDF file to be processed is obtained.
[0055] Specifically, in response to the import operation of the PDF file, the computer device can obtain the PDF file to be processed and extract the page number information of each page in the PDF file to facilitate the subsequent page number comparison and page bonding operations.
[0056] In an optional embodiment, the computer device can display the import progress of the PDF file in real time, and / or display the generation progress of the first file group in real time (i.e., display the splitting progress of the PDF file in real time), so that the user can promptly know the upload progress and splitting progress of the file, thereby improving the user experience.
[0057] Step 203: In response to the import operation of the annotation data file, the annotation data file is obtained.
[0058] Specifically, in response to the import operation of the annotation data file, the computer device can extract the annotation data and its positioning information in the annotation data file, wherein the positioning information can be used to represent the page number where the annotation data is located, so as to facilitate the subsequent page number comparison and page bonding operations. Optionally, the positioning information can also include coordinate position information, and is used to represent the coordinate position of the annotation data in the PDF file.
[0059] In an optional embodiment, the annotation data file can be stored in a table format or a text format. In this embodiment, the annotation data can be stored in the annotation data file in columns, and the order of the rows where the annotation data is located is used as the location information of the annotation data. This storage method can increase the input speed of the annotation data and reduce the difficulty of editing the annotation data. For example, if Figure 7 As shown, the annotation data file can be stored in an EXCEL format file, wherein each row of the table is the annotation data to be added to a PDF page, that is, the order of the rows where the annotation data is located represents the page where the annotation data is located, for example, the annotation data in the 5th row is the annotation data to be added to the 5th page of the PDF file. In this way, the input efficiency of the annotation data can be improved and the difficulty of data processing can be reduced.
[0060] In an optional embodiment, the annotation data can also be stored in the annotation data file in a sequential input format, and the page identifier corresponding to the annotation data can be used as the positioning information of the annotation data. In this embodiment, the annotation data input in sequence can be recorded in a column, or can be sequentially input in a text file and separated by specific symbols. In this type of storage method, it is necessary to set corresponding positioning information for the annotation data, wherein the positioning information can be determined based on the order of the rows where the annotation data is located, or the page number, coordinate position and other information can be manually set for the annotation data. It should be noted that the annotation data stored in a list format or in a text format can be set with positioning information manually or automatically. In addition, if a page file in the PDF file to be processed does not need to add annotation data, the information can be omitted in the list row corresponding to the annotation data, or the positioning information corresponding to the page file can be omitted.
[0061] In the above two optional embodiments, the computer device can extract the annotation data and its location information from the annotation data file according to the storage method of the annotation data and its location information. Specifically, if the storage format of the annotation data and the storage method of the location information are fixed, the annotation data and its location information can be extracted according to the fixed information extraction method; if there are multiple storage formats of the annotation data and the storage methods of the location information, the information extraction method can be first determined according to the storage method of the annotation data and its location information, and then the annotation data and its location information can be extracted according to the determined information extraction method.
[0062] In an optional embodiment, the computer device can display the import progress of the annotation data file in real time, and / or display the generation progress of the second file group in real time (i.e., display the extraction progress of the annotation data and its positioning information in real time), so that the user can promptly know the upload progress of the annotation data file and the information extraction progress, thereby improving the user experience.
[0063] Step 204: split the PDF file to be processed into a plurality of first file groups of single pages.
[0064] Specifically, the computer device can use the PDF processing tool embedded in the application to split the PDF file to be processed into a series of independent single-page PDF files to obtain multiple first file groups. Each first file group is a single-page PDF file, and the single-page PDF file contains all the content on the page file and the page number information of the page.
[0065] Step 205: receiving at least one annotation parameter in response to the annotation parameter setting operation.
[0066] Specifically, refer to Figure 3 On the operation panel, at least one setting control for annotation parameters may also be displayed. For example, a setting control for annotation coordinate position (including x-axis and y-axis), a setting control for annotation font, a setting control for annotation font size, and a setting control for annotation font color may be displayed. The user may set the annotation coordinate position, font, font size, font color, and other parameters through the above controls. After the annotation parameters are set, the computer device may generate a second file group based on the annotation data according to the above parameters.
[0067] In an optional embodiment, when the user does not set the annotation parameters, the computer device can set a default parameter for the annotation data, and generate a second file group according to the above default annotation parameters. Taking the annotation coordinate position as an example, the coordinate origin of the annotation coordinate position can be set to the lower left corner vertex of the PDF file, the moving coordinate point is the lower left corner vertex of the rectangular frame closely surrounding the annotation data, the annotation data moves to the right as the x-axis movement, and each increase of 1 in the value is 1 inch to the right, and the annotation moves upward as the y-axis, and each increase of 1 in the value is 1 inch upward, and the minimum movement distance is 0.1 inches. In this case, the default annotation coordinate position can set the coordinates of both the x-axis and the y-axis to 0, at which time the annotation data will be set at the lower left corner vertex of the PDF file. Further, after the parameter information is set, a preview interface can be popped up, and confirming the preview interface can indicate confirmation of the annotation parameters, and closing the preview interface can reset the parameters.
[0068] In an optional implementation example, annotation parameters may also be set in the annotation data file instead of receiving the annotation parameters in the operation interface. In this scenario, the computer device may generate a second file group according to the annotation parameters set in the annotation data file, and perform subsequent fitting operations. The above method of setting annotation parameters is more flexible, and annotation parameters can be customized according to each annotation data, but the disadvantage is that the setting of the annotation data file has a certain complexity.
[0069] In another optional embodiment, when generating the second file group, the computer device may first determine whether the annotation parameters are set in the annotation data file. If the annotation parameters are set in the annotation data file, the corresponding second file group is generated according to the annotation parameters set in the annotation data file; if the annotation parameters are not set in the annotation data file, the corresponding second file group is generated according to the annotation parameters set in the operation panel. The above implementation combines the methods of setting the annotation parameters in the above two optional embodiments, making the setting of the annotation parameters more flexible and customized, and will not significantly increase the complexity of the annotation parameter setting.
[0070] Step 206 , in response to the preview operation of the annotation data, displaying a preview interface, and displaying the display effect of the annotation data in the PDF file in the preview interface.
[0071] Specifically, refer to Figure 4 When the user clicks the preview control, the computer device can respond to the preview operation, display the preview interface, and simulate the display effect of the annotation data in the PDF file in the preview interface. The display effect may include at least one of the display effect of the annotation coordinate position, the display effect of the annotation font, the display effect of the annotation font size, and the display effect of the annotation font color.
[0072] Step 207 , according to the annotation parameters, each annotation data is sequentially added to a plurality of single-page PDF files with transparent backgrounds to obtain a plurality of second file groups.
[0073] Specifically, the computer device can add each annotation data to multiple single-page PDF files with transparent backgrounds in sequence according to the annotation parameters and annotation data set by the user, thereby obtaining multiple second file groups. In this embodiment, each second file group is a single-page PDF file with transparent background, and the single-page PDF file contains at least one annotation data set according to the positioning information. Among them, the page number information of the second file group is determined according to the positioning information of the annotation data set in the second file group, and the annotation parameters of the annotation data in the second file group are determined according to the annotation parameters set in the operation panel or the annotation data file.
[0074] Step 208 , searching for the first file group and the second file group corresponding to the page number sequence in sequence according to the page number sequence of the PDF file, and pasting the first file group and the second file group.
[0075] Specifically, the computer device may search for the first file group and the second file group corresponding to the page number sequence in sequence according to the page number sequence of the PDF file, and perform a pasting operation on the found first file group and the second file group, so as to add the annotation data to the corresponding PDF page. For example, when pasting to page 5, the first file group with page number "5" and the second file group with location information corresponding to the annotation data indicating page number "5" may be searched, and the found first file group and the second file group may be pasted, so as to obtain a pasted file with page number "5", which is a PDF file with annotation data added.
[0076] In an optional embodiment, during the pasting process, the pasting progress of the first file group and the second file group may be displayed in real time, so that the user can understand the progress of adding annotations in batches, thereby improving the user experience.
[0077] Step 209, when the first file group and / or the second file group corresponding to any page number sequence is not found, the first file group, the second file group and the pasted single-page file are deleted, and a prompt message indicating that batch annotation of files has failed is displayed.
[0078] Specifically, in the process of searching for the first file group and the second file group, if the first file group and / or the second file group corresponding to any page number sequence is not found, the first file group, the second file group and the pasted single-page file can be deleted to reduce system debris and free up storage space. Furthermore, a prompt message indicating that batch annotation of files has failed can be displayed on the operation panel to prompt the user that the operation of batch adding annotations to PDF files has failed.
[0079] In an optional embodiment, the prompt information of failure to add annotations to files in batches may carry the page number information of the missing PDF files and / or the page number information corresponding to the missing annotation data. By indicating the missing PDF files or annotation data, users can correct the problems in the files in a timely manner.
[0080] In an optional embodiment, in the process of searching the first file group and the second file group, the quantity of the first file group and the second file group can be compared first. If the quantity is inconsistent, it can be directly determined that the two have failed to match; if the quantity is consistent, the page number information of the first file group and the second file group can be compared again. If the page number comparison is inconsistent, it is determined that the two have failed to match; if the page number comparison is consistent, it is determined that the two have successfully matched. By using the progressive comparison method, the efficiency and accuracy of page matching can be improved.
[0081] Step 210 , when all the first file group and the second file group are pasted together, the pasted files are combined in the order of page numbers to obtain PDF files with batch annotations.
[0082] Specifically, after the first file group and the second file group are all successfully pasted, the pasted files can be combined according to the page number sequence, wherein the combined files are the batch annotated PDF files. Figures 5 to 9 , the PDF file to be processed is Figure 5 As shown, Figure 5 The content of each page is as follows Figure 6 As shown in the single page of Figure 7 As shown, Figure 7 The annotation data in the PDF file is stored in columns. The content of each row is the annotation content that needs to be added to a PDF page. The page where the annotation data is located is the order of the rows where the annotation data is located. For example, the annotation data in the 5th row is the annotation data that needs to be added to the 5th page of the PDF file. Further, after splitting the PDF file, multiple first file groups can be obtained. Based on the annotation data and its positioning information in the annotation data file, multiple second file groups can be generated. Then, the first file group and the second file group can be pasted together, and the pasted files can be combined in the order of page numbers to obtain the following: Figure 8 The batch of annotated PDF files shown in the figure, Figure 8 The content of each page is as follows Fig. 9 As shown in the single page of Fig. 9 It can be seen that each annotation data in the processed PDF file has been added to each page of the PDF file, which neither changes the content and format of the original PDF file nor adds customized annotation content to each page of the PDF file, thereby effectively improving the efficiency of adding annotations to PDF files in batches.
[0083] Step 211, deleting the first file group, the second file group and the pasted single-page files, and displaying a prompt message indicating that batch annotations have been successfully added to the files.
[0084] Specifically, after all files are pasted together, the used first file group, the second file group and the pasted single-page files can be deleted, thereby reducing system debris and freeing up storage space. Finally, a prompt message indicating that batch annotations have been successfully added to files can be displayed on the operation panel to prompt the user to view the batch annotated PDF files, thereby completing the process of batch annotating PDF files.
[0085] By applying the technical solution of this embodiment, customized annotation information can be added to each page of a PDF file in batches. The above method can effectively reduce the cumbersome operation of adding custom annotation texts in batches to electronic reports in PDF format with multiple pages, ensure the uniformity of the annotation position of each page and the customization of the content, without any text restrictions, and have high flexibility. With the above technical solution, users can arbitrarily select annotation parameters such as font, font size and text color to annotate documents, thereby ensuring the consistency and coordination of other elements of the entire PDF file other than annotations. Users only need to provide the PDF file to be processed and the annotation data corresponding to each page of the PDF file, and can set the position coordinates, font, font size, and color of the annotation data in the file PDF at one time, so that batch annotations of PDF files can be easily completed. The above process not only greatly improves the efficiency of batch annotation of PDF files, but also ensures the aesthetics of batch annotation of PDF files, thereby improving the user experience.
[0086] Further, as Figures 1 to 9 The specific implementation of the method, the embodiment of the present application provides a device for adding annotations to PDF files in batches, such as Fig.10 As shown, the device comprises:
[0087] The file acquisition module 31 is used to acquire the PDF file and the annotation data file to be processed, wherein the annotation data file records at least one annotation data and the location information of the annotation data;
[0088] A file splitting module 32, used for splitting the PDF file into a plurality of first file groups of single pages;
[0089] An annotation extraction module 33, used to generate a plurality of second file groups based on the annotation data and the positioning information of the annotation data, wherein the second file group is a single-page PDF file with a transparent background, and the single-page PDF file contains at least one of the annotation data set based on the positioning information;
[0090] The file synthesis module 34 is used to paste the first file group and the second file group based on the page number information of the first file group and the positioning information of the annotation data set in the second file group, and combine the pasted files to obtain PDF files with batch annotations.
[0091] In a specific application scenario, the file acquisition module 31 is specifically used to display an operation panel, wherein the operation panel displays an import control for a PDF file and an import control for an annotation data file; in response to an import operation for a PDF file, the PDF file to be processed is acquired, and the page number information of each page of the PDF file is extracted; in response to an import operation for an annotation data file, the annotation data file is acquired, and the annotation data in the annotation data file and the positioning information of the annotation data are extracted, wherein the positioning information is used to represent the page number where the annotation data is located.
[0092] In a specific application scenario, the annotation data file is a table format file or a text format file, wherein the annotation data is stored in the annotation data file in columns, and the order of the rows where the annotation data is located is used as the positioning information of the annotation data; or the annotation data is stored in the annotation data file in a sequential input format, and the page identifier corresponding to the annotation data is used as the positioning information of the annotation data.
[0093] In a specific application scenario, such as Fig.11 As shown, the device also includes an interface display module 35, wherein the interface display module 35 is used to respond to the import operation of the PDF file and display the import progress of the PDF file and / or the generation progress of the first file group in real time; and / or, respond to the import operation of the annotation data file, display the import progress of the annotation data file and / or the generation progress of the second file group in real time; and / or, display the bonding progress of the first file group and the second file group in real time.
[0094] In a specific application scenario, the operation panel also displays setting controls for annotation parameters; the interface display module 35 is also used to receive at least one annotation parameter in response to the setting operation of the annotation parameters, wherein the annotation parameters include at least one parameter of annotation coordinate position, annotation font, annotation font size and annotation font color; the annotation extraction module 33 is specifically used to add each of the annotation data to multiple single-page PDF files with transparent backgrounds in turn according to the annotation parameters to obtain multiple second file groups, wherein the page number information of the second file group is determined according to the positioning information of the annotation data set in the second file group.
[0095] In a specific application scenario, the interface display module 35 is also used to display a preview interface in response to a preview operation of the annotation data, and to display the display effect of the annotation data in the PDF file in the preview interface, wherein the display effect includes at least one of the display effect of the annotation coordinate position, the display effect of the annotation font, the display effect of the annotation font size, and the display effect of the annotation font color.
[0096] In a specific application scenario, the file synthesis module 34 is specifically used to search for the first file group and the second file group corresponding to the page number sequence in sequence according to the page number sequence of the PDF file, and paste the first file group and the second file group; when the first file group and / or the second file group corresponding to any page number sequence is not found, delete the first file group, the second file group and the pasted single-page file, and display a prompt message that the batch annotation of the files failed; when all the first file groups and the second file groups are pasted, combine the pasted files according to the page number sequence to obtain a PDF file with batch annotations; delete the first file group, the second file group and the pasted single-page file, and display a prompt message that the batch annotation of the files is successfully added.
[0097] It should be noted that for other corresponding descriptions of the functional units involved in the device for batch adding annotations to PDF files provided in the embodiment of the present application, reference can be made to Figures 1 to 9 The corresponding description in the method will not be repeated here.
[0098] The embodiment of the present application also provides an electronic device, which can be a personal computer, a server, a network device, etc. The electronic device includes a bus, a processor, a memory and a communication interface, and can also include an input and output interface and a display device. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the electronic device is used to store location information. The network interface of the electronic device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the steps in each method embodiment are implemented.
[0099] Those skilled in the art will understand that the structure of the above-mentioned electronic device is only a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components, or combine certain components, or have a different arrangement of components.
[0100] In one embodiment, a computer-readable storage medium is provided. The computer-readable storage medium may be non-volatile or volatile, and stores a computer program thereon. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0101] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0102] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0103] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0104] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0105] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for adding batch annotations to PDF files, characterized in that: The method comprises: Acquire a PDF file to be processed and an annotation data file, wherein the annotation data file records at least one annotation data and location information of the annotation data; Splitting the PDF file into a plurality of first file groups of single pages; Based on the annotation data and the positioning information of the annotation data, a plurality of second file groups are generated, wherein the second file group is a single-page PDF file with a transparent background, and the single-page PDF file contains at least one of the annotation data set based on the positioning information; Based on the page number information of the first file group and the positioning information of the annotation data set in the second file group, the first file group and the second file group are pasted together, and the pasted files are combined to obtain PDF files with batch annotations.
2. The method according to claim 1, characterized in that The step of obtaining the PDF file and the annotation data file to be processed includes: Displaying an operation panel, wherein the operation panel displays an import control for a PDF file and an import control for an annotation data file; In response to the import operation of the PDF file, the PDF file to be processed is acquired, and page number information of each page file in the PDF file is extracted; In response to the import operation of the annotation data file, the annotation data file is acquired, and the annotation data and the location information of the annotation data in the annotation data file are extracted, wherein the location information is used to indicate the page number where the annotation data is located.
3. The method according to claim 1 or 2, characterized in that: The annotation data file is a table format file or a text format file, wherein: The annotation data is stored in the annotation data file in units of columns, and the order of the rows where the annotation data are located is used as the positioning information of the annotation data; or The annotation data is stored in the annotation data file in a sequential input format, and the page identifier corresponding to the annotation data is used as the positioning information of the annotation data.
4. The method according to claim 1 or 2, characterized in that: The method further comprises: In response to the PDF file import operation, displaying the import progress of the PDF file and / or the generation progress of the first file group in real time; and / or In response to the import operation of the annotation data file, displaying the import progress of the annotation data file and / or the generation progress of the second file group in real time; and / or The progress of assembling the first file group and the second file group is displayed in real time.
5. The method according to claim 2, characterized in that: The operation panel also displays a setting control for annotation parameters; then, based on the annotation data and the positioning information of the annotation data, a plurality of second file groups are generated, including: In response to the annotation parameter setting operation, receiving at least one annotation parameter, wherein the annotation parameter includes at least one parameter of annotation coordinate position, annotation font, annotation font size and annotation font color; According to the annotation parameters, each of the annotation data is sequentially added to a plurality of single-page PDF files with transparent backgrounds to obtain a plurality of second file groups, wherein the page number information of the second file group is determined according to the positioning information of the annotation data set in the second file group.
6. The method according to claim 1 or 5, characterized in that: The method further comprises: In response to a preview operation of the annotation data, a preview interface is displayed, and a display effect of the annotation data in the PDF file is displayed in the preview interface, wherein the display effect includes at least one of a display effect of the annotation coordinate position, a display effect of the annotation font, a display effect of the annotation font size, and a display effect of the annotation font color.
7. The method according to claim 1, characterized in that The step of pasting the first file group and the second file group based on the page number information of the first file group and the location information of the annotation data set in the second file group, and combining the pasted files to obtain a batch of annotated PDF files includes: According to the page number sequence of the PDF file, searching in sequence for the first file group and the second file group corresponding to the page number sequence, and pasting the first file group and the second file group; When the first file group and / or the second file group corresponding to any page number sequence is not found, the first file group, the second file group and the pasted single-page file are deleted, and a prompt message indicating that batch annotation of files has failed is displayed; When all the first file group and the second file group are pasted together, the pasted files are combined in the order of the page numbers to obtain a PDF file with batch annotations, and the first file group, the second file group and the pasted single-page file are deleted, and a prompt message indicating that the batch annotations of the files have been successfully added is displayed.
8. A device for adding batch annotations to PDF files, characterized in that: The device comprises: A file acquisition module, used to acquire a PDF file and an annotation data file to be processed, wherein the annotation data file records at least one annotation data and location information of the annotation data; A file splitting module, used for splitting the PDF file into a plurality of first file groups of single pages; an annotation extraction module, configured to generate a plurality of second file groups based on the annotation data and the positioning information of the annotation data, wherein the second file group is a single-page PDF file with a transparent background, and the single-page PDF file contains at least one of the annotation data set based on the positioning information; The file synthesis module is used to paste the first file group and the second file group based on the page number information of the first file group and the positioning information of the annotation data set in the second file group, and combine the pasted files to obtain PDF files with batch annotations.
9. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
