Document online preview method, device, electronic device and storage medium

By constructing an ordered data block mapping table and merging network read operations, the problem of slow loading speed of PDF document online preview is solved and faster document loading speed is achieved.

CN113011128BActive Publication Date: 2024-09-06BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110246686.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-05
Publication Date
2024-09-06
Estimated Expiration
2041-03-05

AI Technical Summary

Technical Problem

In the prior art, when previewing a PDF document online, the method of first downloading and then previewing results in a long file download time, which affects the user experience. How to improve the loading speed of the online file preview has become an urgent problem to be solved.

Method used

By obtaining the cross-reference table of the document from the cloud server, constructing an array of ordered data block mapping tables, and merging the network reading operations of the data blocks required for the current page to be accessed based on this table, reducing the number of network requests and improving network reading efficiency.

Benefits of technology

It effectively reduces the number of network requests and data volume, significantly improves the loading speed of online preview of PDF documents, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113011128B
    Figure CN113011128B
Patent Text Reader

Abstract

The present application discloses a document online preview method, device, electronic device and storage medium, and relates to the computer technology field such as network document processing. The specific implementation scheme is: obtain the cross-reference table of the document from the cloud server, and construct an ordered data block mapping table array according to the cross-reference table; obtain the current page to be accessed according to the position of the cross-reference table, and extract all dependent objects in the current page to be accessed to construct the data block array required for the current page to be accessed; merge the network reading operations of the data blocks in the data block array required for the current page to be accessed according to the ordered data block mapping table array, and obtain the merged network read request; obtain the corresponding data content from the cloud server according to the merged network read request; render the page according to the data content, and display the rendered page. Through this implementation scheme, the number of network requests is reduced and the loading speed of the document online preview is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, specifically to the field of network document processing technology, and in particular to a document online preview method, device, electronic device and storage medium. Background Art

[0002] PDF (Portable Document Format) is an electronic file format. In the client era, PDF readers mainly focus on local preview. Among the domestic products, the more famous ones are Adobe PDF Reader and Foxit PDF Reader.

[0003] With the rapid development of the Internet, PDF online preview has become increasingly popular among users. Users expect faster opening speeds, but the related technologies usually adopt the method of "download first and then preview", which makes the download time of the entire file a very serious problem. How to improve the online loading speed of PDF has become an urgent problem to be solved. Summary of the invention

[0004] The present application provides a method, apparatus, device and storage medium for online preview of a document.

[0005] According to a first aspect of the present application, a document online preview method is provided, comprising:

[0006] Obtaining a cross-reference table of the document from a cloud server, and constructing an ordered data block mapping table array according to the cross-reference table;

[0007] Acquire the current page to be accessed according to the position of the cross-reference table, and extract all dependent objects in the current page to be accessed to construct a data block array required by the current page to be accessed;

[0008] Merging network read operations of data blocks in the data block array required by the current page to be accessed according to the ordered data block mapping table array, and obtaining a merged network read request;

[0009] Acquire corresponding data content from the cloud server according to the combined network read request;

[0010] The page is rendered according to the data content, and the rendered page is displayed.

[0011] According to a second aspect of the present application, a device for online previewing of a document is provided, comprising:

[0012] A first acquisition module, used for acquiring a cross-reference table of the document from a cloud server;

[0013] A first construction module, configured to construct an ordered data block mapping table array according to the cross-reference table;

[0014] A second acquisition module, used for acquiring the current page to be accessed according to the position of the cross-reference table;

[0015] A second construction module is used to extract all dependent objects of the current page to be accessed to construct a data block array required by the current page to be accessed;

[0016] A merging module, used for merging the network reading operations of the data blocks in the data block array required by the current page to be accessed according to the ordered data block mapping table array, and obtaining a merged network reading request;

[0017] A third acquisition module, configured to acquire corresponding data content from the cloud server according to the combined network read request;

[0018] The display module is used to render the page according to the data content and display the rendered page.

[0019] According to a third aspect of the present application, an electronic device is provided, including:

[0020] at least one processor; and

[0021] a memory communicatively connected to the at least one processor; wherein,

[0022] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the document online preview method described in the embodiment of the first aspect of the present application.

[0023] According to a fourth aspect of the present application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the document online preview method described in the embodiment of the first aspect of the present application.

[0024] According to a fifth aspect of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements the document online preview method described in the embodiment of the first aspect of the present application.

[0025] The technology according to the present application solves the problem of how to improve the online preview loading speed of files in the prior art. By constructing an ordered data block mapping table array and merging the network reading operations of the data blocks required for the current page to be accessed according to the ordered data block mapping table array, the number of network requests can be reduced and the network reading efficiency can be improved, thereby improving the online preview loading speed of the document.

