A method for realizing instant preview of files

By using asynchronous transcoding programs and multithreading technology in the computer background, realizing instant preview of documents is solved, and the problem of too long loading time caused by synchronous transcoding is improved, and the user experience and loading speed are improved.

CN113705152BActive Publication Date: 2024-11-19YOZOSOFT CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202010431489.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-05-20
Publication Date
2024-11-19
Estimated Expiration
2040-05-20

AI Technical Summary

Technical Problem

In the prior art, synchronous transcoding is adopted when loading documents, resulting in too long loading time, affecting user experience and information acquisition time, especially documents with a large number of pages are loading slower.

Method used

Using an asynchronous transcoding program, by creating auxiliary threads in the computer background to parse the file contents and starting loading when the user previews the first page. Using multi-threading and JAVA technology to achieve asynchronous response, users can preview the document in advance and continue to load subsequent content in the background. Implement lazy loading function.

Benefits of technology

Realizes instant preview of files, and users can view content without waiting for the document to be loaded, which improves loading speed and concurrency efficiency and reduces waiting time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113705152B_ABST
    Figure CN113705152B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for realizing instant file preview, comprising: implanting an asynchronous transcoding program into a computer, a user uploads a file to the computer, and calling the asynchronous transcoding program from a background server of the computer; the asynchronous transcoding program obtains information of the uploaded file, and creates an auxiliary thread to parse the file to obtain a conversion result; the auxiliary thread sends the obtained conversion result to the computer through the asynchronous transcoding program, and the computer obtains the conversion result, and the conversion result includes a web page preview address; the user opens the web page preview address on the computer, and the first page of the file is quickly loaded, and the auxiliary thread created by the asynchronous transcoding program continues to load subsequent content in the background. The method of the present invention responds to the user first when receiving a request, and the user can preview in advance, thereby improving concurrency efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for realizing instant file preview, and in particular to a method for realizing instant file preview based on JAVA multi-process and multi-thread. Background Art

[0002] When we use a browser to open a web document for preview, the document loading time is relatively long, especially when encountering a document with many pages, the web page loading speed is slower. This phenomenon is mainly related to the current document transcoding method. The current document transcoding method is synchronous transcoding, that is, all pages of the document must be transcoded in the background before the preview address is returned to the user. At this time, the web page opened by the user will be loaded and the preview interface will be displayed. This means that the longer the document pages, the longer the loading time. This transcoding method makes the user experience bad, and the long loading time also affects the time to obtain information and delays reading and learning time.

[0003] Therefore, it is urgent to propose a new technical solution to solve the above problems. Summary of the invention

[0004] The purpose of the present invention is to solve the problems existing in the prior art and provide a method for realizing instant file preview. The technical solution adopted is:

[0005] A method for implementing instant file preview, comprising:

[0006] The asynchronous transcoding program is implanted in a computer, a user uploads a file to the computer, and the asynchronous transcoding program is called from a background server of the computer;

[0007] Furthermore, the asynchronous transcoding program obtains information of the uploaded file and creates an auxiliary thread to parse the file to obtain a conversion result;

[0008] Further, the auxiliary thread sends the obtained conversion result to the computer through the asynchronous transcoding program, and the computer obtains the conversion result, wherein the conversion result includes a web page preview address;

[0009] Furthermore, when a user opens the web page preview address on a computer, the first page of the file is quickly loaded, and the auxiliary thread created by the asynchronous transcoding program continues to load subsequent content in the background.

[0010] In the above technical solution, the asynchronous transcoding program has a user interface, and the user uploads the file to the computer, and calls the asynchronous transcoding program from the user interface through the background server of the computer;

[0011] Furthermore, the asynchronous transcoding program obtains relevant information of the file through the user interface.

[0012] Furthermore, the asynchronous transcoding program includes a main thread, the main thread obtains relevant information of the file through the user interface, and creates an auxiliary thread to parse the file to obtain a conversion result;

[0013] Furthermore, the analysis includes analyzing the length structure and homepage content of the file, and the conversion result includes a preview page obtained after the file homepage content is analyzed.

[0014] Furthermore, the main thread is in a waiting state when the auxiliary thread parses the file. If the auxiliary thread parses and obtains a preview page of the content of the first page of the file, the auxiliary thread transmits the preview page to the main thread, and the main thread transmits the preview page to the computer through the background server, and the computer obtains the preview page and the web page preview address.

[0015] Furthermore, the preview page is stored in the web page preview address.

