Annotation group editing method and device based on PDF (Portable Document Format) text
By parsing and annotating annotation objects in PDF text, forming annotation groups and displaying associated status, it solves the problem of the inability of existing technologies to display and manage PDF text annotations, and achieves effective management and intuitive display of annotations.
Patent Information
- Application Number
- CN202410933895.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-10-01
AI Technical Summary
Existing PDF text editing technology cannot effectively manage and display all annotations in specific content areas of text, and cannot visually display the correlation between annotations.
By obtaining the annotation object selected by the user, using a third-party rendering library to parse the annotation object, marking the main annotation and sub-annotation, and rendering and displaying according to the association status, the association and display of annotation groups are realized.
All annotations in a specific content area of the PDF text can be displayed, and the correlation between annotations is visually represented to improve the convenience of annotation management and viewing.
Smart Images

Figure CN118734809A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text processing, and in particular to a PDF text-based annotation group editing method and device. Background Art
[0002] In existing PDF text editing technologies, when users annotate PDF text, they need to add multiple annotations to a specific content area of the text. Existing PDF editors usually provide filtering functions for annotation types or authors, but these functions cannot directly display the associations between different annotations. For example, when a user only wants to view all annotations in a specific content area of a PDF text, the existing technology cannot display these annotations separately, making it inconvenient to manage and view annotations of PDF text. Therefore, there is an urgent need for a technology that can effectively manage annotation groups and intuitively display the associations between annotations. Summary of the invention
[0003] The embodiment of the present invention provides a PDF text-based annotation group editing method and device, aiming to solve the problem in the prior art that all annotations in a specific content area of a PDF text cannot be displayed.
[0004] In a first aspect, an embodiment of the present invention provides a method for editing an annotation group based on a PDF text, comprising:
[0005] Acquire the annotation object selected by the user, and store the annotation object selected by the user in a first container;
[0006] Association operation: parsing the annotation object in the first container using a third-party rendering library to obtain an object parsing result; and marking the main annotation and the sub-annotation respectively according to the object parsing result, and associating the main annotation and the sub-annotation to obtain an annotation group;
[0007] When querying the annotation object associated with the target annotation object, the association status of the annotation group to which the target annotation object belongs is obtained, and rendering and display are performed according to the association status.
[0008] In a second aspect, an embodiment of the present invention provides a PDF text-based annotation group editing device, comprising:
[0009] A data acquisition unit, used for acquiring an annotation object selected by a user, and storing the annotation object selected by the user in a first container;
[0010] A data association unit is used to parse the annotation objects in the first container using a third-party rendering library to obtain an object analysis result; and to mark the main annotation and the sub-annotation respectively according to the object analysis result, and associate the main annotation and the sub-annotation to obtain an annotation group;
[0011] The data rendering unit is used to obtain the association status of the annotation group to which the target annotation object belongs when querying the annotation object associated with the target annotation object, and perform rendering and display according to the association status.
[0012] The embodiment of the present invention provides a method for editing an annotation group based on PDF text, including obtaining an annotation object selected by a user, and storing the annotation object selected by the user in a first container; association operation: using a third-party rendering library to parse the annotation object in the first container to obtain an object parsing result; and marking the main annotation and the sub-annotation respectively according to the object parsing result, and associating the main annotation and the sub-annotation to obtain an annotation group; when querying the annotation object associated with the target annotation object, obtaining the association status of the annotation group to which the target annotation object belongs, and rendering and displaying according to the association status. The present invention obtains an annotation group by marking the main annotation and the sub-annotation, and then obtains the association status of the annotation group to which the target annotation object belongs, and rendering and displaying according to the association status, so that all annotations in a specific content area of the PDF text can be fully displayed.
[0013] The embodiment of the present invention also provides a PDF text-based annotation group editing device, which also has the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0015] Figure 1 A schematic diagram of a flow chart of a PDF text-based annotation group editing method provided by an embodiment of the present invention;
[0016] Figure 2 A schematic block diagram of a PDF text-based annotation group editing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0017] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0018] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0019] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0020] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0021] See below Figure 1 , Figure 1 A schematic flow chart of a PDF text-based annotation group editing method provided by an embodiment of the present invention specifically includes steps S101 to S103.
[0022] S101, obtaining an annotation object selected by a user, and storing the annotation object selected by the user in a first container;
[0023] S102, association operation: parsing the annotation object in the first container using a third-party rendering library to obtain an object parsing result; and marking a main annotation and a sub-annotation respectively according to the object parsing result, and associating the main annotation and the sub-annotation to obtain an annotation group;
[0024] S103: When querying the annotation object associated with the target annotation object, obtain the association status of the annotation group to which the target annotation object belongs, and render and display according to the association status.
[0025] In step S101, a user interface is first provided to allow the user to select one or more annotation objects in the PDF text through intuitive operations (such as mouse click or touch selection). The user can select each annotation individually, or drag the mouse to form a selection box to select multiple annotation objects. After the annotation object is selected, the acquisition operation will be automatically performed. Specifically, the system identifies the annotation objects selected by the user and captures the relevant information of these objects (such as the type, content, author information and location of the annotation in the document, etc.). Next, the annotation objects selected by the user are stored in a data structure called a "first container". The first container is specially designed to store and manage selected annotation objects and supports subsequent processing operations such as annotation association, editing or deletion. The implementation of the first container can be an array, a list or other data structure suitable for dynamic data management, which can dynamically adjust the storage space and data index according to the operation requirements of the annotation object.
[0026] In one embodiment, the step S101 includes:
[0027] Acquire at least one annotation object selected by a user, and store the selected at least one annotation object into the first container;
[0028] Obtaining a user's annotation association instruction for the separate annotation object to be associated, and executing an association operation of the annotation object in the first container with the separate annotation object;
[0029] Alternatively, obtaining multiple annotation objects selected by the user, and storing the multiple annotation objects in the first container;
[0030] Obtain an annotation association instruction of the user's annotation objects in the first container, and perform an association operation between the annotation objects in the first container.
[0031] In this embodiment, the user selects at least one annotation object through the user interface. The user can select a single annotation object or select multiple annotation objects through interactive methods such as dragging and selecting. The selected annotation object is then stored in the data structure of the first container to facilitate subsequent operations and management. After the user selects the separate annotation object to be associated, the system receives the user's annotation association instruction. This instruction instructs the system to associate the annotation object stored in the first container with the separate annotation object. When performing this association operation, the system will create a link or reference indicating the relationship between the annotation object in the first container and the separate annotation object.
[0032] In addition, this embodiment also supports the user to select multiple annotation objects and store them in the first container. In this case, the user can issue an annotation association instruction to require the system to perform an association operation between the annotation objects in the first container, which usually involves establishing links or references between all annotation objects in the first container to indicate the relationship between them. In this way, the present invention allows the user to flexibly manage and associate annotation objects in the PDF, whether it is a single annotation or a combination of multiple annotations, and efficient association management can be achieved through the user's intuitive operation.
[0033] In step S102, a third-party rendering library (such as PDFium or Apache PDFBox) is used to parse the annotation objects stored in the data structure of the first container. The parsing process includes reading the content, type, author, and location of each annotation object in the document to obtain detailed object parsing results.
[0034] After the analysis is completed, the system determines the hierarchical relationship between annotation objects based on the analysis results. The specific operations are as follows:
[0035] Marking main annotations and sub-annotations: The system selects an annotation object as the main annotation based on preset rules (such as the creation time of the annotation or the priority specified by the user). Other related annotation objects are marked as sub-annotations;
[0036] Association of annotation objects: After determining the main annotation and sub-annotations, the system associates these annotations. The association operation is done by adding a special attribute (such as "AnnotGroup") to the main annotation, which contains a reference or link to the sub-annotation. In this way, the main annotation and all sub-annotations form an annotation group.
[0037] In one embodiment, the step S102 includes:
[0038] Parsing all annotation objects in the first container using the PDFium library to obtain creation time of all annotation objects in the first container;
[0039] All annotation objects in the first container are sorted in chronological order to obtain the object parsing result; wherein the annotation objects with earlier creation time are arranged in front.
[0040] In this embodiment, all annotation objects stored in the data structure of the first container are parsed by the third-party library PDFium. The PDFium library is a widely used open source PDF processing library that can provide efficient PDF content parsing functions. The system uses the API of the PDFium library to read the detailed information of each annotation object, including but not limited to the text content of the annotation, the author, the annotation type and its specific location in the PDF text. Importantly, the system obtains the creation time of each annotation object, which is a key factor in evaluating the relevance and priority of the annotation, and is also the basis for subsequent sorting and association processing. After parsing the creation time of the obtained annotation objects, the system will sort them according to these timestamps. The sorting operation uses the sorting algorithm in the C++ standard library (such as quick sort or merge sort) to ensure the efficiency and stability of the processing. Annotation objects with earlier creation times will be arranged in front, while newer annotation objects will be located at the back. This chronological sorting not only reflects the historical order of annotation addition, but can also be used for subsequent annotation association operations, such as determining the hierarchical relationship between the main annotation and the sub-annotation. Through the above processing, the sorted annotation object list obtained is the object parsing result. The object parsing results provide an orderly data basis for further annotation management and display, supporting advanced functions such as establishing a timeline view or a historical editing path. By using the PDFium library to parse and sort annotations, the present invention improves the efficiency and accuracy of annotation management, allowing users to more intuitively and conveniently process and view annotation information in PDF texts.
[0041] In one embodiment, the step S102 further includes:
[0042] taking the single annotation object as a main annotation and taking all annotation objects in the first container as sub-annotations;
[0043] Alternatively, the first annotation object in the object parsing result is used as the main annotation, and the remaining annotation objects are used as sub-annotations.
[0044] In this embodiment, two annotation grouping modes are supported to adapt to different usage scenarios and user needs:
[0045] A separate annotation object as a main annotation:
[0046] In this mode, the user can designate any single annotation object as the main annotation. The system treats this designated annotation object as the core of the annotation group. At the same time, all other annotation objects stored in the data structure of the first container are automatically set as sub-annotations. This grouping method is suitable for scenarios where a specific annotation has high importance or is the focus of discussion. The association between the main annotation and the sub-annotation is achieved by adding a reference to the sub-annotation in the data structure of the main annotation.
[0047] The first annotation object acts as the main annotation:
[0048] In another mode, the system automatically selects the first annotation object in the list as the main annotation based on the previous annotation object parsing and sorting results. This is usually the oldest annotation created, reflecting the starting point of the discussion. The remaining annotation objects are automatically set as sub-annotations. This automatic grouping strategy is particularly suitable for scenarios where annotations need to be viewed or processed in chronological order, such as in complex revision histories or multi-level feedback processes. By automatically setting the oldest annotation as the main annotation, the system helps users understand the development process and content hierarchy of the annotations.
[0049] Furthermore, different colors or labels can be used to distinguish the main annotations and sub-annotations on the user interface, or line graphics can be used to represent the connection between them. Through this layering and grouping method, the present invention greatly enhances the flexibility and effect of annotation management, allowing users to effectively organize and browse annotation content in PDF text according to different needs and scenarios.
[0050] In one embodiment, the step S102 further includes:
[0051] Using the operation class of the PDFium library, add the AnnotJoin attribute to the main annotation;
[0052] Get the object numbers of all the sub-annotations and save them in the form of an object number array;
[0053] Insert the object number array as an incoming parameter into the AnnotJoin attribute.
[0054] In this embodiment, the operation class of the PDFium library is used to identify and select an annotation object as the main annotation. After the main annotation is determined, the system will then add a new attribute named "AnnotJoin" to this main annotation. This attribute is used to store the sub-annotation information associated with the main annotation, and serves as a bridge to connect different annotations. Then scan all sub-annotation objects stored in the data structure of the first container. For each sub-annotation, the system uses the PDFium library to obtain its unique object number. The object number is a unique identifier for each object in the PDF text, which is used to ensure the accuracy of the reference. All the obtained sub-annotation object numbers are then arranged into an array. This array is organized according to the relevance of the sub-annotations or the order in which they are added to the container for subsequent processing and reference. Finally, the system inserts the above-mentioned object number array as an incoming parameter into the AnnotJoin attribute of the main annotation. In this way, the main annotation is associated with all the listed sub-annotation object numbers through the AnnotJoin attribute to form a structured annotation group.
[0055] In this way, when users access the main annotation, they can directly access all associated sub-annotations through the AnnotJoin property. This association not only enhances the usability and functionality of annotations, but also provides an effective way to visually and logically organize complex annotation information, which helps to better understand and review document content.
[0056] In one embodiment, the step S102 further includes:
[0057] Using the operation class of the PDFium library, add the AnnotRoot attribute to the sub-annotation;
[0058] Get the object number of the main annotation;
[0059] Insert the object number of the main annotation as an incoming parameter into the AnnotRoot attribute.
[0060] In this embodiment, the operation class of the PDFium library is used to select the sub-annotation object that needs to be associated. For each such sub-annotation, the system will add a new attribute named "AnnotRoot". The purpose of this attribute is to store a reference to the main annotation so that the relationship between the sub-annotation and the main annotation is clearly identified. Subsequently, the system will obtain the object number of the main annotation that has been used as the association center. In the PDF text, each annotation object has a unique object number, which is crucial to ensure the correctness of the references between annotations. After obtaining the object number of the main annotation, the system uses this number as an incoming parameter and inserts it into the AnnotRoot attribute of each sub-annotation. In this way, each sub-annotation will contain a reference directly pointing to the main annotation, thereby creating a structured annotation association network inside the document. This operation of adding attributes and inserting parameters enables the user or editor of the document to directly find the main annotation associated with it through the AnnotRoot attribute when accessing any sub-annotation.
[0061] In step S103, the target annotation object specified by the user is identified. After the target annotation object is determined, the system will query the association status of the annotation group to which the annotation object belongs. This query process involves accessing specific attributes of the annotation object, such as "AnnotJoin" or "AnnotRoot", which contain information about other annotation objects associated with the annotation. The system obtains detailed information of all associated annotation objects, including their location, content, and type, by parsing the association attributes of the target annotation object. When the information of all associated annotations is obtained, the system determines how to render them based on the association status of this information. For example, if an annotation is a main annotation, it may be displayed in a more eye-catching way, such as using a larger font or a different color; and the sub-annotation can be connected to the main annotation through a line, arrow, or color coding to indicate their hierarchical relationship and association.
[0062] In one embodiment, the step S103 includes:
[0063] When receiving a query instruction for the target annotation object, creating a second container;
[0064] Parsing the target annotation object using the PDFium library, and determining whether the target annotation object has an AnnotJoin attribute or an AnnotRoot attribute according to the parsing result;
[0065] If the AnnotJoin attribute exists, the attribute value of the AnnotJoin attribute is obtained and used as the target object number array, and the corresponding annotation objects are searched in sequence according to the target object number array, and the found annotation objects are continuously parsed and searched until all related annotation objects are found;
[0066] If the AnnotRoot attribute exists, the attribute value of the AnnotRoot attribute is obtained and used as the target object number, the corresponding annotation object is searched according to the target object number, and the found annotation object is continuously parsed and searched until all related annotation objects are found;
[0067] If the AnnotJoin attribute and the AnnotRoot attribute do not exist, there is no associated annotation object;
[0068] All the found associated annotation objects are stored in the second container.
[0069] In this embodiment, a query instruction for a specific target annotation object is received. In order to process this query, a data structure named "second container" is created to temporarily store annotation objects associated with the target annotation. Subsequently, the system uses the PDFium library to parse the target annotation object. The parsing includes checking whether the target annotation contains AnnotJoin attributes or AnnotRoot attributes, which indicate the association relationship between annotations. If the target annotation object has the AnnotJoin attribute, the system extracts the value of the attribute (an array of target object numbers). This array contains the numbers of all other annotation objects associated with the annotation. The system searches for the corresponding annotation objects through these numbers in turn, and further parses each found annotation object to confirm whether there are more associated annotations. This process is recursive until all associated annotation objects are identified. If the target annotation object has the AnnotRoot attribute, it indicates that the annotation is a sub-annotation of a main annotation. The system obtains the value of the AnnotRoot attribute (the target object number of the main annotation) and searches for the corresponding main annotation object based on this number. Similarly, the system will parse the main annotation object and its possible other sub-annotations, traverse more associated annotations, until all are obtained. If the target annotation object contains neither the AnnotJoin attribute nor the AnnotRoot attribute, the annotation is considered to have no associated annotation objects. In this case, the second container will not contain any annotation objects other than the target annotation. All associated annotation objects found and verified through the above process will eventually be stored in the second container. This allows the system to easily access all related annotation objects in subsequent operations, such as rendering or further analysis.
[0070] In one embodiment, the step S103 further includes:
[0071] Passing the second container into a page rendering module;
[0072] The page rendering module traverses the second container passed in, and renders and displays all annotation objects in the second container.
[0073] In this embodiment, the data structure of the second container is passed to the page rendering module. The page rendering module is a software component designed specifically for processing and displaying annotation information in PDF content, which can receive and process the data of annotation objects. After receiving the second container, the page rendering module begins to traverse all annotation objects in the container. This traversal process includes identifying the specific attributes of each annotation object, such as the type, content, location of the annotation, and its association with other annotations. For each annotation object in the container, the page rendering module performs visual rendering according to its attributes. The rendering process includes but is not limited to the following methods:
[0074] Color highlighting: Highlight comments using different colors based on their type or importance.
[0075] Connecting lines and arrows: For annotation objects with associations, use connecting lines or arrows to clearly show the connection relationship between them.
[0076] Dynamic interaction: Allow users to expand or collapse detailed content by clicking on annotations, providing an interactive document browsing experience.
[0077] Hierarchical display: Use hierarchical visual representation methods, such as shading or frames, to distinguish between main annotations and sub-annotations, as well as their associated levels.
[0078] Through the above rendering process, all annotation objects in the second container will be displayed on the corresponding page of the PDF text in an easy-to-understand and easy-to-operate way. This comprehensive visual display not only improves the visibility of the annotations, but also enhances the readability of the document and the user's interactive experience.
[0079] In one embodiment, the step S103 further includes:
[0080] Traversing all annotation objects in the second container;
[0081] Add a border to the boundary of the traversed annotation object, and enable the connection function to connect each traversed annotation object to render and display the traversed annotation object.
[0082] In this embodiment, the page rendering module starts to traverse the annotation objects, and for each traversed annotation object, the page rendering module adds a visual border on its boundary. This border is used to highlight the position and range of the annotation object, making the annotation more conspicuous and easy to identify in the PDF text. The style of the border (such as color, thickness) can be customized according to the type of annotation or user preference. At the same time, the system enables the connection function to connect the traversed annotation objects through visual connections. These connections help show the relationship between annotations, such as belonging to the same annotation group or part of a logical flow. The connection is a straight line or a curve, and can also contain arrows or other identifiers to indicate the direction of the relationship. This rendering display method enables document readers to intuitively understand the spatial position and logical relationship between annotations, thereby navigating and analyzing document content more effectively.
[0083] Combination Figure 2 As shown, Figure 2 A schematic block diagram of a PDF text-based annotation group editing device provided by an embodiment of the present invention, the PDF text-based annotation group editing device 200 includes:
[0084] The data acquisition unit 201 is used to acquire the annotation object selected by the user and store the annotation object selected by the user into a first container;
[0085] The data association unit 202 is used to parse the annotation objects in the first container using a third-party rendering library to obtain an object analysis result; and to mark the main annotation and the sub-annotation respectively according to the object analysis result, and associate the main annotation and the sub-annotation to obtain an annotation group;
[0086] The data rendering unit 203 is used to obtain the association status of the annotation group to which the target annotation object belongs when querying the annotation object associated with the target annotation object, and perform rendering and display according to the association status.
[0087] In this embodiment, the data acquisition unit 201 acquires the annotation object selected by the user and stores the annotation object selected by the user in a first container; the data association unit 202 uses a third-party rendering library to parse the annotation object in the first container to obtain an object parsing result; and according to the object parsing result, the main annotation and the sub-annotation are respectively marked, and the main annotation and the sub-annotation are associated to obtain an annotation group; when the data rendering unit 203 queries the annotation object associated with the target annotation object, it obtains the association status of the annotation group to which the target annotation object belongs, and renders and displays according to the association status.
[0088] In one embodiment, the data acquisition unit 201 includes:
[0089] a storage unit, configured to obtain at least one annotation object selected by a user, and store the selected at least one annotation object into the first container;
[0090] an associating unit, configured to obtain an annotation associating instruction from a user for a separate annotation object to be associated, and execute an associating operation between the annotation object in the first container and the separate annotation object; or obtain multiple annotation objects selected by a user, and store the multiple annotation objects in the first container;
[0091] The acquisition unit is used to acquire the annotation association instruction of the user's annotation objects in the first container, and perform an association operation between the annotation objects in the first container.
[0092] In one embodiment, the data association unit 202 includes:
[0093] A parsing unit, configured to parse all annotation objects in the first container using a PDFium library to obtain creation time of all annotation objects in the first container;
[0094] The sorting unit is used to sort all the annotation objects in the first container in chronological order to obtain the object parsing result; wherein the annotation objects with earlier creation time are arranged in front.
[0095] In one embodiment, the data association unit 202 further includes:
[0096] A classification unit is used to take the single annotation object as a main annotation and all annotation objects in the first container as sub-annotations; or, take the first annotation object in the object parsing result as the main annotation and the remaining annotation objects as sub-annotations.
[0097] In one embodiment, the data association unit 202 further includes:
[0098] An adding unit, for adding AnnotJoin attributes to the main annotation using the operation class of the PDFium library;
[0099] A numbering unit, used to obtain the object numbers of all the sub-annotations and save them in the form of an object number array;
[0100] An insertion unit is used to insert the object number array as an incoming parameter into the AnnotJoin attribute.
[0101] In one embodiment, the data association unit 202 further includes:
[0102] An annotation unit, for adding an AnnotRoot attribute to the sub-annotation using an operation class of the PDFium library;
[0103] An object unit, used to obtain an object number of the main annotation;
[0104] An incoming unit is used to insert the object number of the main annotation as an incoming parameter into the AnnotRoot attribute.
[0105] In one embodiment, the data rendering unit 203 includes:
[0106] A query unit, configured to create a second container when receiving a query instruction for the target annotation object;
[0107] A judging unit, configured to parse the target annotation object using the PDFium library, and to judge whether the target annotation object has an AnnotJoin attribute or an AnnotRoot attribute according to the parsing result;
[0108] A search unit, configured to obtain the attribute value of the AnnotJoin attribute as a target object number array if there is one, search for corresponding annotation objects in sequence according to the target object number array, and continue to parse and search for the found annotation objects until all associated annotation objects are found;
[0109] A search unit is used for obtaining the attribute value of the AnnotRoot attribute as the target object number if there is one, searching for the corresponding annotation object according to the target object number, and continuing to parse and search for the found annotation object until all the related annotation objects are found;
[0110] The association unit is used for annotation objects that have no association if the AnnotJoin attribute and the AnnotRoot attribute do not exist;
[0111] The storing unit is used to store all the found associated annotation objects into the second container.
[0112] In one embodiment, the data rendering unit 203 further includes:
[0113] A rendering unit, used for transferring the second container to a page rendering module;
[0114] The traversal unit is used to traverse the second container inputted by the page rendering module, and render and display all the annotation objects in the second container.
[0115] In one embodiment, the data rendering unit 203 further includes:
[0116] A search unit, used for traversing all annotation objects in the second container;
[0117] The connection unit is used to add a border on the boundary of the traversed annotation object, and enable the connection function to connect each traversed annotation object to render and display the traversed annotation object.
[0118] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0119] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0120] The embodiment of the present invention also provides a computer device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the computer device may also include various network interfaces, power supplies and other components.
[0121] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0122] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A PDF text-based annotation group editing method, characterized in that: include: Acquire the annotation object selected by the user, and store the annotation object selected by the user in a first container; Association operation: parsing the annotation object in the first container using a third-party rendering library to obtain an object parsing result; and marking the main annotation and the sub-annotation respectively according to the object parsing result, and associating the main annotation and the sub-annotation to obtain an annotation group; When querying the annotation object associated with the target annotation object, the association status of the annotation group to which the target annotation object belongs is obtained, and rendering and display are performed according to the association status.
2. The PDF text-based annotation group editing method according to claim 1, characterized in that: The obtaining of the annotation object selected by the user and storing the annotation object selected by the user in the first container includes: Acquire at least one annotation object selected by a user, and store the selected at least one annotation object into the first container; Obtaining a user's annotation association instruction for the separate annotation object to be associated, and executing an association operation of the annotation object in the first container with the separate annotation object; Alternatively, obtaining multiple annotation objects selected by the user, and storing the multiple annotation objects in the first container; Obtain an annotation association instruction of the user's annotation objects in the first container, and perform an association operation between the annotation objects in the first container.
3. The PDF text-based annotation group editing method according to claim 2, characterized in that: The using a third-party rendering library to parse the annotation object in the first container to obtain an object parsing result includes: Parsing all annotation objects in the first container using the PDFium library to obtain creation time of all annotation objects in the first container; All annotation objects in the first container are sorted in chronological order to obtain the object parsing result; wherein the annotation objects with earlier creation time are arranged in front.
4. The PDF text-based annotation group editing method according to claim 3, characterized in that: The marking of the main annotation and the sub-annotation respectively according to the object parsing result includes: taking the single annotation object as a main annotation and taking all annotation objects in the first container as sub-annotations; Alternatively, the first annotation object in the object parsing result is used as the main annotation, and the remaining annotation objects are used as sub-annotations.
5. The PDF text-based annotation group editing method according to claim 1, characterized in that: The main annotation and the sub-annotation are associated to obtain an annotation group, including: Using the operation class of the PDFium library, add the AnnotJoin attribute to the main annotation; Get the object numbers of all the sub-annotations and save them in the form of an object number array; Insert the object number array as an incoming parameter into the AnnotJoin attribute.
6. The PDF text-based annotation group editing method according to claim 1, characterized in that: The step of associating the main annotation with the sub-annotation to obtain an annotation group further includes: Using the operation class of the PDFium library, add the AnnotRoot attribute to the sub-annotation; Get the object number of the main annotation; Insert the object number of the main annotation as an incoming parameter into the AnnotRoot attribute.
7. The PDF text-based annotation group editing method according to claim 1, characterized in that: When querying the annotation object associated with the target annotation object, obtaining the association status of the annotation group to which the target annotation object belongs includes: When receiving a query instruction for the target annotation object, creating a second container; Parsing the target annotation object using the PDFium library, and determining whether the target annotation object has an AnnotJoin attribute or an AnnotRoot attribute according to the parsing result; If the AnnotJoin attribute exists, the attribute value of the AnnotJoin attribute is obtained and used as the target object number array, and the corresponding annotation objects are searched in sequence according to the target object number array, and the found annotation objects are continuously parsed and searched until all related annotation objects are found; If the AnnotRoot attribute exists, the attribute value of the AnnotRoot attribute is obtained and used as the target object number, the corresponding annotation object is searched according to the target object number, and the found annotation object is continuously parsed and searched until all related annotation objects are found; If the AnnotJoin attribute and the AnnotRoot attribute do not exist, there is no associated annotation object; All the found associated annotation objects are stored in the second container.
8. The PDF text-based annotation group editing method according to claim 7, characterized in that: The rendering and displaying according to the association state includes: Passing the second container into a page rendering module; The page rendering module traverses the second container passed in, and renders and displays all annotation objects in the second container.
9. The PDF text-based annotation group editing method according to claim 1, characterized in that: The rendering and displaying according to the association state includes: Traversing all annotation objects in the second container; Add a border to the boundary of the traversed annotation object, and enable the connection function to connect each traversed annotation object to render and display the traversed annotation object.
10. A PDF text-based annotation group editing device, characterized in that: include: A data acquisition unit, used for acquiring an annotation object selected by a user, and storing the annotation object selected by the user in a first container; A data association unit is used to parse the annotation objects in the first container using a third-party rendering library to obtain an object analysis result; and to mark the main annotation and the sub-annotation respectively according to the object analysis result, and associate the main annotation and the sub-annotation to obtain an annotation group; The data rendering unit is used to obtain the association status of the annotation group to which the target annotation object belongs when querying the annotation object associated with the target annotation object, and perform rendering and display according to the association status.