[0026] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present application.

[0028] Figure 1 is a flowchart of a method for online previewing of a file proposed according to an embodiment of the present application;

[0029] Figure 2 It is a flow chart of establishing an ordered data mapping table array in a method for online file previewing proposed in an embodiment of the present application;

[0030] Figure 3 It is a flow chart of merging operations of network reading methods of data blocks in a file online preview method proposed in an embodiment of the present application;

[0031] Figure 4 It is a flowchart of another method of merging data blocks in a network reading method in an online file preview method proposed in an embodiment of the present application;

[0032] Figure 5 is a flowchart of another method for online previewing of files proposed according to an embodiment of the present application;

[0033] Figure 6 is a flowchart of another method for online file previewing proposed according to an embodiment of the present application;

[0034] Figure 7 It is a structural block diagram of a file online preview device proposed according to an embodiment of the present application;

[0035] Figure 8 It is a structural block diagram of another file online preview device proposed according to an embodiment of the present application;

[0036] Fig. 9 It is a block diagram of an electronic device used to implement the file online preview method of an embodiment of the present application. DETAILED DESCRIPTION

[0037] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0038] At present, most online previews of PDF documents adopt the method of downloading first and then previewing, that is, the document needs to be downloaded first and then previewed locally after downloading. In this way, users can only preview the document after waiting for the entire document to be downloaded. Therefore, how to allow users to preview documents faster has become a very important issue.

[0039] In order to solve the above problems, the present application proposes a document online preview method, device, electronic device and storage medium.

[0040] Figure 1 It is a flowchart of a method for online previewing a document according to an embodiment of the present application. It should be noted that the method for online previewing a document according to an embodiment of the present application can be applied to an online previewing device according to an embodiment of the present application, and the online previewing device can be configured in an electronic device.

[0041] It should be noted that the document online preview method provided in the embodiment of the present application is applicable to PDF documents, and some embodiments in the present application will be described using PDF as an example. The PDF document format includes four parts: a header, a body, a cross-reference table, and a trailer. Among them, the header is the first line of the PDF document, which specifies the version number of the PDF specification used by the document; the body is composed of a series of objects used in the PDF document, and the objects are unified into data blocks in the embodiment of the present application; the body is used to store all document data displayed to the user, and the content in the body is an index established by the data block within the page; the cross-reference table is an address index table of an indirect object established in order to enable random access to the indirect object; the trailer is the entry point of the entire PDF document, and generally PDF readers start reading PDF from the tail of the file.

[0042] like Figure 1 As shown, the document online preview method may include:

[0043] Step 101, obtain the cross-reference table of the document from the cloud server, and construct an ordered data block mapping table array according to the cross-reference table.

[0044] It should be noted that the PDF document's trailer gives the address of the PDF document's cross-reference table, so in order to obtain the document's cross-reference table, you need to first obtain the document's trailer information. Obtaining the document's cross-reference table from the cloud server can be achieved in the following ways: obtaining the document's trailer information from the cloud server; obtaining the document's cross-reference table from the cloud server based on the trailer information.

[0045] The number after the startxref field in the file tail information of the document is the physical offset address information of the document cross-reference table in the document, so that the cross-reference table of the document is obtained from the cloud server according to the physical offset address information of the cross-reference table.

[0046] It should be noted that the cross-reference table in the document contains information such as the total number of data blocks included in the document, the number of each data block, the physical offset address of each data block in the document, and the physical offset addresses of the data blocks arranged from top to bottom are not arranged in order.

[0047] Therefore, in order to arrange the document content in order and improve the speed of loading the document online preview, the embodiment of the present application constructs an ordered data block mapping table array for ordered document page data indexing according to the cross-reference table. The ordered data block mapping table array includes all data blocks in the document, and the number, address information and size information of each data block, and all data blocks in the ordered data block mapping table array are arranged in ascending order according to the physical offset address of each data block in the document.

[0048] Step 102, obtaining the current page to be accessed according to the position of the cross-reference table, and extracting all dependent objects in the current page to be accessed to construct a data block array required by the current page to be accessed.

[0049] In an embodiment of the present application, the current page to be accessed is obtained according to the position of the cross-reference table, wherein the current page to be accessed is the page to be previewed. Since each page in the document contains data information that needs to be presented, that is, each page in the document is composed of one or more data blocks, extracting all dependent objects in the current page to be accessed here is to extract the dependent data blocks in the current page to be accessed. Among them, extracting all dependent objects in the current page to be accessed includes the number of data blocks in the current page to be accessed and the number of each data block, and constructing the data block array required for the current page to be accessed according to the number of data blocks extracted in the current page to be accessed and the number of each data block.