[0016] Furthermore, the user opens the web page preview address in a computer browser, and the web page loads a preview page of the file homepage content obtained by parsing the auxiliary thread.

[0017] Furthermore, when the user previews the preview page of the homepage content of the file, the auxiliary thread of the asynchronous transcoding program continues to parse the subsequent content of the file, and the preview page obtained by the analysis is continuously updated in the web page address until the file content is completely parsed.

[0018] Furthermore, the auxiliary thread of the asynchronous transcoding program continues to parse the subsequent content of the file homepage, and the preview page obtained by parsing is continuously updated in the webpage address, specifically including:

[0019] The user scrolls the pointer to load the subsequent page content. When the user scrolls the pointer to the next page, the auxiliary thread parses the file. After the parsing is completed, the content of the preview page is presented as the current page of the web page through the main thread. When parsing the current page, the auxiliary thread parses the multiple preview pages after the current page by default and stores them in the web page address.

[0020] Compared with the prior art, the present invention has one or more of the following beneficial effects:

[0021] 1. The present invention provides a method for realizing instant file preview. When a user previews a word document through an asynchronous transcoding program, there is no need to wait for the document to be fully transcoded. The user only needs to call the auxiliary thread of the asynchronous transcoding program to parse the content of the first page of the file, so that the document content can be quickly responded to and viewed. Then, under the guidance of the pointer, the lazy loading function is realized. When the pointer points to a page, the page is previewed and loaded under the analysis of the auxiliary thread, so that the instant preview of the file is realized;

[0022] 2. The asynchronous transcoding described in the present invention is relative to the synchronous transcoding. Synchronous transcoding means that the document will be returned to the user's preview address only after each page is converted in the background. Asynchronous transcoding returns the preview address to the user only after the first page of the document is converted. While the user is previewing, the background is also converting at the same time. The two tasks are processed at the same time. Asynchronous transcoding mainly refers to a time-consuming operation or work. It does not need to wait for the operation to be completed before responding to the user. Instead, it responds to the user when the request is received. The user can preview in advance to improve the concurrency efficiency;

[0023] 3. The asynchronous transcoding program described in the present invention is developed in the background using JAVA technology, and uses a multi-threaded method to achieve asynchronous response requirements. The client uses the http protocol to initiate a request to the relevant interface of the server, and the server asynchronously processes the request and quickly responds to the client. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0025] Figure 1 It is a schematic diagram of a window supporting a running program that is called out of a page using a request response time for loading a preview file using synchronous transcoding in the prior art, wherein the program response calling out time is 5176s;

[0026] Figure 2 It is a schematic diagram of a window supporting a running program that is called out of a page of a request response time for loading a preview file by asynchronous transcoding in the present invention, wherein the program response calling out time is 743s;

[0027] Figure 3 : is a schematic diagram of a window for loading a file using an asynchronous transcoding program in the present invention, wherein the screen window is divided into two small windows on the left and right, the window on the left is a preview page of the home page of an example file, and the window on the right is a window for detecting and capturing requests initiated by a browser;

[0028] Figure 4This is a schematic diagram of a window in which the asynchronous transcoding program is used to load a file in the present invention, wherein the screen window is divided into two small windows on the left and right. The window on the left is Figure 3 The preview page of page 3 of the sample file shown is shown. The window on the right is the window for detecting and capturing requests initiated by the browser. DETAILED DESCRIPTION

[0029] The following will be combined with the accompanying drawings of the embodiments of the present invention to clearly and completely describe the technical solutions of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0030] In the description of the present invention, it should be understood that the terms "upper", "lower", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In the description of the present invention, "plurality" means two or more, unless otherwise clearly and specifically defined.

[0031] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0032] The gist of the present invention is further explained below with reference to the accompanying drawings and embodiments.

[0033] Example:

[0034] In view of the problems existing in the prior art, the present invention provides a method for realizing instant file preview. Figure 1-4 , a method for implementing instant file preview, comprising:

[0035] The asynchronous transcoding program is implanted in a computer, a user uploads a file to the computer, and the asynchronous transcoding program is called from a background server of the computer;

[0036] The asynchronous transcoding program obtains information of the uploaded file and creates an auxiliary thread to parse the file to obtain a conversion result;

[0037] The auxiliary thread sends the obtained conversion result to the computer through the asynchronous transcoding program, and the computer obtains the conversion result, wherein the conversion result includes a web page preview address;

[0038] The user opens the web page preview address on the computer, and the first page of the file is quickly loaded, and the auxiliary thread created by the asynchronous transcoding program continues to load subsequent content in the background.

