A method, device and electronic device for generating and displaying online document tags
By providing an online document mark generation and display method in the browser, users can mark online documents, which solves the problem in the existing technology that users can only read but cannot mark, and improves user experience.
Patent Information
- Application Number
- CN202411454989.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-10-17
AI Technical Summary
In the prior art, users can only read online documents and cannot mark them in online documents, resulting in poor user experience.
By providing an online document mark generation and display method in the browser, users can select a text area in the document, generate a mark box, enter or select the mark type, and save it to the database.
The function of the user's labeling in the online document is realized, the user experience and satisfaction are improved, and the problem that users can only read and cannot mark can be solved.
Smart Images

Figure CN119005124B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of document processing, and in particular to a method, device and electronic device for generating and displaying online document tags. Background Art
[0002] With the rapid development of information technology, PDF documents can be converted into HTML documents using a browser to achieve online preview of documents. This allows users to preview PDF documents directly in a web browser without relying on reading software (such as Adobe Reader), making document browsing more convenient.
[0003] However, the inventors found that although the prior art can convert PDF documents into HTML format and directly preview PDF documents in web browsers, users can only read online documents but cannot mark online documents. For example, when a user is reading an online document, he / she is very touched by a certain paragraph of text and wants to mark it, which is impossible in the prior art. The user needs to download the PDF document to a local computer and then open the downloaded PDF document with reading software such as Adobe Reader. Only then can the user mark the downloaded PDF document in the reading software. Therefore, the prior art has the problem that users can only read online documents but cannot mark online documents. Summary of the invention
[0004] The embodiment of the present invention provides a method, device and electronic device for generating and displaying a mark of an online document, so as to solve the problem in the prior art that a user can only read the online document but cannot make a mark in the online document.
[0005] The specific technical solutions are as follows:
[0006] In a first aspect, an embodiment of the present invention provides a method for generating a tag of an online document, which is applied to a browser in a client, and the method includes:
[0007] In the document opening interface, real-time monitoring is performed to determine whether the user has performed a selection operation; the selection operation is an operation in which the user presses a mouse button at a text position in the document, and then drags the mouse while holding down the mouse button to select document content in the document; the document is a document opened in a browser; and the format of the document is HTML format;
[0008] When the selection operation is detected, the position where the mouse button is pressed and the movement trajectory of the mouse are obtained;
[0009] Determining the position of the selected area in the document according to the position of the pressed mouse button and the movement trajectory of the mouse;
[0010] Setting a background color for the text in the selected area and generating a mark box; the mark box includes the user name of the user, the generation time of the mark box, a text input box, a mark box type selection button and a confirmation button; the text input box receives text information input by the user;
[0011] Monitor whether the user presses the confirmation button in the mark box. If yes, save the position of the selected area and the text information input by the user into the database.
[0012] Optionally, before the step of monitoring in real time whether the user has performed the selected operation on the document opening interface, the step further includes:
[0013] Receive a request from a user to open a PDF document;
[0014] Obtaining a target PDF document according to the identification information of the PDF document in the request;
[0015] Using a format conversion tool, converting the target PDF document into an HTML document;
[0016] Open the HTML document in a browser.
[0017] Optionally, the step of saving the position of the selected area and the text information input by the user into a database includes:
[0018] Uploading the position of the selected area and the text information input by the user to a server for storage respectively;
[0019] Respectively obtaining the storage path of the position of the selected area and the storage path of the text information input by the user;
[0020] A note is generated based on the storage path of the location of the selected area and the storage path of the text information input by the user, and saved in the server; the note includes the storage path of the location of the selected area and the storage path of the text information input by the user.
[0021] Optionally, after the step of generating a note according to the storage path of the location of the selected area and the storage path of the text information input by the user and saving it to the server, the method further includes:
[0022] A note record is generated and saved in the server according to the user name, the generation time of the mark box, the identification information of the document, the identification information of the note, the text content of the selected area and the mark box type selected by the user; the note record includes: the user name, the generation time of the mark box, the identification information of the document, the identification information of the note, the text content of the selected area and the mark box type; the mark box types include note-type mark boxes and question-and-answer type mark boxes; the note-type mark box is a mark box in which only the user who creates the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box.
[0023] In a second aspect, an embodiment of the present invention provides a method for displaying a markup of an online document, which is applied to a browser in a client, and the method includes:
[0024] When opening a document, all note records corresponding to the document are obtained according to the identification information of the document; the document is a document opened in a browser; the format of the document is HTML format; the note record includes: user name, generation time of the mark box, identification information of the document, identification information of the note, text content of the selected area and mark box type; the mark box type includes a note-type mark box and a question-and-answer type mark box; the note-type mark box is a mark box in which only the user who created the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box;
[0025] According to the identification information of the note in each note record, the storage path of the location of each selected area and the storage path of each text information input by the user are respectively obtained; wherein the note includes the storage path of the location of the selected area and the storage path of the text information input by the user;
[0026] Acquire the location information of each selected area in the document according to the storage path of the location of each selected area;
[0027] Setting a background color for each selected text area in the document;
[0028] Monitor whether the user moves the mouse to the selected area. If so, obtain the user name, the generation time of the mark box and the mark box type from the note record corresponding to the selected area; obtain the text information input by the user corresponding to the selected area according to the storage path of the text information input by the user corresponding to the selected area; generate a corresponding pop-up window of the mark box according to the mark box type, and display the user name, the generation time of the mark box and the text information input by the user in the pop-up window of the mark box.
[0029] Optionally, the step of monitoring whether the user moves the mouse to the selected area includes:
[0030] Get the mouse position in real time;
[0031] Matching the acquired mouse position with the position of the selected area in the document;
[0032] If the mouse position falls within the position range of the selected area in the document, it is confirmed that the user has been monitored to move the mouse to the selected area.
[0033] In a third aspect, an embodiment of the present invention provides a device for generating a markup of an online document, the device comprising:
[0034] The selection module is used to monitor in real time whether the user has performed a selection operation in the document opening interface; the selection operation is an operation in which the user presses the mouse button at the text of the document, and drags the mouse while holding down the mouse button to select the document content in the document; the document is a document opened in a browser; the format of the document is HTML format;
[0035] An acquisition module, used for acquiring the position where the mouse button is pressed and the movement track of the mouse when the selection operation is detected;
[0036] A determination module, used for determining the position of the selected area in the document according to the position of the pressed mouse button and the movement track of the mouse;
[0037] A generating module, used to set a background color for the text in the selected area and generate a marking box; the marking box includes the user name of the user, the generation time of the marking box, a text input box, a marking box type selection button and a confirmation button; the text input box receives text information input by the user;
[0038] The saving module is used to monitor whether the user presses the confirmation button in the marking box. If yes, the position of the selected area and the text information input by the user are saved in the database.
[0039] Optionally, the device further includes: a document opening module, configured to:
[0040] Receive a request from a user to open a PDF document;
[0041] Obtaining a target PDF document according to the identification information of the PDF document in the request;
[0042] Using a format conversion tool, converting the target PDF document into an HTML document;
[0043] Open the HTML document in a browser.
[0044] Optionally, the storage module is specifically used for:
[0045] Uploading the position of the selected area and the text information input by the user to a server for storage respectively;
[0046] Respectively obtaining the storage path of the position of the selected area and the storage path of the text information input by the user;
[0047] A note is generated based on the storage path of the location of the selected area and the storage path of the text information input by the user, and saved in the server; the note includes the storage path of the location of the selected area and the storage path of the text information input by the user.
[0048] Optionally, the device further includes: a note recording module, configured to:
[0049] A note record is generated and saved in the server according to the user name, the generation time of the mark box, the identification information of the document, the identification information of the note, the text content of the selected area and the mark box type selected by the user; the note record includes: the user name, the generation time of the mark box, the identification information of the document, the identification information of the note, the text content of the selected area and the mark box type; the mark box types include note-type mark boxes and question-and-answer type mark boxes; the note-type mark box is a mark box in which only the user who creates the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box.
[0050] In a fourth aspect, an embodiment of the present invention provides a device for displaying a markup of an online document, the device comprising:
[0051] A record acquisition module is used to acquire all note records corresponding to the document according to the identification information of the document when opening the document; the document is a document opened in a browser; the format of the document is HTML format; the note record includes: user name, generation time of the mark box, identification information of the document, identification information of the note, text content of the selected area and mark box type; the mark box type includes a note-type mark box and a question-and-answer type mark box; the note-type mark box is a mark box in which only the user who created the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box;
[0052] A path acquisition module, used to acquire the storage path of each selected area and the storage path of each text information input by the user according to the identification information of the note in each note record; wherein the note includes the storage path of the selected area and the storage path of the text information input by the user;
[0053] A location acquisition module, used for acquiring location information of each selected area in the document according to a storage path of the location of each selected area;
[0054] A setting module, used for setting a background color for the text in each selected area of the document;
[0055] A pop-up window generation module is used to monitor whether the user moves the mouse to the selected area. If so, the user name, the generation time of the mark box and the mark box type are obtained from the note record corresponding to the selected area; the text information input by the user corresponding to the selected area is obtained according to the storage path of the text information input by the user corresponding to the selected area; a corresponding pop-up window of the mark box is generated according to the mark box type, and the user name, the generation time of the mark box and the text information input by the user are displayed in the pop-up window of the mark box.
[0056] Optional, pop-up window generation module, specifically used for:
[0057] Get the mouse position in real time;
[0058] Matching the acquired mouse position with the position of the selected area in the document;
[0059] If the mouse position falls within the position range of the selected area in the document, it is confirmed that the user has been monitored to move the mouse to the selected area.
[0060] In a fifth aspect, an embodiment of the present invention further provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus;
[0061] The memory is used to store computer programs;
[0062] The processor is used to implement the method steps of generating a mark for an online document described in the first aspect, or the method steps of displaying a mark for an online document described in the second aspect, when executing the program stored in the memory.
[0063] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps for generating a markup for an online document described in the first aspect or the method steps for displaying a markup for an online document described in the second aspect are implemented.
[0064] In summary, the online document tag generation method provided by the embodiment of the present invention can be implemented in the document opening interface to monitor in real time whether the user has performed a selection operation; when a selection operation is detected, the position of the mouse button pressed and the mouse movement trajectory are obtained; according to the position of the mouse button pressed and the mouse movement trajectory, the position of the selected area in the document is determined; the background color is set for the text in the selected area, and a tag box is generated; it is monitored whether the user has pressed the confirmation button in the tag box, and if so, the position of the selected area and the text information entered by the user are saved in a database. The marking display method provided by the embodiment of the present invention can realize that when a document is opened, all the note records corresponding to the document are obtained according to the identification information of the document; according to the identification information of the note in each note record, the storage path of the position of each selected area and the storage path of the text information input by each user are respectively obtained; according to the storage path of the position of each selected area, the position information of each selected area in the document is obtained; the background color is set for the text of each selected area in the document; it is monitored whether the user moves the mouse to the selected area, and if so, the user name, the generation time of the marking box and the marking box type are obtained from the note record corresponding to the selected area; according to the storage path of the text information input by the user corresponding to the selected area, the text information input by the user corresponding to the selected area is obtained; according to the type of the marking box, a corresponding pop-up window of the marking box is generated, and the user name, the generation time of the marking box and the text information input by the user are displayed in the pop-up window of the marking box. It can be seen that the marking generation method of the online document provided by the embodiment of the present invention is combined with the marking display method of the online document, which solves the problem that users can only read online documents but cannot mark in online documents in the prior art, and improves user satisfaction.
[0065] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0066] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0068] Figure 1 A schematic diagram of a flow chart of a method for generating a markup for an online document provided by an embodiment of the present invention;
[0069] Figure 2-Figure 8 A schematic diagram of part of the codes in the method for generating a markup for an online document provided by an embodiment of the present invention;
[0070] Fig. 9 A schematic diagram of a flow chart of a method for displaying a markup of an online document provided by an embodiment of the present invention;
[0071] Fig.10 A schematic diagram of the structure of a device for generating a markup for an online document provided by an embodiment of the present invention;
[0072] Fig.11 A schematic diagram of the structure of a marking display device for online documents provided by an embodiment of the present invention;
[0073] Fig.12 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;
[0074] Fig.13 A schematic diagram of the structure of another electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0075] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0076] Figure 1 A flow chart of a method for generating a tag of an online document provided by an embodiment of the present invention, wherein the method is applied to a web browser in a client, such as Figure 1 As shown, the method includes:
[0077] S101: In a document opening interface, real-time monitoring is performed to determine whether a user has performed a selection operation; the selection operation is an operation in which a user presses a mouse button at a text position in a document, and then holds down the mouse button and drags the mouse to select document content in the document; the document is a document opened in a browser; and the document is in HTML format;
[0078] The online document tag generation method provided by the embodiment of the present invention further includes, before the step of monitoring in real time whether the user has performed a selected operation on the document opening interface:
[0079] Receive a request from a user to open a PDF document;
[0080] Obtain the target PDF document according to the identification information of the PDF document in the request;
[0081] Use the format conversion tool to convert the target PDF document into an HTML document;
[0082] Open the HTML document in your browser.
[0083] In a specific embodiment, the target PDF document can be converted into an HTML document using pdf.js, which is an open source PDF document reading and parsing plug-in. PDF.js can be used to browse PDF documents directly in a web browser.
[0084] Of course, in actual applications, for documents in word, excel and other formats, you can first use a format converter to convert them into PDF documents, and then use pdf.js to open the PDF document in the browser.
[0085] S102: when a selection operation is detected, obtaining the position where the mouse button is pressed and the movement trajectory of the mouse;
[0086] S103: determining the position of the selected area in the document according to the position where the mouse button is pressed and the movement track of the mouse;
[0087] Specifically, the position of the selected area in the document may be determined according to the position where the mouse button is pressed, the movement trajectory of the mouse and the position information corresponding to each word in the document.
[0088] In a specific embodiment, when the user places the mouse on the text of the document and presses the mouse button,
[0089] The MutationObserver listener event will be triggered. During the listening process, the browser method window.getSelection() will be used to obtain the selection attribute of the selected area (see the specific code for details). Figure 2 ), and obtain the location information of the selected area through the getRangeAt method in selection (see the specific code for details). Figure 3 ).in, Figure 3 The startContainer and endContainer in the code shown are the head and tail elements of the selected area in the web page respectively.
[0090] MutationObserver is an interface in JavaScript that monitors changes in the DOM tree. MutationObserver allows developers to be notified when DOM nodes are added, deleted, attributes are modified, text content is changed, etc., and perform corresponding operations. DOM (Document Object Model) is a programming interface for HTML and XML documents. DOM represents a web document as a hierarchical structure composed of nodes. Nodes can be element sections (such as 、 etc.), attribute nodes (such as element attributes), text nodes (containing actual text content), etc. window.getSelection() is a method in JavaScript that is used to obtain the text content selected by the user in the current web page. window.getSelection() returns a Selection object, which contains information about the selected content, such as the range, anchor point, and focus position of the selected text. The properties of the Selection object are used to provide detailed information about the current selection. The getRangeAt method is used to obtain a specific range (Range object) in the selection. The getRangeAt method accepts an index value as a parameter, which indicates the position of the range to be obtained in the selection. getRangeAt can perform various operations through the obtained Range object, such as obtaining the starting node and offset of the range, extracting the content of the range, creating a document fragment containing the range content, and inserting nodes at specific locations.
[0091] In actual applications, when a user selects a text content in a document, the algorithm will generate HTML code for determining the location of the selected area in the document based on the location information of the area selected by the user. For example, when a user selects a text content in a document, the algorithm will determine that the location range of the area selected by the user is div2 to div14 based on the location information of the area selected by the user. The specific HTML code generated for determining the location of the selected area in the document is as follows: Figure 4 The code in the red box is shown in the figure.
[0092] S104: setting a background color for the text in the selected area and generating a mark box; the mark box includes the user name, the generation time of the mark box, a text input box, a mark box type selection button and a confirmation button; the text input box receives the text information input by the user;
[0093] In a specific embodiment, setting a background color for the text in the selected area may be setting a highlight for the text in the selected area. For example, in a specific embodiment, the code for setting a highlight for the text in the selected area may be referred to. Figure 5 .
[0094] The method provided by the present invention, after determining the position of the selected area, sets an identifier for the selected area, that is, sets an ID for the selected area ( Figure 6 For example, in a specific embodiment, the code for setting the ID for the selected area can be found in Figure 6 .
[0095] In a specific embodiment, the text input box can receive information input by the user in a keyboard input mode or a voice input mode. When the user inputs information in a voice input mode, the method provided in the embodiment of the present invention can convert the received voice information into text information, and display the converted text information in the text input box.
[0096] S105: monitoring whether the user presses the confirmation button in the mark box, and if so, saving the position of the selected area and the text information input by the user into the database.
[0097] Specifically, the step of saving the position of the selected area and the text information input by the user into the database may include:
[0098] Upload the location of the selected area and the text information entered by the user to the server for storage;
[0099] Respectively obtain the storage path of the location of the selected area and the storage path of the text information input by the user;
[0100] A note is generated based on the storage path of the location of the selected area and the storage path of the text information input by the user, and saved to the server; the note includes the storage path of the location of the selected area and the storage path of the text information input by the user.
[0101] For example, in a specific embodiment, the position of the selected area and the text information input by the user are uploaded to the server for storage, and a note is generated according to the storage path of the position of the selected area and the storage path of the text information input by the user. The HTML code corresponding to the step of saving to the server can be found in Figure 7 ;in, Figure 7 The path parameters are the starting position (start) and the ending position (end) of the selected area. The position of each page element can be obtained by recursively calculating each page element, and each page element is combined into the format of " / tag name [position of tag characters]". In a specific embodiment, the position of each page element is obtained by recursively calculating each page element, and each page element is combined into the HTML code corresponding to the format of " / tag name [position of tag characters]", which can be seen in 8.
[0102] In a specific embodiment, after the step of generating a note according to the storage path of the location of the selected area and the storage path of the text information input by the user and saving it to the server, the following steps may also be included:
[0103] A note record is generated and saved to the server based on the user's username, mark box generation time, document identification information, note identification information, text content of the selected area and mark box type selected by the user; the note record includes: user name, mark box generation time, document identification information, note identification information, text content of the selected area and mark box type; mark box types include note-type mark boxes and question-and-answer type mark boxes; a note-type mark box is a mark box in which only the user who created the mark box can enter text information in the text input box of the mark box; a question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box.
[0104] In the embodiment of the present invention, only when the user presses the OK button in the mark box, the mark made in the selected area will be saved to the server. If the user does not press the OK button in the mark box, but presses the mouse button outside the selected area, the mark made in the selected area will not be saved, that is, the mark will not be displayed in the document.
[0105] In other embodiments, in the method provided by the embodiment of the present invention, the mark box may also include a mark permission setting item. Through the mark permission setting item, the user can set permissions for the mark he made, for example, set the permission of a mark he made to be visible only to himself or only to a specified user. If the user sets permissions for the mark, then when the PDF document is opened again, the algorithm will determine whether the mark is visible according to the permissions set by the user. For example, user A makes a mark in a document and sets the permission of the mark to be visible only to himself. Then, if user A opens the PDF document again, the mark will be displayed in the document; and if other users open the PDF document again, the mark will not be displayed in the document. For another example, user A makes a mark in a document and sets the permission of the mark to be visible to user B and user C. Then, if user A, user B or user C opens the PDF document again, the mark will be displayed in the document; and if other users open the PDF document again, the mark will not be displayed in the document.
[0106] In the embodiment of the present invention, the note record is saved to the server using a regular expression, because regular expressions have the following advantages when processing submitted forms:
[0107] 1. Data validation: It can accurately verify the data format entered by the user, which helps to ensure that the input data complies with specific rules and improve the accuracy and completeness of the data.
[0108] 2. Enhanced security: It can prevent malicious input or unexpected data submission, and reduce potential security risks such as SQL injection attacks.
[0109] 3. Improve user experience: By providing immediate feedback on incorrect input formats, users can be guided to input correctly, avoiding errors found in subsequent processing and then being returned to the user for modification, saving user time and improving the smoothness of interaction.
[0110] 4. Unified rule application: The same validation rules can be applied consistently throughout the form to ensure data consistency and standardization.
[0111] 5. Efficient processing: Regular expressions are usually highly efficient and can quickly process large amounts of input data.
[0112] 6. Flexibility: Ability to flexibly customize various complex validation rules according to specific business needs to adapt to different form field requirements.
[0113] In summary, the online document tag generation method provided by the embodiment of the present invention can be implemented in the document opening interface, real-time monitoring of whether the user has performed a selection operation; when the selection operation is detected, the position of the mouse button pressed and the mouse movement trajectory are obtained; according to the position of the mouse button pressed and the mouse movement trajectory, the position of the selected area in the document is determined; the background color is set for the text in the selected area, and a tag box is generated; monitoring whether the user presses the confirmation button in the tag box, if yes, the position of the selected area and the text information entered by the user are saved in the database. Therefore, the online document tag generation method provided by the embodiment of the present invention can achieve the purpose of allowing users to mark in online documents, solves the problem in the prior art that users can only read online documents but cannot mark in online documents, and improves user satisfaction.
[0114] Based on the method for generating a markup of an online document provided in an embodiment of the present invention, an embodiment of the present invention further provides a method for displaying a markup of an online document on a web browser in a client, such as Fig. 9 As shown, the method includes:
[0115] S901: when opening a document, obtaining all note records corresponding to the document according to the identification information of the document;
[0116] Among them, the document is a document opened in a browser; the format of the document is HTML format; the note record includes: user name, generation time of the mark box, document identification information, note identification information, text content of the selected area and mark box type; the mark box types include note-type mark boxes and question-and-answer type mark boxes; the note-type mark box is a mark box in which only the user who created the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box.
[0117] In practical applications, the online document markup display method provided by the embodiment of the present invention, before opening the document, further includes:
[0118] Receive a request from a user to open a PDF document;
[0119] Obtain the target PDF document according to the identification information of the PDF document in the request;
[0120] Use pdf.js to convert the target PDF document into an HTML document.
[0121] S902: According to the identification information of the note in each note record, respectively obtain the storage path of the location of each selected area and the storage path of each text information input by the user;
[0122] The note includes the storage path of the location of the selected area and the storage path of the text information input by the user.
[0123] S903: Acquire the position information of each selected area in the document according to the storage path of the position of each selected area;
[0124] S904: Setting the background color for each selected text area in the document;
[0125] Specifically, the text in each selected area in the document is set to be highlighted.
[0126] S905: Monitor whether the user moves the mouse to the selected area. If so, obtain the user name, the time when the mark box is generated, and the type of the mark box from the note record corresponding to the selected area; obtain the text information input by the user corresponding to the selected area according to the storage path of the text information input by the user corresponding to the selected area; generate a corresponding pop-up window of the mark box according to the type of the mark box, and display the user name, the time when the mark box is generated, and the text information input by the user in the pop-up window of the mark box.
[0127] If not, continue to execute the step of monitoring whether the user moves the mouse to the selected area.
[0128] In a specific embodiment, the step of monitoring whether the user moves the mouse to the selected area may include:
[0129] Get the mouse position in real time;
[0130] Match the acquired mouse position with the position of the selected area in the document;
[0131] If the mouse position falls within the position range of the selected area in the document, it is confirmed that the user has detected moving the mouse to the selected area.
[0132] In summary, the marking display method provided by the embodiment of the present invention can be implemented to obtain all note records corresponding to the document according to the identification information of the document when opening the document; obtain the storage path of the position of each selected area and the storage path of the text information input by each user according to the identification information of the note in each note record; obtain the position information of each selected area in the document according to the storage path of the position of each selected area; set the background color for the text in each selected area in the document; monitor whether the user moves the mouse to the selected area, and if so, obtain the user name, the generation time of the marking box and the marking box type from the note record corresponding to the selected area; obtain the text information input by the user corresponding to the selected area according to the storage path of the text information input by the user corresponding to the selected area; generate a corresponding pop-up window of the marking box according to the type of the marking box, and display the user name, the generation time of the marking box and the text information input by the user in the pop-up window of the marking box. It can be seen that the mark display method provided in the embodiment of the present invention can realize displaying the marks made by the user in the PDF document when the user opens the document. Combined with the mark generation method for the online document provided in the embodiment of the present invention, it solves the problem in the prior art that the user can only read the online document but cannot make marks in the online document, thereby improving user satisfaction.
[0133] and Figure 1 Corresponding to the embodiment shown, the embodiment of the present invention also provides a device for generating a markup for an online document. Fig.10 As shown, the device includes: a selection module 1001, an acquisition module 1002, a determination module 1003, a generation module 1004, and a storage module 1005, wherein:
[0134] The selection module 1001 is used to monitor in real time whether the user has performed a selection operation in the document opening interface; the selection operation is an operation in which the user presses the mouse button at the text of the document, and then holds down the mouse button and drags the mouse to select the document content in the document; the document is a document opened in a browser; and the format of the document is HTML format;
[0135] The acquisition module 1002 is used to acquire the position of the pressed mouse button and the movement track of the mouse when a selection operation is detected;
[0136] The determination module 1003 is used to determine the position of the selected area in the document according to the position where the mouse button is pressed and the movement track of the mouse;
[0137] The generating module 1004 is used to set the background color for the text in the selected area and generate a mark box; the mark box includes the user name, the generation time of the mark box, the text input box, the mark box type selection button and the confirmation button; the text input box receives the text information input by the user;
[0138] The saving module 1005 is used to monitor whether the user presses the confirmation button in the mark box. If yes, the position of the selected area and the text information input by the user are saved in the database.
[0139] Optionally, the device further includes: a document opening module, configured to:
[0140] Receive a request from a user to open a PDF document;
[0141] Obtain the target PDF document according to the identification information of the PDF document in the request;
[0142] Use the format conversion tool to convert the target PDF document into an HTML document;
[0143] Open the HTML document in your browser.
[0144] Optionally, the saving module 1005 is specifically used for:
[0145] Upload the location of the selected area and the text information entered by the user to the server for storage;
[0146] Respectively obtain the storage path of the location of the selected area and the storage path of the text information input by the user;
[0147] A note is generated based on the storage path of the location of the selected area and the storage path of the text information input by the user, and saved to the server; the note includes the storage path of the location of the selected area and the storage path of the text information input by the user.
[0148] Optionally, the device further includes: a note recording module, configured to:
[0149] A note record is generated and saved to the server based on the user's username, mark box generation time, document identification information, note identification information, text content of the selected area and mark box type selected by the user; the note record includes: user name, mark box generation time, document identification information, note identification information, text content of the selected area and mark box type; mark box types include note-type mark boxes and question-and-answer type mark boxes; a note-type mark box is a mark box in which only the user who created the mark box can enter text information in the text input box of the mark box; a question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box.
[0150] In summary, the marking generation device for online documents provided by the embodiment of the present invention can monitor in real time whether the user has performed a selection operation in the document opening interface; when the selection operation is detected, obtain the position of the mouse button pressed and the movement trajectory of the mouse; determine the position of the selected area in the document according to the position of the mouse button pressed and the movement trajectory of the mouse; set a background color for the text in the selected area and generate a marking box; monitor whether the user has pressed the confirmation button in the marking box, and if so, save the position of the selected area and the text information entered by the user to the database. Therefore, the marking generation device for online documents provided by the embodiment of the present invention can achieve the purpose of allowing users to mark in online documents, solve the problem in the prior art that users can only read online documents but cannot mark in online documents, and improve user satisfaction.
[0151] and Fig. 9 Corresponding to the embodiment shown in FIG. 1 , the embodiment of the present invention further provides a marking display device for an online document. Fig.11 As shown, the device includes: a record acquisition module 1101, a path acquisition module 1102, a location acquisition module 1103, a setting module 1104, and a pop-up window generation module 1105, wherein:
[0152] The record acquisition module 1101 is used to acquire all note records corresponding to the document according to the identification information of the document when opening the document; the document is a document opened in a browser; the format of the document is HTML format; the note record includes: user name, generation time of the mark box, identification information of the document, identification information of the note, text content of the selected area and mark box type; the mark box type includes a note-type mark box and a question-and-answer type mark box; the note-type mark box is a mark box in which only the user who created the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box;
[0153] The path acquisition module 1102 is used to respectively acquire the storage path of the location of each selected area and the storage path of each text information input by the user according to the identification information of the note in each note record; wherein the note includes the storage path of the location of the selected area and the storage path of the text information input by the user;
[0154] The position acquisition module 1103 is used to acquire the position information of each selected area in the document according to the storage path of the position of each selected area;
[0155] The setting module 1104 is used to set the background color for each selected area of the text in the document;
[0156] The pop-up window generation module 1105 is used to monitor whether the user moves the mouse to the selected area. If so, the user name, the generation time of the mark box and the mark box type are obtained from the note record corresponding to the selected area; the text information input by the user corresponding to the selected area is obtained according to the storage path of the text information input by the user corresponding to the selected area; a corresponding pop-up window of the mark box is generated according to the mark box type, and the user name, the generation time of the mark box and the text information input by the user are displayed in the pop-up window of the mark box.
[0157] Optionally, the pop-up window generation module 1105 is specifically used for:
[0158] Get the mouse position in real time;
[0159] Match the acquired mouse position with the position of the selected area in the document;
[0160] If the mouse position falls within the position range of the selected area in the document, it is confirmed that the user has detected moving the mouse to the selected area.
[0161] In summary, the mark display device provided by the embodiment of the present invention can be implemented to obtain all note records corresponding to the document according to the identification information of the document when opening the document; obtain the storage path of the position of each selected area and the storage path of the text information input by each user according to the identification information of the note in each note record; obtain the position information of each selected area in the document according to the storage path of the position of each selected area; set the background color for the text in each selected area in the document; monitor whether the user moves the mouse to the selected area, and if so, obtain the user name, the generation time of the mark box and the mark box type from the note record corresponding to the selected area; obtain the text information input by the user corresponding to the selected area according to the storage path of the text information input by the user corresponding to the selected area; generate a corresponding pop-up window of the mark box according to the mark box type, and display the user name, the generation time of the mark box and the text information input by the user in the pop-up window of the mark box. It can be seen that the mark display device provided in the embodiment of the present invention can display the marks made by the user in the PDF document when the user opens the document. Combined with the mark generation method for online documents provided in the embodiment of the present invention, it solves the problem in the prior art that users can only read online documents but cannot make marks in online documents, thereby improving user satisfaction.
[0162] and Figure 1 Corresponding to the embodiment shown, the embodiment of the present invention further provides an electronic device, see Fig.12 , including a processor 1201, a communication interface 1202, a memory 1203 and a communication bus 1204, wherein the processor 1201, the communication interface 1202, and the memory 1203 communicate with each other through the communication bus 1204;
[0163] Memory 1203, used for storing computer programs;
[0164] The processor 1201 is configured to implement the steps of any of the methods for generating a markup for an online document described in the above embodiments when executing a program stored in the memory.
[0165] The electronic device provided by the embodiment of the present invention can achieve the purpose of enabling users to mark online documents, solves the problem in the prior art that users can only read online documents but cannot mark online documents, and improves user satisfaction.
[0166] and Fig. 9 Corresponding to the embodiment shown, the embodiment of the present invention further provides an electronic device, see Fig.13 , including a processor 1301, a communication interface 1302, a memory 1303 and a communication bus 1304, wherein the processor 1301, the communication interface 1302, and the memory 1303 communicate with each other through the communication bus 1304;
[0167] Memory 1303, used for storing computer programs;
[0168] The processor 1301 is configured to implement the steps of any of the methods for displaying a markup of an online document described in the above embodiments when executing a program stored in the memory.
[0169] The electronic device provided in the embodiment of the present invention can display the marks made by the user in the PDF document when the user opens the document. Combined with the online document mark generation method provided in the embodiment of the present invention, it solves the problem in the prior art that the user can only read the online document but cannot make marks in the online document, thereby improving user satisfaction.
[0170] and Figure 1 Corresponding to the embodiment shown, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method steps for generating a markup of any online document described in the above embodiments are implemented.
[0171] The storage medium provided in the embodiment of the present invention can achieve the purpose of enabling users to mark online documents, solves the problem in the prior art that users can only read online documents but cannot mark online documents, and improves user satisfaction.
[0172] and Fig. 9 Corresponding to the embodiment shown, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method steps for displaying a markup of any online document described in the above embodiments are implemented.
[0173] The storage medium provided in the embodiment of the present invention can display the marks made by the user in the PDF document when the user opens the document. Combined with the mark generation method for online documents provided in the embodiment of the present invention, it solves the problem in the prior art that users can only read online documents but cannot make marks in the online documents, thereby improving user satisfaction.
[0174] It should be understood by those skilled in the art that the embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program codes.
[0175] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0176] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0177] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0178] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for generating a tag for an online document, characterized in that: Applied to a browser in a client, the method comprises: In the document opening interface, real-time monitoring is performed to determine whether the user has performed a selection operation; the selection operation is an operation in which the user presses a mouse button at a text position in the document, and then drags the mouse while holding down the mouse button to select document content in the document; the document is a document opened in a browser; and the format of the document is HTML format; When the selection operation is detected, the position where the mouse button is pressed and the movement trajectory of the mouse are obtained; Determining the position of the selected area in the document according to the position of the pressed mouse button and the movement trajectory of the mouse; Setting a background color for the text in the selected area and generating a mark box; the mark box includes the user name of the user, the generation time of the mark box, a text input box, a mark box type selection button and a confirmation button; the text input box receives text information input by the user; monitoring whether the user presses the confirmation button in the mark box, and if so, saving the position of the selected area and the text information input by the user into a database; Before the step of monitoring in real time whether the user has performed the selected operation in the document opening interface, the step further includes: Receive a request from a user to open a PDF document; Obtaining a target PDF document according to the identification information of the PDF document in the request; Using a format conversion tool, converting the target PDF document into an HTML document; Open the HTML document in a browser; The step of saving the position of the selected area and the text information input by the user into a database comprises: Uploading the position of the selected area and the text information input by the user to a server for storage respectively; Respectively obtaining the storage path of the position of the selected area and the storage path of the text information input by the user; According to the storage path of the location of the selected area and the storage path of the text information input by the user, a note is generated and saved in the server; the note includes the storage path of the location of the selected area and the storage path of the text information input by the user; After the step of generating a note according to the storage path of the location of the selected area and the storage path of the text information input by the user and saving it to the server, the method further includes: A note record is generated and saved in the server according to the user name, the generation time of the mark box, the identification information of the document, the identification information of the note, the text content of the selected area and the mark box type selected by the user; the note record includes: the user name, the generation time of the mark box, the identification information of the document, the identification information of the note, the text content of the selected area and the mark box type; the mark box types include note-type mark boxes and question-and-answer type mark boxes; the note-type mark box is a mark box in which only the user who creates the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box.
2. A method for displaying a markup of an online document, characterized in that: The markup of the online document is generated by the method of claim 1 and applied to a browser in a client, comprising the following steps: When opening a document, all note records corresponding to the document are obtained according to the identification information of the document; the document is a document opened in a browser; the format of the document is HTML format; the note record includes: user name, generation time of the mark box, identification information of the document, identification information of the note, text content of the selected area and mark box type; the mark box type includes a note-type mark box and a question-and-answer type mark box; the note-type mark box is a mark box in which only the user who created the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box; According to the identification information of the note in each note record, the storage path of the location of each selected area and the storage path of each text information input by the user are respectively obtained; wherein the note includes the storage path of the location of the selected area and the storage path of the text information input by the user; Acquire the location information of each selected area in the document according to the storage path of the location of each selected area; Setting a background color for each selected text area in the document; Monitor whether the user moves the mouse to the selected area. If so, obtain the user name, the generation time of the mark box and the mark box type from the note record corresponding to the selected area; obtain the text information input by the user corresponding to the selected area according to the storage path of the text information input by the user corresponding to the selected area; generate a corresponding pop-up window of the mark box according to the mark box type, and display the user name, the generation time of the mark box and the text information input by the user in the pop-up window of the mark box.
3. The method according to claim 2, characterized in that The step of monitoring whether the user moves the mouse to the selected area includes: Get the mouse position in real time; Matching the acquired mouse position with the position of the selected area in the document; If the mouse position falls within the position range of the selected area in the document, it is confirmed that the user has been monitored to move the mouse to the selected area.
4. A device for generating a markup for an online document, characterized in that: The method as claimed in claim 1, comprising: The selection module is used to monitor in real time whether the user has performed a selection operation in the document opening interface; the selection operation is an operation in which the user presses the mouse button at the text of the document, and drags the mouse while holding down the mouse button to select the document content in the document; the document is a document opened in a browser; the format of the document is HTML format; An acquisition module, used for acquiring the position where the mouse button is pressed and the movement track of the mouse when the selection operation is detected; A determination module, used for determining the position of the selected area in the document according to the position of the pressed mouse button and the movement track of the mouse; A generating module, used to set a background color for the text in the selected area and generate a marking box; the marking box includes the user name of the user, the generation time of the marking box, a text input box, a marking box type selection button and a confirmation button; the text input box receives text information input by the user; The saving module is used to monitor whether the user presses the confirmation button in the marking box. If yes, the position of the selected area and the text information input by the user are saved in the database.
5. A marking display device for an online document, characterized in that: The device according to claim 4 further comprises: A record acquisition module is used to acquire all note records corresponding to the document according to the identification information of the document when opening the document; the document is a document opened in a browser; the format of the document is HTML format; the note record includes: user name, generation time of the mark box, identification information of the document, identification information of the note, text content of the selected area and mark box type; the mark box type includes a note-type mark box and a question-and-answer type mark box; the note-type mark box is a mark box in which only the user who created the mark box can enter text information in the text input box of the mark box; the question-and-answer type mark box is a mark box in which all users can enter text information in the text input box of the mark box; A path acquisition module, used to acquire the storage path of each selected area and the storage path of each text information input by the user according to the identification information of the note in each note record; wherein the note includes the storage path of the selected area and the storage path of the text information input by the user; A location acquisition module, used to acquire location information of each selected area in the document according to a storage path of the location of each selected area; A setting module, used for setting a background color for the text in each selected area of the document; A pop-up window generation module is used to monitor whether the user moves the mouse to the selected area. If so, the user name, the generation time of the mark box and the mark box type are obtained from the note record corresponding to the selected area; the text information input by the user corresponding to the selected area is obtained according to the storage path of the text information input by the user corresponding to the selected area; a corresponding pop-up window of the mark box is generated according to the mark box type, and the user name, the generation time of the mark box and the text information input by the user are displayed in the pop-up window of the mark box.
6. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method steps described in any one of claims 1 or 2-3 when executing the program stored in the memory.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 or 2-3 are implemented.
Citation Information
Patent Citations
Browser-oriented webpage labeling system
CN101739415A
Method and device for achieving firefox browser webpage version PDF text labeling
CN116522876A