[0050] Step 103 , merging the network read operations of the data blocks in the data block array required by the current page to be accessed according to the ordered data block mapping table array, and obtaining a merged network read request.

[0051] It should be noted that the preview of the page needs to first request the cloud server through the network reading task to obtain the data required for page loading. Among them, the loading speed of the document page preview is closely related to the data volume of the network reading request and the number of network reading requests. It can be understood that the smaller the data volume of the network reading request or the fewer the number of network reading requests, the faster the loading speed of the document page preview. Therefore, in this step, the network reading operations of the data blocks in the data block array required for the current page to be accessed can be merged according to the ordered data block mapping table array, so as to obtain the corresponding data content from the cloud server based on the merged network reading request.

[0052] Step 104 , obtaining corresponding data content from the cloud server according to the combined network read request.

[0053] Step 105, rendering the page according to the data content, and displaying the rendered page.

[0054] According to the method for online preview of documents in the embodiment of the present application, an ordered data block mapping table data group is constructed, and the network reading operations of the data blocks required for the current page to be accessed are merged according to the ordered data block mapping table data group, thereby effectively reducing the number of network requests. At the same time, each network request is in units of data blocks, thereby improving the loading speed of the online preview of the document.

[0055] In an embodiment of the present application, constructing an ordered data block mapping table array based on a cross-reference table includes: obtaining the total number of data blocks contained in the document and the address information of each data block from the cross-reference table; and establishing an ordered data block mapping table array based on the total number of data blocks and the address information of each data block.

[0056] In some embodiments of the present application, Figure 2 As shown, according to the total number of data blocks and the address information of each data block, the specific steps of establishing an ordered data block mapping table array may include:

[0057] Step 201: Create an empty data block mapping table array according to the total number of data blocks.

[0058] In an embodiment of the present application, each data block mapping table in the data block mapping table array includes:

[0059] The first element is used to indicate the address information of the data block;

[0060] The second element is used to indicate the size of the data block;

[0061] The third element is a number used to indicate the location pointed to by the address information of the data block.

[0062] It should be noted that the number of data block mapping tables in the data block mapping table array is consistent with the total number of data blocks, that is, the data block mapping table array is composed of data block mapping tables, and each data block has a data block mapping table.

[0063] Step 202: assign a value to each element of the data block mapping table in the data block mapping table array according to the address information of each data block, so as to obtain an ordered data block mapping table array.

[0064] It should be noted that the offset addresses of each data block arranged from top to bottom in the cross-reference table of the document obtained from the cloud server are arranged in disorder. The offset address represents the relative position of each data block in the document. Therefore, if you want to obtain an ordered data block mapping table array, you need to first sort the data blocks in the cross-reference table from small to large according to the offset address, that is, sort them according to the arrangement order of the data blocks in the document.

[0065] In an embodiment of the present application, the first element in the mapping table of each data block, that is, the address information used to indicate the data block, that is, the physical offset address of the data block in the document, can be directly obtained in the cross-reference table, and the offset address of each data block directly obtained in the cross-reference table is assigned to the first element of the mapping table of each corresponding data block.

[0066] In addition, the second element in the mapping table of each data block indicates the size of the corresponding data block, that is, the spatial size of the start position and the end position of the current data block in the document, which can be calculated in the following way: all data blocks are arranged from small to large according to the offset address, and the size of the current data block can be expressed as the difference between the physical offset address of the next data block in the document and the physical offset address of the current data block in the document, which is calculated and assigned to the second element in the corresponding data block mapping table. To more clearly illustrate its implementation method, the following example will be used to further illustrate:

[0067] For example, if a document contains n data blocks, the physical offset address of each data block is represented by Pos, and the size of each data block is represented by Size. The first three data blocks in the document after sorting by offset address are:

[0068] The first data block, Pos=000000017;

[0069] The second data block, Pos=000000169;

[0070] The third data block, Pos = 000000225, then,

[0071] The size of the first data block is Size = 169-17;

[0072] The size of the second data block is Size = 225-169, that is,

[0073] In the mapping table of the first data block, the second element is 169-17;

[0074] In the mapping table of the second data block, the second element is 225-169.

[0075] It should be noted that the cross-reference table includes both the total number of all data blocks in the document and the starting number of the data blocks. Each data block in the cross-reference table is numbered by adding 1 to the starting number from top to bottom in the original order, that is, each data block in the cross-reference table has its own number, which is the third element in the data block mapping table in the embodiment of the present application. Among them, the original order refers to the default order of the cross-reference table obtained directly from the cloud, that is, the order of arrangement of each data block that has not been sorted.

[0076] In the embodiment of the present application, after the above assignment, the established empty data block mapping table array obtains an ordered data block mapping table array.