[0039] In one embodiment, the asynchronous transcoding program of the present invention has a user interface, and the user uploads the file to the computer, and calls the asynchronous transcoding program from the user interface through the background server of the computer;

[0040] The asynchronous transcoding program obtains relevant information of the file through the user interface.

[0041] In one embodiment, the asynchronous transcoding program of the present invention includes a main thread, the main thread obtains the relevant information of the file through the user interface, and creates an auxiliary thread to parse the file to obtain the conversion result;

[0042] The analysis includes analyzing the length structure and homepage content of the file, and the conversion result includes a preview page obtained after the file homepage content is analyzed;

[0043] The main thread is in a waiting state when the auxiliary thread parses the file. If the auxiliary thread parses and obtains a preview page of the file homepage content, the auxiliary thread transmits the preview page to the main thread. The main thread transmits the preview page to the computer through the background server, and the computer obtains the preview page and the web page preview address.

[0044] The preview page is stored in the web page preview address,

[0045] The user opens the web page preview address in a computer browser, and the web page loads a preview page of the file homepage content obtained by parsing the auxiliary thread.

[0046] When the user previews the preview page of the first page content of the file, the auxiliary thread of the asynchronous transcoding program continues to parse the subsequent content of the file, and the preview page obtained by parsing is continuously updated in the web page address until the file content is completely parsed.

[0047] The auxiliary thread of the asynchronous transcoding program continues to parse the subsequent content of the file homepage, and the preview page obtained by parsing is continuously updated in the webpage address, specifically including:

[0048] The user scrolls the pointer to load the subsequent page content. When the user scrolls the pointer to the next page, the auxiliary thread parses the file. After the parsing is completed, the content of the preview page is presented as the current page of the web page through the main thread. When parsing the current page, the auxiliary thread parses the multiple preview pages after the current page by default and stores them in the web page address.

[0049] The implementation principle of the method for realizing instant file preview described in the present invention is as follows:

[0050] After the user uploads the file, the asynchronous transcoding interface function is called to the server (asynchronous mainly refers to a time-consuming operation or work. There is no need to wait for the operation to be completed before responding to the user. Instead, the server responds to the user upon receiving the request. The user can preview in advance to improve concurrency efficiency). Asynchronous transcoding obtains the document in the background and creates an auxiliary thread to perform parsing. After parsing the general structure of the document and the document information of the first page, the preview page can be built based on this. At the same time, the original main thread waiting outside is notified. The main thread sends the conversion result to the client, that is, the preview web page address. The user does not need to wait for all pages to be built before previewing. The transcoding only needs to complete the first page to return to the user's preview view. While the user is previewing the page, the background service is still performing subsequent page number conversion operations.

[0051] The asynchronous transcoding program of the present invention is developed by using JAVA technology in the background, and uses multi-threading to realize asynchronous response requirements. The client uses the http protocol to initiate a request to the relevant interface of the server, and the server asynchronously processes the request and quickly responds to the client. Part of the code is as follows:

[0052]

[0053]

[0054] With the support of this program, the server returns the user preview address. After entering the user preview address, the user can directly see the content of the first page. At the same time, the server will continue to complete the subsequent parsing of document information and build the transcoding work of the preview page. The front-end JS (javascript technology) implements lazy loading technology, that is, when the user scrolls to other pages, the content of the page will be loaded. If the page has not been built, it will display the waiting state. (For example: when the user scrolls the page to view the second page content, JS will request the third and fourth pages from the background, but will not request the fifth page and later content. Only when the user scrolls to view the fourth page will it start to load the fifth and sixth pages). The JS part of the code is as follows:

[0055]

[0056] Please continue to see Figure 1-2 , Figure 1 It is a schematic diagram of a window supporting a running program that is called out of a page using a request response time for loading a preview file using synchronous transcoding in the prior art, wherein the program response calling out time is 5176s; Figure 2 It is a schematic diagram of a window supporting a running program that is called out of a page of a request response time for loading a preview file by asynchronous transcoding in the present invention, wherein the program response calling out time is 743s;

[0057] contrast Figure 1 , Figure 2 From the obtained program response calling time, it can be found that the method for realizing instant file preview of the present invention indeed improves the loading speed of file preview.

