A method for online browsing of OFD documents
The online browsing method for OFD documents addresses resource inefficiencies and user experience issues by parsing and indexing document elements, employing preloading strategies, and optimizing text selection and copying, resulting in improved efficiency and stability.
Patent Information
- Application Number
- CN202011629226.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-31
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2040-12-31
AI Technical Summary
Existing online browsing solutions for OFD documents suffer from high resource usage and poor user experience due to the generation of numerous HTML elements, especially when dealing with large documents, leading to browser instability and inefficient text copying.
An online browsing method that parses OFD documents to obtain index information of elements, displays elements using user interfaces, and employs preloading and real-time loading strategies to minimize HTML element generation and optimize resource utilization, allowing efficient text selection and copying.
The method significantly reduces resource consumption and improves browsing efficiency by minimizing HTML element generation and optimizing text selection and copying processes, ensuring smooth operation and reduced system load.
Smart Images

Figure CN112800366B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to an OFD document online browsing method. Background Art
[0002] On October 14, 2016, my country issued the GB / T33190-2016 standard for electronic document storage and exchange format and layout documents. The introduction of the OFD standard is the first time that my country has its own national-level layout format and technology, which is more conducive to the integration of the entire industry and promotes the rapid development of related applications.
[0003] As one of my country's independent electronic format document standards, OFD documents have technical features such as high readability, easy expansion, and support for separate expansion, and are widely used in the e-government industry. With the widespread use of OFD, more and more B / S architecture systems have the need for online preview of web pages.
[0004] Existing online browsing solutions for OFD document web pages usually use technologies such as npapi, ppapi, and activex to call the rendering technology of the local OFD client program for online browsing of web pages. However, since the client program must be installed on the local machine, there are security risks. The plug-in can steal the underlying system permissions and occupy a high amount of browser resources, which may cause the browser to freeze or become unstable.
[0005] CN110765385A "A method and system for browsing OFD documents on web pages" proposes a method and system for quickly previewing multiple pages of OFD documents on a web page, which is loaded on demand in an asynchronous manner. This method will not have any problems in previewing OFD documents with a small number of pages, but if the OFD document has a large number of pages and a lot of text, a large number of html tag elements will be generated. The increase in html elements will cause the web page to be very stuck and the user experience will be poor. If the document needs to be zoomed in and out, a large number of html elements will be redrawn, which will not only cause a jam, but also consume a lot of browser memory, and even cause the browser to crash.
[0006] Therefore, there is a need for a technical solution for online browsing of electronic documents with higher resource utilization efficiency and smooth text copying. Summary of the invention
[0007] The present application provides an online browsing method for electronic documents, which is used to solve the problems of high resource usage and inconvenient text copying operation in the prior art solutions.
[0008] The present application provides a method for online browsing of electronic documents, comprising:
[0009] Parse the OFD document to be browsed, and obtain index information of a first element and a second element different from the first element of the OFD document;
[0010] Displaying the first element in a first user interface according to the index information;
[0011] receiving a browsing instruction from a user for a second element;
[0012] The second element is displayed using a second user interface according to the user's browsing instruction and the index information.
[0013] Further, in a preferred implementation manner provided in the present application, parsing the OFD document to be browsed and obtaining index information of a first element and a second element different from the first element of the OFD document specifically includes:
[0014] Parse the OFD document to be browsed, obtain index information of the background image of the OFD document, and obtain index information of the text of the OFD document.
[0015] Further, in a preferred implementation manner provided by the present application, parsing the OFD document to be browsed and obtaining the index information of the background image of the OFD document specifically includes:
[0016] Parse the OFD document to be browsed and obtain the page structure information of the OFD document;
[0017] According to the page structure information of the OFD document, the OFD document is grouped in pages, and HTML tags of all groups are generated;
[0018] The HTML tags of the groups and the HTML tags of the pages of the OFD document are determined as the index information of the background image of the OFD document.
[0019] Further, in a preferred implementation manner provided by the present application, parsing the OFD document to be browsed and obtaining the index information of the text of the OFD document specifically includes:
[0020] Parse the OFD document to be browsed and obtain the coordinates of the text within the page of the OFD document as the index information of the text.
[0021] Furthermore, in a preferred implementation manner provided in the present application, displaying the first element in a first user interface according to the index information further includes:
[0022] Based on the current page number n, determine whether the first element of pages ni to n+j has been loaded in the cache;
[0023] If not loaded, load the first element of page ni to page n+j, and update the cache. The cache has a preset cache capacity. If the cache capacity is exceeded, clear the initial cache record and add the latest cache record.
[0024] The first element is displayed using a first user interface according to a user browsing operation.
[0025] Where n, i, and j are natural numbers.
[0026] Further, in a preferred implementation manner provided in the present application, displaying the second element with the second user interface according to the user's browsing instruction and the index information specifically includes:
[0027] According to the user's browsing instructions, determine the coordinates of the group's HTML tags, page's HTML tags, and text;
[0028] Determine the text based on the HTML tags of the group, the HTML tags of the page, and the coordinates of the text;
[0029] The determined text is displayed.
[0030] Further, in a preferred embodiment provided in the present application, displaying the determined text specifically includes:
[0031] When the browsing instruction is a selected instruction, recording the text into a memory;
[0032] Generate a blank DIV tag in the coordinate area of the selected text.
[0033] Furthermore, in a preferred embodiment provided by the present application, displaying the determined text further includes:
[0034] When the browsing instruction is a cancel selection instruction, the blank DVI label generated by the coordinate area of the selected text is destroyed.
[0035] Furthermore, in a preferred embodiment provided by the present application, displaying the determined text further includes:
[0036] When the browsing instruction is a reselection instruction, the blank DVI tag generated in the coordinate area of the selected text is destroyed, the reselected text is recorded in the memory, and a blank DIV tag is generated in the coordinate area of the reselected text.
[0037] Furthermore, in a preferred embodiment provided by the present application, displaying the determined text further includes:
[0038] When the browsing instruction is a copy instruction, the corresponding text information is copied to the clipboard.
[0039] The document browsing method of the embodiment of the present application has a significantly reduced document structure. When browsing OFD documents online, the preview area is mainly composed of grouped HTML DIVs and page HTML DIVs. The text information is temporarily stored in the memory, and the corresponding DIV tag is generated only when it is selected, thereby avoiding the generation and redrawing of a large number of HTML elements, further saving system resources, and improving browsing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0041] Figure 1 A flowchart of a method for online browsing of electronic documents provided in an embodiment of the present application. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0043] Please refer to Figure 1 , the electronic document online browsing method provided in the embodiment of the present application specifically comprises the following steps:
[0044] S100: Parse the OFD document to be browsed, and obtain index information of a first element and a second element different from the first element of the OFD document.
[0045] Further, in a preferred embodiment provided by the present application, parsing the OFD document to be browsed and obtaining index information of a first element and a second element different from the first element of the OFD document specifically includes:
[0046] Parse the OFD document to be browsed, obtain index information of the background image of the OFD document, and obtain index information of the text of the OFD document.
[0047] Specifically, the first element is the background image of the OFD document, the second element is the text of the OFD document, and the index information includes the index information of the background image of the OFD document and the index information of the text of the OFD document. The background image is the page content displayed by OFD to the current user. According to all the elements (including background, graphics, images, text, etc.) in the OFD document page, a picture file is uniformly generated as the background image. The text information includes the specific text in the current page and its corresponding format.
[0048] Further, in a preferred embodiment provided by the present application, parsing the OFD document to be browsed and obtaining the index information of the background image of the OFD document specifically includes:
[0049] Parse the OFD document to be browsed and obtain the page structure information of the OFD document;
[0050] According to the page structure information of the OFD document, the OFD document is grouped in pages, and HTML tags of all groups are generated;
[0051] The HTML tags of the groups and the HTML tags of the pages of the OFD document are determined as the index information of the background image of the OFD document.
[0052] The page structure information of the document includes the total number of pages, document chapter structure information, etc. The page structure of the OFD document also supports template page description. The content that needs to be displayed repeatedly on each page can be uniformly described in the template page. The document can contain multiple template pages. The template page includes attributes such as ID, Name, BaseLoc and ZOrder.
[0053] When there are many document pages, the document can be grouped according to the document page structure, and then the document reading efficiency can be improved by reading different groups step by step. The document grouping can be divided equally according to the number of document pages according to certain rules, or it can be divided according to the chapter structure information of the document.
[0054] Through group tags, you can manage document groups and quickly point to specific groups for review through tags.
[0055] Furthermore, in a preferred embodiment provided by the present application, parsing the OFD document to be browsed and obtaining the index information of the text of the OFD document specifically includes:
[0056] Parse the OFD document to be browsed and obtain the coordinates of the text within the page of the OFD document as the index information of the text.
[0057] By associating text and its coordinates, combined with grouping and page numbers, it is possible to quickly determine whether text information exists at any location in the OFD document, as well as the content of the text information.
[0058] S200: Displaying the first element in a first user interface according to the index information.
[0059] Specifically, the first element is the background image of the OFD document, which is the page content displayed by OFD to the user. According to the elements to be displayed in the OFD document page (including background, graphics, images, text, etc.), a picture file is uniformly generated as the background image. The first user interface is the browser interface of the user loading OFD, and the background image of the corresponding page is displayed according to the user's browsing process.
[0060] Furthermore, in a preferred embodiment provided in the present application, displaying the first element in a first user interface according to the index information further includes:
[0061] Based on the current page number n, determine whether the first element of pages ni to n+j has been loaded in the cache;
[0062] If not loaded, load the first element of page ni to page n+j, and update the cache. The cache has a preset cache capacity. If the cache capacity is exceeded, clear the initial cache record and add the latest cache record.
[0063] The first element is displayed using a first user interface according to a user browsing operation.
[0064] Where n, i, and j are natural numbers.
[0065] The present application adopts a method combining preloading and real-time loading to load the document to be browsed. The loading rules can be set according to the system resource situation and browsing requirements. Usually, the pages before and after the current page are preloaded based on the current page. Specifically, based on the current page n, it is determined whether the pages ni to n+j before and after it have been loaded. If they have been loaded, the background image of the corresponding page is loaded for subsequent browsing or operation. If not loaded, the page data information of the pages ni to n+j is requested from the server, the background image of the corresponding page is loaded, and the browser cache is updated.
[0066] S300: receiving a browsing instruction from a user for a second element.
[0067] Specifically, the second element is the text information of the OFD document. During the browsing process, the user needs to select, unselect, reselect or copy the text information displayed in the OFD document background image. The user's browsing instructions can be accepted by mouse clicking and dragging, touch point sliding, and keyboard shortcuts. Taking mouse clicking as an example, when the left mouse button is pressed, the relative coordinates sx, sy of the starting position and the corresponding page pageNo are recorded. Keep the left mouse button pressed and move the mouse. Each movement will generate a position coordinate x, y. Compare the two coordinates in order from top to bottom and from left to right to determine the starting and ending coordinates relative to this order. If there is a cross-page situation during the mouse movement, the end position of the current page will be set to the lower right corner coordinates of pageNo, recorded as a set of starting and ending position coordinates, reset sx, sy to the coordinates of the upper left corner of pageNo, and repeat the above steps.
[0068] S400: Displaying a second element with a second user interface according to a browsing instruction of the user and the index information.
[0069] In the embodiment of the present application, when no browsing instruction for the second element is received from the user, only the background image of the first element is loaded, and the text information of the second element is not loaded. Only when a browsing instruction for the text information of the second element is received, the relevant text information is displayed according to the browsing instruction and index information of the user. The second user interface is a browsing interface for users to browse the text information of the corresponding area of the OFD document.
[0070] Specifically, when a user browses the text information displayed in the OFD document background image, it is determined whether there is text information in the user's browsing area and the specific content of the text information based on the user's browsing area, combined with the grouped HTML tags, page HTML tags, and text coordinates.
[0071] Further, in a preferred embodiment provided by the present application, displaying the determined text specifically includes:
[0072] When the browsing instruction is a selected instruction, recording the text into a memory;
[0073] Generate a blank DIV tag in the coordinate area of the selected text.
[0074] When the browsing instruction is a selection instruction, during the user's selection process, the text information is only stored in the memory, and only empty tags of the corresponding text are generated on the document page. Only when the selection is completed, the corresponding text is obtained through the index information according to the position of these empty tags. In this way, repeated multiple rendering of a large amount of text information can be avoided, and the online browsing efficiency can be optimized.
[0075] Furthermore, in a preferred embodiment provided by the present application, displaying the determined text further includes:
[0076] When the browsing instruction is a cancel selection instruction, the blank DVI label generated by the coordinate area of the selected text is destroyed.
[0077] When the browsing instruction is a cancel selection instruction, the blank DVI label generated by the coordinate area of the selected text is destroyed in time to release system resources and optimize online browsing efficiency.
[0078] Furthermore, in a preferred embodiment provided by the present application, displaying the determined text further includes:
[0079] When the browsing instruction is a reselection instruction, the blank DVI tag generated in the coordinate area of the selected text is destroyed, the reselected text is recorded in the memory, and a blank DIV tag is generated in the coordinate area of the reselected text.
[0080] When the browsing instruction is a reselect instruction, that is, when the user reselects a new area in the current selection state, the blank DIV tag generated in the coordinate area of the previously selected text is destroyed, the reselected text is recorded in the memory, and a blank DIV tag is generated in the coordinate area of the reselected text. By promptly destroying the blank DIV tag of the text area that is no longer selected, system resources are released and online browsing efficiency is optimized.
[0081] Furthermore, in a preferred embodiment provided by the present application, displaying the determined text further includes:
[0082] When the browsing instruction is a copy instruction, the corresponding text information is copied to the clipboard.
[0083] When the text is selected, the copy command can be executed to read the selected text and its format information from the memory through the blank DIV tag in the selected text area, and copy it to the clipboard. When the copy operation is completed, the user clicks the left button to clear the text information record in the selected area, destroy the blank DIV tag, and release the memory space in time.
[0084] The document browsing method of the embodiment of the present application has a significantly reduced document structure. When browsing OFD documents online, the preview area mainly has two layers, namely, group HTML DIV and page HTML DIV. The text information is temporarily stored in the memory, and the corresponding DIV tag will be generated only when it is selected.
[0085] Since there is no transparent text layer, there is no DIV overlap problem. Different from the default text selection and copying on the browser, the present invention generates a DIV tag for the selected text in real time, and the text can be selected even if it is copied to a blank area, ensuring the continuity of the copy. The browser cache size is limited to prevent a large amount of information from existing in the memory, relieving the pressure on the browser.
[0086] In a typical configuration, a computer may include one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0087] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0088] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0089] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0090] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0091] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for online browsing of OFD documents, characterized in that: include: Parse the OFD document to be browsed, and obtain index information of a first element and a second element different from the first element of the OFD document; Displaying the first element in a first user interface according to the index information; receiving a browsing instruction from a user for a second element; Displaying the second element with a second user interface according to the user's browsing instruction and the index information; The process of parsing the OFD document to be browsed and obtaining index information of the first element and the second element different from the first element of the OFD document specifically includes: Parse the OFD document to be browsed, obtain the index information of the background image of the OFD document, and obtain the index information of the text of the OFD document; The OFD document to be browsed is parsed to obtain the index information of the background image of the OFD document, which specifically includes: Parse the OFD document to be browsed and obtain the page structure information of the OFD document; According to the page structure information of the OFD document, the OFD document is grouped in pages, and HTML tags of all groups are generated; Determine the HTML tags of the group and the HTML tags of the page of the OFD document as the index information of the background image of the OFD document; The process of parsing the OFD document to be browsed and obtaining the index information of the text of the OFD document specifically includes: Parse the OFD document to be browsed and obtain the coordinates of the text in the page of the OFD document as the index information of the text; The method of displaying the second element in a second user interface according to the browsing instruction of the user and the index information specifically includes: When a user browses the text information displayed in the background image of the OFD document, it is determined whether there is text information in the area browsed by the user, and the specific content of the text information, based on the area browsed by the user, combined with the HTML tags of the group, the HTML tags of the page, and the coordinates of the text; Displaying the second element in a second user interface according to the user's browsing instruction and the index information specifically includes: According to the user's browsing instructions, determine the coordinates of the group's HTML tags, page's HTML tags, and text; Determine the text based on the HTML tags of the group, the HTML tags of the page, and the coordinates of the text; displaying said text determined; Displaying the determined text, specifically including: When the browsing instruction is a selected instruction, recording the text into a memory; Generate a blank DIV tag in the coordinate area of the selected text; Displaying the determined text also includes: When the browsing instruction is a cancel selection instruction, destroying the blank DVI label generated by the coordinate area of the selected text; Displaying the determined text also includes: When the browsing instruction is a reselection instruction, destroying the blank DVI tag generated in the coordinate area of the selected text, recording the reselected text into the memory, and generating a blank DIV tag in the coordinate area of the reselected text; Displaying the determined text also includes: When the browsing instruction is a copy instruction, the corresponding text information is copied to the clipboard.
2. The method for online browsing of OFD documents according to claim 1, characterized in that: Displaying the first element in a first user interface according to the index information also includes: Based on the current page number n, determine whether the first element of pages ni to n+j has been loaded in the cache; If not loaded, load the first element of page ni to page n+j, and update the cache. The cache has a preset cache capacity. If the cache capacity is exceeded, clear the initial cache record and add the latest cache record. Displaying the first element in a first user interface according to a user browsing operation; Where n, i, and j are natural numbers.
Citation Information
Patent Citations
OFD document webpage end browsing method and system
CN110765385A
OFD file online analysis and browsing method and device
CN110717127A
OFD document processing method, electronic equipment and computer readable storage medium
CN111897776A
Generation method of PDF document by editing andmerging documents from mutiple application
KR1020070042684A