[0077] It should be noted that there are many ways to merge the network read operations of the data blocks in the data block array required for the current page to be accessed. As an example, the network read operations of the data blocks in the data block array required for the current page to be accessed can be merged according to the adjacent relationship between the data block mapping tables in the ordered data block mapping table array. Figure 3 As shown, the specific implementation method of merging the network read operations of the data blocks in the data block array required by the current page to be accessed is as follows:

[0078] Step 301: Find the adjacent data blocks in the ordered data block mapping table array from the data block array according to the adjacent relationship between the data block mapping tables in the ordered data block mapping table array.

[0079] In the embodiment of the present application, according to the adjacent relationship between each data block mapping table in the ordered data block mapping table array, the adjacent data blocks in the ordered data block mapping table array are found from the data block array required by the current page to be accessed. That is, two or more data blocks that are adjacent in the ordered data block mapping table array are found from the data block array required by the current page to be accessed. The specific implementation method is described by the following example:

[0080] For example, if the data block array included in the current page to be accessed is {obj1, obj2, obj3, obj7, obj8, obj9}, where obj represents the data block, and the number after obj represents the data block number;

[0081] Assume that a continuous segment in the ordered data block mapping table array is intercepted as follows:

[0082] obj1 obj2 obj4 obj3 obj5 obj10 obj9 obj8 obj11 obj7 0 1 2 3 4 5 6 7 8 9

[0083] The first row in the table represents the data blocks in the ordered data block mapping table array, obj represents the data block, the number after obj represents the data block number, and the second row in the table represents the sequence number of each data block in the ordered data block mapping table array;

[0084] It can be found that obj1 and obj2 in the current page database array to be accessed are adjacent in the ordered data block mapping table array. In addition, obj8 and obj9 in the current page database array to be accessed are also adjacent in the ordered data block mapping table array. That is to say, according to the adjacent relationship between the data block mapping tables in the ordered data block mapping table array, the adjacent data blocks found from the data block array in the data block mapping table data group are obj1 and obj2, obj8 and obj9.

[0085] Step 302: merge the network read operations of adjacent data blocks, and generate a network read request for the adjacent data blocks according to the data block mapping table corresponding to the adjacent data blocks.

[0086] It can be understood that the network read operations of adjacent data blocks are merged, that is, the network read operations of adjacent data blocks are merged into one network read operation, so that the original multiple network read operations can be reduced to one network read operation.

[0087] In the embodiment of the present application, the network read request is a method of requesting the cloud server to obtain the data content of the data block, which may be composed of the starting position of the network request and the length of the requested data.

[0088] As in the above example, obj1 and obj2 are adjacent data blocks, so merging the network read operations of the adjacent data blocks is to merge the network read operations of obj1 and obj2 into one network read operation. In addition, according to the data block mapping table corresponding to the adjacent data blocks, a network read request for the adjacent data blocks is generated, that is, according to the corresponding data block mapping table, a network read request is generated with a starting point of the first element in the obj1 data mapping table and a length of the sum of the second element in the obj1 data mapping table and the second element in the obj2 data mapping table.

[0089] Step 303: Generate a network read request for other data blocks in the data block array according to each data block mapping table in the ordered data block mapping table array, wherein the other data blocks are data blocks other than adjacent data blocks in the data block array.

[0090] In the embodiment of the present application, after the network reading operations of adjacent data blocks are merged in the above manner, the number of network reading requests is effectively reduced, and the loading speed of the document online preview is improved.

[0091] In order to further effectively reduce the number of network read requests and further improve the loading speed of the online preview of the document, in some embodiments of the present application, such as Figure 4 As shown, after merging the network read operations of the adjacent data blocks, before generating a network read request for the adjacent data blocks according to the data block mapping table corresponding to the adjacent data blocks, the method may further include:

[0092] Step 405, determining whether there is a target data block that meets the target condition among the data blocks merged through the network reading operation;

[0093] If it exists, execute step 406, otherwise execute step 403;

[0094] In an embodiment of the present application, it is determined whether there is a target data block that meets the target condition between the data blocks merged through the network read operation, wherein the target condition may be a condition that limits the size of the data block. For example, the target condition may be a data block whose data block size is not greater than 3K. If there is a data block whose data block size is not greater than 3K between the merged data blocks, then the data block whose data block size is not greater than 3K between the merged data blocks is the target data block that meets the target condition. The target condition here may be determined according to actual conditions, and the embodiment of the present application does not limit it.

[0095] Step 406: After merging the target data block into the adjacent data blocks, execute step 403.

[0096] For example, if the data block array included in the current page to be accessed is {obj1, obj2, obj3, obj7, obj8, obj9}, where obj represents the data block, and the number after obj represents the data block number;