[0058] Please continue to see Figure 3-4 , Figure 3 : is a schematic diagram of a window for loading a file using an asynchronous transcoding program in the present invention, wherein the screen window is divided into two small windows on the left and right, the window on the left is a preview page of the home page of an example file, and the window on the right is a window for detecting and capturing requests initiated by a browser; Figure 4 This is a schematic diagram of a window in which the asynchronous transcoding program is used to load a file in the present invention, wherein the screen window is divided into two small windows on the left and right. The window on the left is Figure 3 The preview page of page 3 of the sample file shown is shown. The window on the right is the window for detecting and capturing requests initiated by the browser.

[0059] Figure 3 and Figure 4 It is a continuous action. Figure 3 Open the sample file's homepage preview page, from Figure 3 In the small window on the right, you can find that when the first page is loaded, the content of the second and third pages has been preloaded in the web page. Just move the mouse pointer to the second or third page, and the preloaded content of the second and third pages will be loaded on the corresponding web page. Similarly, Figure 4 In the same lazy loading mode, when the current preview page is page 3, the content of pages 4 and 5 will be automatically preloaded and loaded quickly as long as the user turns the page. Figure 3 , 4 The small window on the left is a normal preview page, and the small window on the right is all the requested information viewed by the browser console. Through the requested information, you can see that when previewing the corresponding page number, only the page number information related to it is loaded.

[0060] In summary, the present invention provides a method for realizing instant preview of files. When a user previews a word document through an asynchronous transcoding program, there is no need to wait for the entire document to be transcoded. The user only needs to call the auxiliary thread of the asynchronous transcoding program to parse the content of the first page of the file, so that the document content can be quickly responded to. After that, the lazy loading function is realized under the guidance of the pointer and the page indicated by the pointer is previewed and loaded under the analysis of the auxiliary thread, thereby realizing instant preview of the file and improving concurrency efficiency.

[0061] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification.

[0062] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify and vary the above embodiments within the scope of the present invention.

Claims

1. A method for implementing instant file preview, characterized in that: include: The asynchronous transcoding program is implanted in a computer, a user uploads a file to the computer, and the asynchronous transcoding program is called from a background server of the computer; The asynchronous transcoding program obtains information of the uploaded file, and creates an auxiliary thread to parse the file to obtain a conversion result, specifically including: the asynchronous transcoding program includes a main thread, the main thread obtains relevant information of the file through a user interface, and creates an auxiliary thread to parse the file to obtain a conversion result; the parsing includes parsing the length structure and homepage content of the file, and the conversion result includes a preview page obtained after parsing the homepage content of the file; The auxiliary thread sends the obtained conversion result to the computer through the asynchronous transcoding program, and the computer obtains the conversion result, wherein the conversion result includes a web page preview address; The user opens the web page preview address on the computer, and the first page of the file is quickly loaded. The auxiliary thread created by the asynchronous transcoding program continues to parse subsequent content in the background, specifically including: the preview page is stored in the web page preview address, and the user opens the web page preview address in a computer browser. The web page loads a preview page of the file homepage content obtained by parsing the auxiliary thread. When the user previews the preview page of the file homepage content, the auxiliary thread of the asynchronous transcoding program continues to parse the subsequent content of the file, and the preview page obtained by parsing is continuously updated in the web page address until the file content is completely parsed.

2. The method according to claim 1, characterized in that The asynchronous transcoding program has a user interface, and the user uploads the file to the computer and calls the asynchronous transcoding program from the user interface through the background server of the computer; The asynchronous transcoding program obtains relevant information of the file through the user interface.

3. The method according to claim 1, characterized in that: The main thread is in a waiting state when the auxiliary thread parses the file. If the auxiliary thread parses and obtains a preview page of the file homepage content, the auxiliary thread transmits the preview page to the main thread. The main thread transmits the preview page to the computer through the background server, and the computer obtains the preview page and the web page preview address.

4. The method according to claim 1, characterized in that: The auxiliary thread of the asynchronous transcoding program continues to parse the subsequent content of the file homepage, and the preview page obtained by the analysis is continuously updated in the web page address, specifically including: when the user scrolls the pointer to load the subsequent page content, when the user scrolls the pointer to the next page, the auxiliary thread performs file parsing, and after the parsing is completed, the content of the preview page is presented as the current page of the web page through the main thread. When parsing the current page, the auxiliary thread defaults to parsing multiple preview pages after the current page and stores them in the web page address.

Citation Information

Patent Citations

  • Print preview method based on WINCE system

    CN101593087A

  • Method for asynchronous loading of word processing document

    CN102467488A

  • Page loading method and device, computer equipment and storage medium

    CN109582890A

  • A file preview method, apparatus and storage medium

    CN110582764A

  • File online preview method and device, equipment and storage medium

    CN110688595A