[0097] And according to the data block array, a continuous section in the ordered data block mapping table array is intercepted as follows:

[0098]

[0099] The first row in the table indicates the data blocks in the ordered data block mapping table array and the sizes of the corresponding data blocks, obj indicates the data block, the number after obj indicates the data block number, and the second row in the table indicates the sequence number of each data block in the ordered data block mapping table array;

[0100] At the same time, the target condition is that the data block size is no larger than 3K data blocks;

[0101] From the above example, obj1 and obj2 are adjacent data blocks. After merging them through network read operations, it can be found that obj4 is between the merged data blocks obj1, obj2 and obj3, and the size of obj4 is less than 3K, so obj4 is the target data block. Obj4 needs to be merged into obj1 and obj2, that is, the network request operation of obj4 is merged into the network request operation of obj1 and obj2.

[0102] It should be noted that Figure 4 Step 401 and Figure 3 The implementation method of step 301 in is consistent with that of Figure 4 Steps 402 and 403 in Figure 3 The implementation method of step 302 in is consistent with that in Figure 4 Step 404 in Figure 3 The implementation method of step 303 in is the same and will not be repeated here.

[0103] In this way, by merging the target data block into the adjacent data block, that is, further merging the network reading operations of the data block, the number of network reading requests can be effectively reduced, and the loading speed of the document online preview in the embodiment of the present application can be further improved.

[0104] In the embodiment of the present application, since the data blocks in the data block array required by the current page to be accessed may have been downloaded, in order to avoid repeated requests for data, the present application proposes another method for online preview of files. Figure 5 It is a flowchart of another online document preview method proposed in the present application. It should be noted that the online document preview method of the present application embodiment can be applied to the online document preview device of the present application embodiment, and the online document preview device can be configured in an electronic device.

[0105] like Figure 5 As shown in the figure, the process of the document online preview method is Figure 1 Based on this, the following implementation steps are added:

[0106] Step 506, determining whether there is a downloaded data block in the data block array;

[0107] If it exists, execute step 507, otherwise execute step 503;

[0108] Step 507 , merge the network read operations of the data blocks that have not been downloaded in the data block array according to the ordered data block mapping table array, and after obtaining the merged network read request, execute step 504 .

[0109] In an embodiment of the present application, if there are downloaded data blocks in the data block array, it means that some data blocks in the data block array have been downloaded when executing other network read requests. Therefore, when merging network read operations, only the network read operations of the data blocks that have not been downloaded need to be merged.

[0110] In the embodiment of the present application, the merging method of the network read requests in step 507 can be implemented by using any merging method in the various embodiments of the present application. The embodiment of the present application does not limit this and will not be repeated.

[0111] It should be noted that in the embodiments of the present application, Figure 5 Steps 501 to 505 in Figure 1 The implementation methods of steps 101 to 105 in are the same and will not be repeated here.

[0112] According to the method for online preview of documents in the embodiment of the present application, by adding a judgment on whether there are downloaded data blocks in the data block array, only the network reading operations of the data blocks that have not been downloaded in the data block array are merged according to the ordered data block mapping table array, thereby avoiding repeated network reading requests for data blocks, reducing the waste of resources and improving the efficiency of network reading requests, thereby improving the loading speed of the online preview of the document.

[0113] In order to improve the applicability of the document online preview method, the present application proposes another document online preview method. Figure 6 It is a flowchart of another online document preview method proposed in the present application. It should be noted that the online document preview method of the present application embodiment can be applied to the online document preview device of the present application embodiment, and the online document preview device can be configured in an electronic device.

[0114] like Figure 6 As shown, based on the above embodiment, the following implementation steps are added to the process of the document online preview method:

[0115] Step 608, obtaining the file header information of the document from the cloud server;

[0116] Step 609, judging whether the format of the document meets the standard format requirements according to the file header information;

[0117] If yes, then execute step 610, otherwise do not execute;

[0118] Step 610, determining whether the document is a non-linear document;

[0119] If yes, execute step 601, otherwise directly pull the data blocks in sequence.

[0120] It should be noted that documents of different formats have specified standard format requirements. The document online preview method proposed in each embodiment of the present application is applicable to documents that meet the standard format requirements. If the format of the current document does not meet the standard format requirements, there is no need to continue to perform the subsequent steps of the method. Among them, whether the format of the document meets the standard format requirements can be analyzed and judged based on the file header information.

[0121] In addition, the linearized document can directly pull the data blocks in sequence to obtain the data content, that is to say, the linearized document does not need to execute the document online preview method proposed in the embodiment of the present application. Therefore, it is necessary to determine whether the current document is a nonlinear document to decide whether to continue to execute the subsequent steps. Among them, whether the current document is a nonlinear document can be judged based on the Linearized field in the file header information. After the above judgment, if the current document is a nonlinear document, continue to execute the document online preview method in each embodiment of the present application, otherwise directly pull the data blocks in sequence.

[0122] It should be noted that Figure 6 Steps 601 to 607 in Figure 5 The implementation methods of steps 501 to 507 are the same and will not be repeated here.

[0123] According to the method for online preview of documents in the embodiment of the present application, by increasing the acquisition of the file header information of the document and analyzing the file header information, it is determined whether the document format meets the standard format requirements and whether it is a non-linear document. If the document format meets the standard format requirements and is a non-linear document, the subsequent steps are continued to be executed, thereby increasing the effectiveness of the method and also improving the applicability of the method.

[0124] To implement the above embodiment, the present application proposes a document online preview device.

[0125] Figure 7 A structural block diagram of a document online preview device provided in an embodiment of the present application, such as Figure 7 As shown, the document online preview device includes: a first acquisition module 710 , a first construction module 720 , a second acquisition module 730 , a second construction module 740 , a merging module 750 , a third acquisition module 760 and a display module 770 .

[0126] Specifically, the first acquisition module 710 is used to obtain a cross-reference table of a document from a cloud server;

[0127] A first construction module 720 is used to construct an ordered data block mapping table array according to the cross-reference table;

[0128] The second acquisition module 730 is used to acquire the current page to be accessed according to the position of the cross-reference table;

[0129] The second construction module 740 is used to extract all dependent objects of the current page to be accessed to construct a data block array required by the current page to be accessed;

[0130] A merging module 750 is used to merge the network read operations of the data blocks in the data block array required by the current page to be accessed according to the ordered data block mapping table array, and obtain a merged network read request;

[0131] The third acquisition module 760 is used to acquire corresponding data content from the cloud server according to the combined network read request;

[0132] The display module 770 is used to render the page according to the data content and display the rendered page.

[0133] In the embodiment of the present application, the first acquisition module 710 is specifically used for:

[0134] Obtaining file tail information of the document from the cloud server;

[0135] Get the cross-reference table of the document from the cloud server based on the file tail information.

[0136] In the embodiments of the present application, Figure 7 As shown, the first building block 720 includes:

[0137] An acquisition unit 721 is used to obtain the total number of data blocks contained in the document and address information of each data block from a cross-reference table;

[0138] The establishing unit 722 is used to establish an ordered data block mapping table array according to the total number of data blocks and the address information of each data block.

[0139] The establishing unit 722 is specifically used for:

[0140] An empty data block mapping table array is established according to the total number of data blocks; each data block mapping table in the data block mapping table array includes a first element, a second element and a third element, the first element is used to indicate address information of the data block, the second element is used to indicate the size of the data block, and the third element is used to indicate a number of the position pointed to by the address information of the data block;

[0141] According to the address information of each data block, the elements of each data block mapping table in the data block mapping table array are assigned a value to obtain an ordered data block mapping table array.

[0142] In the embodiments of the present application, Figure 7 As shown, the merging module 750 includes:

[0143] The acquisition unit 751 is used to find the adjacent data blocks in the ordered data block mapping table array from the data block array according to the adjacent relationship between the data block mapping tables in the ordered data block mapping table array;

[0144] A merging unit 752, configured to merge network read operations of adjacent data blocks, and generate a network read request for the adjacent data blocks according to a data block mapping table corresponding to the adjacent data blocks;

[0145] The generating unit 753 is used to generate a network read request for other data blocks in the data block array according to each data block mapping table in the ordered data block mapping table array; wherein other data blocks are data blocks other than adjacent data blocks in the data block array.

[0146] In this embodiment of the present application, the merging unit 752 is also used for:

[0147] After merging the network read operations of adjacent data blocks, before generating a network read request for the adjacent data blocks according to the data block mapping table corresponding to the adjacent data blocks, judging whether there is a target data block that meets the target condition between the data blocks merged by the network read operation based on the ordered data block mapping table array;

[0148] If it exists, merge the target data block into the adjacent data block.

[0149] In addition, in the embodiment of the present application, the merging unit 752 may also be used for:

[0150] In response to the existence of downloaded data blocks in the data block array, network read operations of the data blocks that have not been downloaded in the data block array are merged according to the ordered data block mapping table array.

[0151] According to the document online preview device of the embodiment of the present application, by constructing an ordered data block mapping table array and merging the network reading operations of the data blocks required by the current page to be accessed, the number of network requests can be reduced, the network reading efficiency can be improved, and the document online preview loading speed can be improved.

[0152] To implement the above embodiment, the present application provides another file online preview device.

[0153] Figure 8 A structural block diagram of another file online preview device provided in an embodiment of the present application, such as Figure 8 As shown, the file online preview device also includes:

[0154] A fourth acquisition module 880 is used to acquire the file header information of the document from the cloud server before acquiring the cross-reference table of the document from the cloud server according to the file tail information;

[0155] A judging module 890 is used to judge whether the format of the document meets the standard format requirements and whether the document is a non-linear document according to the file header information;

[0156] The first acquisition module 810 is further used for: when the format of the document meets the standard format requirements and the document is a non-linear document, executing the step of acquiring the cross-reference table of the document from the cloud server according to the file tail information.

[0157] in, Figure 8 810 to 870 and Figure 7 710 to 770 have the same function and structure, which will not be repeated here.

[0158] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0159] According to the document online preview device of the embodiment of the present application, by increasing the acquisition of the file header information of the document and analyzing the file header information, it is determined whether the document format meets the standard format requirements and is a non-linear document. If the document format meets the standard format requirements and is a non-linear document, the subsequent steps are continued to be executed, thereby increasing the effectiveness of the method and also improving the applicability of the method.

[0160] According to an embodiment of the present application, the present application also provides an electronic device, a storage medium and a computer program product.

[0161] like Fig. 9 , is a block diagram of an electronic device according to a method for online preview of a document according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0162] like Fig. 9As shown, the electronic device includes: one or more processors 901, a memory 902, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 901 is taken as an example.

[0163] The memory 902 is a non-transitory computer-readable storage medium provided by the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to perform the method for online preview of documents provided by the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to perform the method for online preview of documents provided by the present application. The computer program product of the present application includes a computer program, which implements the method for online preview of documents provided by the present application when executed by the processor 901.

[0164] The memory 902 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the method for online preview of files in the embodiment of the present application (for example, the attached Figure 7 The processor 901 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 902, that is, the method for online preview of documents in the above method embodiment is implemented.

[0165] The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data created according to the use of the electronic device for online document preview, etc. In addition, the memory 902 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 902 may optionally include a memory remotely arranged relative to the processor 901, and these remote memories may be connected to the electronic device for online document preview via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0166] The electronic device of the document online preview method may further include: an input device 903 and an output device 904. The processor 901, the memory 902, the input device 903 and the output device 904 may be connected via a bus or other means. Fig. 9 The example of connecting through bus is taken in the following.

[0167] The input device 903 can receive input digital or character information, and generate key signal input related to user settings and function control of the electronic device for online document preview, such as input devices such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator rod, one or more mouse buttons, a track ball, a joystick, etc. The output device 904 may include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor), etc. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.

[0168] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0169] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.

[0170] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0171] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.

[0172] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0173] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.

[0174] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. A document online preview method, comprising: Obtaining a cross-reference table of the document from a cloud server, and constructing an ordered data block mapping table array according to the cross-reference table; Acquire the current page to be accessed according to the position of the cross-reference table, and extract all dependent objects in the current page to be accessed to construct a data block array required by the current page to be accessed; Merging network read operations of data blocks in the data block array required by the current page to be accessed according to the ordered data block mapping table array, and obtaining a merged network read request; Acquire corresponding data content from the cloud server according to the combined network read request; Rendering a page according to the data content, and displaying the rendered page; Wherein, constructing an ordered data block mapping table array according to the cross-reference table includes: Acquire the total number of data blocks contained in the document and address information of each data block from the cross-reference table; Establishing an ordered data block mapping table array according to the total number of data blocks and the address information of each data block; Wherein, establishing an ordered data block mapping table array according to the total number of data blocks and the address information of each data block includes: An empty data block mapping table array is established according to the total number of data blocks; each data block mapping table in the data block mapping table array includes a first element, a second element and a third element, the first element is used to indicate address information of the data block, the second element is used to indicate the size of the data block, and the third element is used to indicate a number of a position pointed to by the address information of the data block; According to the address information of each data block, the elements of each data block mapping table in the data block mapping table array are assigned values ​​to obtain an ordered data block mapping table array.

2. The method according to claim 1, wherein: The step of merging the network read operations of the data blocks in the data block array required by the current page to be accessed according to the ordered data block mapping table array and obtaining the merged network read request includes: Finding data blocks adjacent to each other in the ordered data block mapping table array from the data block array according to the adjacent relationship between the data block mapping tables in the ordered data block mapping table array; Merging network read operations of adjacent data blocks, and generating a network read request for the adjacent data blocks according to a data block mapping table corresponding to the adjacent data blocks; According to each data block mapping table in the ordered data block mapping table array, a network read request for other data blocks in the data block array is generated; wherein the other data blocks are data blocks in the data block array except the adjacent data blocks.

3. The method according to claim 2, after merging the network read operations of the adjacent data blocks and before generating the network read request for the adjacent data blocks according to the data block mapping table corresponding to the adjacent data blocks, the method further comprises: Based on the ordered data block mapping table array, determining whether there is a target data block that meets the target condition between the data blocks merged after the network read operation; If so, the target data block is merged into the adjacent data block.

4. The method according to claim 3, wherein: The merging of network read operations of data blocks in the data block array required by the current page to be accessed according to the ordered data block mapping table array also includes: In response to the existence of downloaded data blocks in the data block array, network read operations of the data blocks that have not been downloaded in the data block array are merged according to the ordered data block mapping table array.

5. The method according to any one of claims 1 to 4, wherein: The step of obtaining the cross-reference table of the document from the cloud server includes: Obtaining file tail information of the document from the cloud server; A cross-reference table of the document is obtained from the cloud server according to the file tail information.

6. The method according to claim 5, wherein: Before obtaining the cross-reference table of the document from the cloud server according to the file tail information, the method further includes: Obtaining file header information of the document from the cloud server; When it is determined according to the file header information that the format of the document meets the standard format requirement and the document is a non-linear document, the step of obtaining a cross-reference table of the document from the cloud server according to the file tail information is performed.

7. A document online preview device, comprising: A first acquisition module, used for acquiring a cross-reference table of the document from a cloud server; A first construction module, configured to construct an ordered data block mapping table array according to the cross-reference table; A second acquisition module, used for acquiring the current page to be accessed according to the position of the cross-reference table; A second construction module is used to extract all dependent objects of the current page to be accessed to construct a data block array required by the current page to be accessed; A merging module, used for merging the network reading operations of the data blocks in the data block array required by the current page to be accessed according to the ordered data block mapping table array, and obtaining a merged network reading request; A third acquisition module, configured to acquire corresponding data content from the cloud server according to the combined network read request; A display module, used to render a page according to the data content and display the rendered page; Wherein, the first building block includes: An acquisition unit, used for acquiring the total number of data blocks contained in the document and address information of each data block from the cross-reference table; An establishing unit, used for establishing an ordered data block mapping table array according to the total number of data blocks and the address information of each data block; Wherein, the establishing unit is specifically used for: An empty data block mapping table array is established according to the total number of data blocks; each data block mapping table in the data block mapping table array includes a first element, a second element and a third element, the first element is used to indicate address information of the data block, the second element is used to indicate the size of the data block, and the third element is used to indicate a number of a position pointed to by the address information of the data block; According to the address information of each data block, the elements of each data block mapping table in the data block mapping table array are assigned values ​​to obtain an ordered data block mapping table array.

8. The device according to claim 7, wherein: The merging module comprises: An acquiring unit, configured to find adjacent data blocks in the ordered data block mapping table array from the data block array according to the adjacent relationship between the data block mapping tables in the ordered data block mapping table array; A merging unit, configured to merge network read operations of adjacent data blocks, and generate a network read request for the adjacent data blocks according to a data block mapping table corresponding to the adjacent data blocks; A generating unit is used to generate a network read request for other data blocks in the data block array according to each data block mapping table in the ordered data block mapping table array; wherein the other data blocks are data blocks in the data block array except the adjacent data blocks.

9. The device according to claim 8, wherein: The merging unit is also used for: After the network read operations of the adjacent data blocks are merged, before a network read request for the adjacent data blocks is generated according to the data block mapping table corresponding to the adjacent data blocks, it is determined based on the ordered data block mapping table array whether there is a target data block that meets the target condition between the data blocks merged by the network read operation; If so, the target data block is merged into the adjacent data block.

10. The device according to claim 9, wherein: The merging unit is also used for: In response to the existence of downloaded data blocks in the data block array, network read operations of the data blocks that have not been downloaded in the data block array are merged according to the ordered data block mapping table array.

11. The device according to any one of claims 7 to 10, wherein: The first acquisition module is specifically used for: Obtaining file tail information of the document from the cloud server; A cross-reference table of the document is obtained from the cloud server according to the file tail information.

12. The apparatus according to claim 11, further comprising: A fourth acquisition module, configured to acquire the file header information of the document from the cloud server before acquiring the cross-reference table of the document from the cloud server according to the file tail information; A judgment module, used for judging whether the format of the document meets the standard format requirements and whether the document is a non-linear document according to the file header information; Wherein, the first acquisition module is further used for: when the format of the document meets the standard format requirements and the document is a non-linear document, executing the step of acquiring the cross-reference table of the document from the cloud server according to the file tail information.

13. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the document online preview method according to any one of claims 1 to 6.

14. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the document online preview method according to any one of claims 1 to 6.

15. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the document online preview method according to any one of claims 1 to 6 is implemented.