CN113011128A - Document online preview method and device, electronic equipment and storage medium - Google Patents

Document online preview method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN113011128A
CN113011128A CN202110246686.2A CN202110246686A CN113011128A CN 113011128 A CN113011128 A CN 113011128A CN 202110246686 A CN202110246686 A CN 202110246686A CN 113011128 A CN113011128 A CN 113011128A
Authority
CN
China
Prior art keywords
data block
document
mapping table
data
data blocks
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110246686.2A
Other languages
Chinese (zh)
Other versions
CN113011128B (en
Inventor
邹涛
李都都
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110246686.2A priority Critical patent/CN113011128B/en
Publication of CN113011128A publication Critical patent/CN113011128A/en
Application granted granted Critical
Publication of CN113011128B publication Critical patent/CN113011128B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/103Formatting, i.e. changing of presentation of documents
    • G06F40/106Display of layout of documents; Previewing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application discloses a document online preview method, a document online preview device, electronic equipment and a storage medium, and relates to the technical field of computers such as network document processing. The specific implementation scheme is as follows: acquiring a cross reference table of a document from a cloud server, and constructing an ordered data block mapping table array according to the cross reference table; acquiring a 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; merging the network reading operation of the data blocks in the data block number group required by the current page to be accessed according to the ordered data block mapping table number group, and obtaining a merged network reading request; acquiring corresponding data content from a cloud server according to the combined network reading request; and rendering the page according to the data content, and displaying the rendered page. By the implementation scheme, the times of network requests are reduced, and the online preview loading speed of the document is improved.

Description

Document online preview method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to the field of network document processing technologies, and in particular, to a method and an apparatus for online previewing a document, an electronic device, and a storage medium.
Background
PDF (Portable Document Format) is an electronic file Format, in the client era, PDF readers mainly focus on local preview, and Adobe PDF readers and Fu Xin PDF readers are famous in domestic products.
With the rapid development of the internet, PDF online previewing is increasingly demanded by users. The user desires faster opening speed, and the downloading time of the whole file becomes a serious problem in the related art, which is usually a mode of 'downloading before previewing'. How to increase the online loading speed of PDF has become a problem to be solved urgently.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for online previewing of a document.
According to a first aspect of the present application, there is provided a document online preview method, including:
acquiring 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;
acquiring a 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;
merging the network reading operation of the data blocks in the data block number group required by the current page to be accessed according to the ordered data block mapping table number group, and obtaining a merged network reading request;
acquiring corresponding data content from the cloud server according to the combined network reading request;
and rendering the page according to the data content, and displaying the rendered page.
According to a second aspect of the present application, there is provided an apparatus for online previewing a document, comprising:
the first acquisition module is used for acquiring a cross reference table of the document from a cloud server;
the first construction module is used for constructing an ordered data block mapping table array according to the cross reference table;
the second acquisition module is used for acquiring the current page to be accessed according to the position of the cross reference table;
the second construction module is used for extracting all dependent objects in the current page to be accessed so as to construct a data block array required by the current page to be accessed;
the merging module is used for merging the network reading operation of the data blocks in the data block number group required by the current page to be accessed according to the ordered data block mapping table number group and obtaining a merged network reading request;
a third obtaining module, configured to obtain corresponding data content from the cloud server according to the merged network reading request;
and the display module is used for rendering the page according to the data content and displaying the rendered page.
According to a third aspect of the present application, there is provided an electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable 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 of the embodiment of the first aspect of the present application.
According to a fourth aspect of the present application, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the document online preview method of the first aspect of the present application.
According to a fifth aspect of the present application, there is provided a computer program product comprising a computer program, which when executed by a processor, implements the document online preview method of the embodiments of the first aspect of the present application.
According to the method and the device, the problem of how to improve the loading speed of the online preview of the file in the prior art is solved, the times of network requests can be reduced, the network reading efficiency is improved, and the loading speed of the online preview of the file is improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present application, nor do they limit the scope of the present application. Other features of the present application will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not intended to limit the present application. Wherein:
FIG. 1 is a flowchart of a method for online previewing a document according to an embodiment of the present application;
FIG. 2 is a flowchart of establishing an ordered data mapping table array in a file online preview method according to an embodiment of the present application;
fig. 3 is a flowchart illustrating a merging operation performed on a network reading manner of a data block in a file online preview method according to an embodiment of the present application;
fig. 4 is a flowchart of another merging operation performed on a network reading manner of a data block in an online file previewing method according to an embodiment of the present application;
FIG. 5 is a flowchart of another method for online previewing a document according to an embodiment of the present application;
FIG. 6 is a flowchart of another method for online previewing a document according to an embodiment of the present application;
FIG. 7 is a block diagram of an online document previewing apparatus according to an embodiment of the present application;
FIG. 8 is a block diagram of another online document previewing apparatus according to an embodiment of the present application;
fig. 9 is a block diagram of an electronic device for implementing the online file preview method according to the embodiment of the present application.
Detailed Description
The following description of the exemplary embodiments of the present application, taken in conjunction with the accompanying drawings, includes various details of the embodiments of the application for the understanding of the same, which are to be considered exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Currently, most PDF document online previewing methods are downloading first and then previewing, that is, the document needs to be downloaded first and then previewed locally, so that the user can only wait for the entire document to be downloaded before previewing the document, and how to preview the document more quickly becomes a very important problem.
In order to solve the above problems, the present application provides a document online preview method, apparatus, electronic device and storage medium.
FIG. 1 is a flow diagram of a document online preview method according to one embodiment of the present application. It should be noted that the document online preview method according to the embodiment of the present application can be applied to the document online preview apparatus according to the embodiment of the present application, and the document online preview apparatus can be configured in an electronic device.
It should be noted that the document online preview method provided in the embodiments of the present application is applicable to PDF documents, and some embodiments of the present application will be described with PDF as an example. The PDF document format comprises four parts, namely a file Header (Header), a file Body (Body), a Cross-reference table (Cross-reference) and a file Trailer (Trailer). The file header is the first line of the PDF document and specifies the version number of the PDF specification used by the document; the file Body (Body) is composed of a series of objects used in the PDF document, wherein the objects are unified into a data block in the embodiment of the present application; the Body of file (Body) part is used for saving all document data displayed to the user, and the content in the Body of file (Body) part is an index built by data blocks in the page; a Cross-reference table (Cross-reference table) is an address index table of an indirect object that is set up to enable random access to the indirect object; the Trailer (Trailer) is the entry point of the entire PDF document, and a PDF reader typically reads a PDF from the Trailer.
As shown in fig. 1, the document online preview method may include:
step 101, obtaining a cross reference table of a document from a cloud server, and constructing an ordered data block mapping table array according to the cross reference table.
It should be noted that, since the file end (Trailer) of the PDF document gives the address of the cross reference table of the PDF document, in order to obtain the cross reference table of the document, the file end information of the document needs to be obtained first. The acquisition of the cross reference table of the document from the cloud server can be realized by the following modes: acquiring file tail information of a document from a cloud server; and acquiring a cross reference table of the document from the cloud server according to the file tail information.
And the number behind 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.
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, and 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 ordered.
Therefore, in order to realize the ordered arrangement of the document contents and improve the online preview loading speed of the document, the embodiment of the application constructs the ordered data block mapping table array according to the cross reference table for the ordered document page data index. The ordered data block mapping table array comprises all data blocks in a document, and the number, address information, size information and the like of each data block, and all the data blocks in the ordered data block mapping table array are arranged in the sequence of the physical offset addresses of the data blocks in the document from small to large.
And 102, acquiring 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.
In the embodiment of the 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 to be presented, that is, each page in the document is composed of one or more data blocks, all dependent objects extracted from the current page to be accessed are extracted from the document, that is, all dependent objects extracted from the current page to be accessed are extracted from the document. The method comprises the steps of extracting all dependent objects in a current page to be accessed, wherein the dependent objects comprise the number of data blocks and the number of each data block in the current page to be accessed, and constructing a data block array required by the current page to be accessed according to the extracted number of the data blocks and the number of each data block in the current page to be accessed.
And 103, merging the network reading operation of the data blocks in the data block number group required by the current page to be accessed according to the ordered data block mapping table number group, and obtaining a merged network reading request.
It should be noted that the previewing of the page requires to first request the cloud server through the network reading task to obtain data required by page loading, where the loading speed of the document page previewing has a great relationship with the data amount of the network reading request and the number of times of the network reading request, and it can be understood that the smaller the data amount of the network reading request or the smaller the number of times of the network reading request, the faster the loading speed of the document page previewing. Therefore, in this step, the network reading operation of the data block in the data block group required by the current page to be accessed can be merged according to the ordered data block mapping table group, so as to obtain the corresponding data content from the cloud server based on the merged network reading request.
And 104, acquiring corresponding data content from the cloud server according to the combined network reading request.
And 105, rendering the page according to the data content, and displaying the rendered page.
According to the document online preview method, the ordered data block mapping table data group is constructed, the network reading operation of the data block required by the current page to be accessed is combined according to the ordered data block mapping table data group, the network request times are effectively reduced, and each network request takes the data block as a unit, so that the loading speed of the document online preview is increased.
In this embodiment of the present application, constructing the ordered data block mapping table array according to the cross reference table includes: acquiring the total number of data blocks contained in the document and address information of each data block from a cross reference table; and establishing an ordered data block mapping table array according to the total number of the data blocks and the address information of each data block.
In some embodiments of the present application, as shown in fig. 2, the specific step of establishing the ordered data chunk mapping table array according to the total number of the data chunks and the address information of each data chunk may include:
step 201, an empty data block mapping table array is established according to the total number of the data blocks.
In an embodiment of the present application, each data block mapping table in the data block mapping table array includes:
a first element for indicating address information of a data block;
a second element to indicate a size of the data block;
a third element for indicating a number of locations to which the address information of the data block points.
It should be noted that the number of the data block mapping tables in the data block mapping table array is consistent with the total number of the data blocks, that is, the data block mapping table array is composed of data block mapping tables, and each data block has one data block mapping table.
Step 202, assigning values to elements of each data block mapping table in the data block mapping table array according to the address information of each data block to obtain an ordered data block mapping table array.
It should be noted that, offset addresses of data blocks arranged from top to bottom in the cross reference table of the document obtained from the cloud server are arranged in an unordered manner, and the offset addresses represent relative positions of the data blocks in the document, so that to obtain an ordered data block mapping table array, the data blocks in the cross reference table need to be ordered from small to large according to the offset addresses, that is, ordered according to the arrangement order of the data blocks in the document.
In the embodiment of the present application, the first element in the mapping table of each data block, that is, the address information for indicating the data block, that is, the physical offset address of the data block in the document, may 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 in the mapping table of each corresponding data block.
In addition, the second element in the mapping table of each data block represents 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 by: all the data blocks are arranged from small to large according to the offset addresses, the size of the current data block can be represented as the difference value of 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, and the calculated difference value is assigned to the second element in the corresponding data block mapping table. To illustrate its implementation more clearly, it will be further illustrated by the following example:
for example, if a document includes n data blocks, where 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 of each data block in the document after sorting according to the offset addresses are:
the first block of data, Pos 000000017;
the second block, Pos 000000169;
the third block, Pos 000000225, then,
the Size of the first data block is 169-17;
the Size of the second data block, 225-,
in the mapping table of the first data block, the second element is 169-17;
the second element in the mapping table of the second data block is 225 and 169.
It should be noted that the cross reference table includes both the total number of all data blocks in the document and the start number of the data block, and each data block in the cross reference table is the number of each corresponding data block in the cross reference table by sequentially adding 1 according to the original sequence from top to bottom according to the start number, that is, each data block in the cross reference table has its own number, and this number is the third element in the data block mapping table in the embodiment of the present application. The original sorting is a default sorting of the cross reference table directly obtained from the cloud, that is, a sorting order of each data block which is not subjected to sorting processing.
In the embodiment of the application, the established empty data block mapping table array is subjected to assignment to obtain the ordered data block mapping table array.
It should be noted that, there are many ways to merge network read operations of data blocks in the data block array required by the current page to be accessed, and as an example, network read operations of data blocks in the data block array required by the current page to be accessed may be merged according to an adjacent relationship between data block mapping tables in the ordered data block mapping table array. In the embodiment of the present application, as shown in fig. 3, a specific implementation manner of merging network read operations of data blocks in a data block group required by a current page to be accessed is as follows:
step 301, finding out the data blocks adjacent to each other in the ordered data block mapping table array from the data block array according to the adjacent relation among the data block mapping tables in the ordered data block mapping table array.
In the embodiment of the application, according to the adjacent relation among the data block mapping tables in the ordered data block mapping table array, the data block adjacent to the ordered data block mapping table array in the ordered data block mapping table array is found out from the data block array required by the current page to be accessed. That is to say, two or more data blocks adjacent to each other in the ordered data block mapping table array are found from the data block array required by the current page to be accessed, and the specific implementation manner is illustrated by the following example:
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 a data block, and the number after obj represents a data block number;
assuming that successive segments in the ordered data block mapping table array are intercepted as follows:
obj1 obj2 obj4 obj3 obj5 obj10 obj9 obj8 obj11 obj7
0 1 2 3 4 5 6 7 8 9
the first row in the table represents a data block in the ordered data block mapping table array, obj represents a data block, the number after obj represents a data block number, and the second row in the table represents a sequence number of each data block in the ordered data block mapping table array;
it can be found that obj1 and obj2 in the page database array to be accessed currently are adjacent in the ordered data block mapping table array, and obj8 and obj9 in the page database array to be accessed currently are also adjacent in the ordered data block mapping table array, that is, according to the adjacent relationship between the data block mapping tables in the ordered data block mapping table array, the adjacent data blocks in the data block mapping table data group found from the data block array are obj1 and obj2, obj8 and obj 9.
Step 302, merging the network reading operations of the adjacent data blocks, and generating a network reading request for the adjacent data blocks according to the data block mapping tables corresponding to the adjacent data blocks.
It can be understood that the network read operations of the adjacent data blocks are combined, that is, the network read operations of the adjacent data blocks are combined into one network read operation, so that the original multiple network read operations can be reduced to one network read operation.
In this embodiment of the application, the network reading request is a manner of requesting the cloud server to acquire data block data content, and may be composed of a start position of the network request and a data length of the request.
As in the above example, obj1 and obj2 are adjacent data blocks, and merging the network read operations of the adjacent data blocks is to merge the network read operation of obj1 and the network read operation of obj2 into one network read operation. In addition, network read requests for adjacent data blocks are generated according to the data block mapping tables corresponding to the adjacent data blocks, that is, network read requests with a starting point of a first element in the obj1 data mapping table and a length of a sum of a second element in the obj1 data mapping table and a second element in the obj2 data mapping table are generated according to the corresponding data block mapping tables.
Step 303, generating a network reading request of 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 for adjacent data blocks.
In the embodiment of the application, after the network reading operations of the adjacent data blocks are combined in the above manner, the times of network reading requests are effectively reduced, and the loading speed of the online preview of the document is improved.
In order to further effectively reduce the number of network read requests and further improve the loading speed of online document preview, in some embodiments of the present application, as shown in fig. 4, after merging network read operations of adjacent data blocks, before generating a network read request for an adjacent data block according to a data block mapping table corresponding to the adjacent data block, the method may further include:
step 405, judging whether a target data block meeting target conditions exists between the data blocks merged by the network reading operation;
if yes, go to step 406, otherwise go to step 403;
in the embodiment of the present application, it is determined whether a target data block meeting a target condition exists between data blocks merged by a network read operation, where the target condition may be a condition that limits the size of the data block. For example, the target condition may be that the size of the data block is not greater than 3K, and if the size of the data block is not greater than 3K between the merged data blocks, the data block not greater than 3K between the merged data blocks is the target data block that meets the target condition. The target conditions can be determined according to actual conditions, and the embodiment of the application is not limited.
Step 406, merging the target data block into the adjacent data block, and then executing step 403.
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 a data block, and the number after obj represents a data block number;
and intercepting a continuous section in the array of the ordered data block mapping table according to the array of the data blocks as follows:
Figure BDA0002964346240000091
the first row in the table represents the data blocks in the ordered data block mapping table array and the sizes of the corresponding data blocks, obj represents the data blocks, the numbers behind obj represent the data block numbers, and the second row in the table represents the sequence numbers of the data blocks in the ordered data block mapping table array;
meanwhile, the target condition is that the size of the data block is not larger than 3K;
from the above example, after obj1 and obj2 are adjacent data blocks, and network read operations are merged, it can be found that obj4 is between merged data blocks obj1, obj2 and obj3, and obj4 is smaller than 3K in size, so obj4 is a target data block, and obj4 needs to be merged into obj1 and obj2, that is, the network request operation of obj4 is merged into the network request operations of obj1 and obj 2.
It should be noted that step 401 in fig. 4 is consistent with the implementation of step 301 in fig. 3, steps 402 and 403 in fig. 4 are consistent with the implementation of step 302 in fig. 3, and step 404 in fig. 4 is consistent with the implementation of step 303 in fig. 3, and is not described again here.
Therefore, by merging the target data block into the adjacent data block, that is, further merging the network reading operation of the data block, the number of times of network reading requests can be effectively reduced, and the loading speed of the document online preview of the embodiment of the application is further improved.
In the embodiment of the 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 application proposes another method for online previewing of a file. Fig. 5 is a flowchart of still another document online preview method proposed in the present application. It should be noted that the document online preview method according to the embodiment of the present application can be applied to the document online preview apparatus according to the embodiment of the present application, and the document online preview apparatus can be configured in an electronic device.
As shown in FIG. 5, the flow of the document online preview method is based on FIG. 1, and the following implementation steps are added:
step 506, judging whether the downloaded data block exists in the data block array;
if yes, go to step 507, otherwise go to step 503;
and 507, merging the network reading operation of the data blocks which are not downloaded in the data block array according to the ordered data block mapping table array, and executing the step 504 after acquiring the merged network reading request.
In the embodiment of the present application, if there is a downloaded data block in the data block array, it is described that when another network read request is executed, part of the data blocks in the data block array are downloaded, so when network read operations are merged, only the network read operations of the data blocks that are not downloaded are merged.
In this embodiment of the present application, the merging manner of the network read requests in step 507 may be implemented by using any one of the merging manners in the embodiments of the present application, which is not limited in this embodiment of the present application and is not described again.
It should be noted that, in the embodiment of the present application, steps 501 to 505 in fig. 5 are consistent with the implementation manner of steps 101 to 105 in fig. 1, and are not described again here.
According to the method for online previewing the document, whether the downloaded data blocks exist in the data block array or not is judged, only the network reading operation of the data blocks which are not downloaded in the data block array is merged according to the ordered data block mapping table array, repeated network reading requests of the data blocks are avoided, resource waste is reduced, the efficiency of the network reading requests is improved, and therefore the loading speed of online previewing the document is improved.
In order to improve the applicability of the document online preview method, the present application proposes another document online preview method, and fig. 6 is a flowchart of another document online preview method proposed according to the present application. It should be noted that the document online preview method according to the embodiment of the present application can be applied to the document online preview apparatus according to the embodiment of the present application, and the document online preview apparatus can be configured in an electronic device.
As shown in fig. 6, on the basis of the above embodiment, the following implementation steps are added in the flow of the document online preview method:
step 608, acquiring file header information of the document from the cloud server;
step 609, judging whether the format of the document meets the standard format requirement or not according to the file header information;
if yes, go to step 610, otherwise not go to;
step 610, judging whether the document is a nonlinear document;
if yes, executing step 601, otherwise, directly pulling the data blocks in sequence.
It should be noted that documents in different formats all have a specified standard format requirement, and the document online preview method provided in embodiments of the present application is applicable to documents that satisfy the standard format requirement, and if the format of the current document does not satisfy the standard format requirement, the subsequent steps of the method need not to be executed continuously. Whether the format of the document meets the standard format requirement or not can be analyzed and judged according to the file header information.
In addition, the linearized document may directly pull the data blocks in sequence to obtain the data content, that is, the linearized document does not need to perform the document online preview method provided in the embodiments of the present application. It is necessary to determine whether the current document is a non-linear document to decide whether to continue to perform the subsequent steps. Whether the current document is a nonlinear document can be judged according to a linear field in the file header information. After the judgment, if the current document is a non-linear document, the document online preview method in the embodiments of the application is continuously executed, otherwise, the data blocks are directly and sequentially pulled.
It should be noted that steps 601 to 607 in fig. 6 are the same as the implementation of steps 501 to 507 in fig. 5, and are not described herein again.
According to the method for online previewing the document, the file header information of the document is acquired, whether the document format meets the standard format requirement and is a nonlinear document is judged according to the analysis of the file header information, if the document format meets the standard format requirement and is the nonlinear document, the subsequent steps are continuously executed, the effectiveness of the method is improved, and meanwhile the applicability of the method is improved.
In order to implement the above embodiments, the present application provides an online document previewing apparatus.
Fig. 7 is a block diagram illustrating a structure of a document online previewing apparatus according to an embodiment of the present application, where as shown in fig. 7, the document online previewing apparatus includes: a first retrieving module 710, a first constructing module 720, a second retrieving module 730, a second constructing module 740, a merging module 750, a third retrieving module 760 and a display module 770.
Specifically, the first obtaining module 710 is configured to obtain a cross reference table of a document from a cloud server;
a first constructing module 720, configured to construct an ordered data block mapping table array according to the cross reference table;
the second obtaining module 730, configured to obtain a current page to be accessed according to the position of the cross reference table;
the second building module 740 is configured to extract all dependent objects in the current page to be accessed to build a data block array required by the current page to be accessed;
the merging module 750 is configured to merge network read operations of data blocks in a data block group required by a current page to be accessed according to the ordered data block mapping table group, and obtain a merged network read request;
a third obtaining module 760, configured to obtain corresponding data content from the cloud server according to the merged network reading request;
the display module 770 is configured to perform page rendering according to the data content, and display a rendered page.
In this embodiment of the present application, the first obtaining module 710 is specifically configured to:
acquiring file tail information of the document from a cloud server;
and acquiring a cross reference table of the document from the cloud server according to the file tail information.
In the embodiment of the present application, as shown in fig. 7, the first building block 720 includes:
an obtaining unit 721, configured to obtain, from the cross reference table, the total number of data blocks included in the document and address information of each data block;
the establishing unit 722 is configured to establish an ordered data block mapping table array according to the total number of the data blocks and the address information of each data block.
The establishing unit 722 is specifically configured to:
establishing an empty data block mapping table array according to the total number of the data blocks; each data block mapping table in the data block mapping table array comprises a first element, a second element and a third element, wherein the first element is used for indicating the address information of the data block, the second element is used for indicating the size of the data block, and the third element is used for indicating a number of the position pointed by the address information of the data block;
and assigning values to elements of each data block mapping table in the data block mapping table array according to the address information of each data block to obtain the ordered data block mapping table array.
In the embodiment of the present application, as shown in fig. 7, the merging module 750 includes:
the obtaining unit 751 is used for finding out adjacent data blocks in the ordered data block mapping table array from the data block array according to the adjacent relation among the data block mapping tables in the ordered data block mapping table array;
a merging unit 752, configured to merge network read operations of adjacent data blocks, and generate a network read request for an adjacent data block according to a data block mapping table corresponding to the adjacent data block;
a generating unit 753, configured 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; and the other data blocks are the data blocks in the data block array except the adjacent data blocks.
In this embodiment, the merging unit 752 is further configured to:
after network reading operations of adjacent data blocks are combined, judging whether a target data block meeting a target condition exists between the data blocks combined through the network reading operations based on the ordered data block mapping table array before generating a network reading request aiming at the adjacent data blocks according to the data block mapping tables corresponding to the adjacent data blocks;
and if so, merging the target data block into the adjacent data block.
Furthermore, in the embodiment of the present application, the merging unit 752 may further be configured to:
and in response to the downloaded data blocks in the data block array, merging the network reading operation of the data blocks which are not downloaded in the data block array according to the ordered data block mapping table array.
According to the document online preview device provided by the embodiment of the application, the times of network requests can be reduced and the network reading efficiency can be improved by constructing the ordered data block mapping table array and combining the network reading operations of the data blocks required by the current page to be accessed, so that the document online preview loading speed is increased.
In order to realize the embodiment, the application provides another file online previewing device.
Fig. 8 is a block diagram of another online document previewing apparatus according to an embodiment of the present application, as shown in fig. 8, the online document previewing apparatus further includes:
a fourth obtaining module 880, configured to obtain file header information of the document from the cloud server before obtaining the cross reference table of the document from the cloud server according to the file tail information;
the judging module 890 is configured to judge whether the format of the document meets the standard format requirement according to the file header information, and whether the document is a non-linear document;
wherein the first obtaining module 810 is further configured to: and when the format of the document meets the standard format requirement and the document is a nonlinear document, executing a step of acquiring a cross reference table of the document from the cloud server according to the file tail information.
The 810 to 870 in fig. 8 have the same functions and structures as those of 710 to 770 in fig. 7, and are not described again here.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
According to the document online preview device, the acquisition of the file header information of the document is added, whether the document format meets the standard format requirement and is a nonlinear document is judged according to the analysis of the file header information, and if the document format meets the standard format requirement and is the nonlinear document, the subsequent steps are continuously executed, so that the effectiveness of the method is increased, and meanwhile, the applicability of the method is improved.
According to an embodiment of the present application, an electronic device, a storage medium, and a computer program product are also provided.
As shown in fig. 9, it is a block diagram of an electronic device of a method for online previewing a document according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may 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 meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 9, the electronic apparatus includes: one or more processors 901, memory 902, and interfaces for connecting the various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). Fig. 9 illustrates an example of a processor 901.
Memory 902 is a non-transitory computer readable storage medium as provided herein. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the method for online previewing of documents provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the method for online preview of a document provided by the present application. The computer program product of the present application includes a computer program, which when executed by the processor 901, implements the document online preview method provided by the present application.
Memory 902, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the method for online previewing of documents in the embodiments of the present application (e.g., first obtaining module 701, first constructing module 702, second obtaining module 703, second constructing module 704, merging module 705, third obtaining module 706, and display module 707 shown in fig. 7). The processor 901 executes various functional applications of the server and data processing, i.e., a method for online previewing of a document in the above-described method embodiment, by running non-transitory software programs, instructions and modules stored in the memory 902.
The memory 902 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created from use of the electronic device for online preview of a document, and the like. Further, the memory 902 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, memory 902 may optionally include memory located remotely from processor 901, which may be connected over a network to an electronic device for online preview of documents. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the method for online previewing of the document 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 by a bus or other means, and fig. 9 illustrates the connection by a bus as an example.
The input device 903 may receive input numeric or character information and generate key signal inputs related to user settings and function controls of the electronic apparatus for online preview of documents, such as an input device such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, or the like. The output devices 904 may include a display device, auxiliary lighting devices (e.g., LEDs), tactile feedback devices (e.g., vibrating motors), and the like. 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 implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may 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, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide 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 used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here 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 a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, 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 may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end 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: local Area Networks (LANs), Wide Area Networks (WANs), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The Server can be a cloud Server, also called a cloud computing Server or a cloud host, and is a host product in a cloud computing service system, so as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present application may be executed in parallel, sequentially, or in different orders, and the present invention is not limited thereto as long as the desired results of the technical solutions disclosed in the present application can be achieved.
The above-described embodiments should not be construed as limiting the scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims (19)

1. A document online preview method comprises the following steps:
acquiring 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;
acquiring a 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;
merging the network reading operation of the data blocks in the data block number group required by the current page to be accessed according to the ordered data block mapping table number group, and obtaining a merged network reading request;
acquiring corresponding data content from the cloud server according to the combined network reading request;
and rendering the page according to the data content, and displaying the rendered page.
2. The method of claim 1, wherein said building an ordered data block mapping table array from said cross reference table comprises:
acquiring the total number of data blocks contained in the document and address information of each data block from the cross reference table;
and establishing an ordered data block mapping table array according to the total number of the data blocks and the address information of each data block.
3. The method of claim 2, wherein the establishing an ordered data chunk mapping table array according to the total number of data chunks and the address information of each data chunk comprises:
establishing an empty data block mapping table array according to the total number of the data blocks; each data block mapping table in the data block mapping table array comprises a first element, a second element and a third element, wherein the first element is used for indicating address information of the data block, the second element is used for indicating the size of the data block, and the third element is used for indicating a number of a position pointed by the address information of the data block;
and assigning values to elements of each data block mapping table in the data block mapping table array according to the address information of each data block to obtain an ordered data block mapping table array.
4. The method of claim 1, wherein the merging, according to the ordered data block mapping table number, network read operations of data blocks in the data block number group required by the current page to be accessed and obtaining a merged network read request comprises:
finding out adjacent data blocks in the ordered data block mapping table array from the data block array according to the adjacent relation among the data block mapping tables in the ordered data block mapping table array;
merging network reading operations of adjacent data blocks, and generating a network reading request aiming at the adjacent data blocks according to a data block mapping table corresponding to the adjacent data blocks;
generating network reading requests of other data blocks in the data block array according to each data block mapping table in the ordered data block mapping table array; and the other data blocks are the data blocks in the data block array except the adjacent data blocks.
5. The method of claim 4, after the 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 tables to which the adjacent data blocks correspond, the method further comprising:
judging whether a target data block meeting a target condition exists between data blocks merged by network reading operation based on the ordered data block mapping table array;
and if so, merging the target data block into the adjacent data block.
6. The method of claim 5, wherein the merging, according to the ordered set of data block mapping tables, network read operations of data blocks from among the set of data blocks needed for the current page to be accessed, further comprises:
and in response to the downloaded data blocks in the data block array, merging the network reading operation of the data blocks which are not downloaded in the data block array according to the ordered data block mapping table array.
7. The method of any of claims 1-6, wherein the obtaining the cross-reference table of documents from a cloud server comprises:
acquiring file tail information of the document from the cloud server;
and acquiring a cross reference table of the document from the cloud server according to the file tail information.
8. The method of claim 7, wherein prior to the obtaining the cross reference table of the document from the cloud server according to the file tail information, the method further comprises:
acquiring file header information of the document from the cloud server;
and when the file format meets the standard format requirement and the file is a nonlinear file according to the file header information, executing the step of acquiring the cross reference table of the file from the cloud server according to the file tail information.
9. An apparatus for online previewing of documents, comprising:
the first acquisition module is used for acquiring a cross reference table of the document from a cloud server;
the first construction module is used for constructing an ordered data block mapping table array according to the cross reference table;
the second acquisition module is used for acquiring the current page to be accessed according to the position of the cross reference table;
the second construction module is used for extracting all dependent objects in the current page to be accessed so as to construct a data block array required by the current page to be accessed;
the merging module is used for merging the network reading operation of the data blocks in the data block number group required by the current page to be accessed according to the ordered data block mapping table number group and obtaining a merged network reading request;
a third obtaining module, configured to obtain corresponding data content from the cloud server according to the merged network reading request;
and the display module is used for rendering the page according to the data content and displaying the rendered page.
10. The apparatus of claim 9, wherein the first building block comprises:
an obtaining unit, configured to obtain, from the cross reference table, the total number of data blocks included in the document and address information of each data block;
and the establishing unit is used for establishing an ordered data block mapping table array according to the total number of the data blocks and the address information of each data block.
11. The apparatus according to claim 10, wherein the establishing unit is specifically configured to:
establishing an empty data block mapping table array according to the total number of the data blocks; each data block mapping table in the data block mapping table array comprises a first element, a second element and a third element, wherein the first element is used for indicating address information of the data block, the second element is used for indicating the size of the data block, and the third element is used for indicating a number of a position pointed by the address information of the data block;
and assigning values to elements of each data block mapping table in the data block mapping table array according to the address information of each data block to obtain an ordered data block mapping table array.
12. The document online preview device of claim 9, wherein the merge module comprises:
the obtaining unit is used for finding out adjacent data blocks in the ordered data block mapping table array from the data block array according to the adjacent relation among the data block mapping tables in the ordered data block mapping table array;
the merging unit is used for merging network reading operations of adjacent data blocks and generating a network reading request aiming at the adjacent data blocks according to a data block mapping table corresponding to the adjacent data blocks;
the generating unit is used for generating network reading requests of other data blocks in the data block array according to each data block mapping table in the ordered data block mapping table array; and the other data blocks are the data blocks in the data block array except the adjacent data blocks.
13. The apparatus of claim 12, wherein the merging unit is further configured to:
after the network reading operations of the adjacent data blocks are combined, judging whether a target data block meeting a target condition exists between the data blocks combined through the network reading operations based on the ordered data block mapping table array before generating a network reading request aiming at the adjacent data blocks according to the data block mapping tables corresponding to the adjacent data blocks;
and if so, merging the target data block into the adjacent data block.
14. The document online previewing apparatus according to claim 13, wherein the merging unit is further configured to:
and in response to the downloaded data blocks in the data block array, merging the network reading operation of the data blocks which are not downloaded in the data block array according to the ordered data block mapping table array.
15. The apparatus according to any one of claims 9 to 14, wherein the first obtaining module is specifically configured to:
acquiring file tail information of the document from the cloud server;
and acquiring a cross reference table of the document from the cloud server according to the file tail information.
16. The document online preview device of claim 15, further comprising:
a fourth obtaining module, configured to obtain, from the cloud server, file header information of the document before obtaining, from the cloud server, the cross reference table of the document according to the file tail information;
the judging module is used for judging whether the format of the document meets the standard format requirement or not according to the file header information and whether the document is a nonlinear document or not;
wherein the first obtaining module is further configured to: and when the format of the document meets the standard format requirement and the document is a nonlinear document, executing the step of acquiring the cross reference table of the document from the cloud server according to the file tail information.
17. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the document online preview method of any of claims 1 to 8.
18. A non-transitory computer readable storage medium storing computer instructions for causing a computer to execute the document online preview method of any one of claims 1 to 8.
19. A computer program product comprising a computer program which, when executed by a processor, implements a method of online previewing a document according to any one of claims 1 to 8.
CN202110246686.2A 2021-03-05 2021-03-05 Document online previewing method and device, electronic equipment and storage medium Active CN113011128B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110246686.2A CN113011128B (en) 2021-03-05 2021-03-05 Document online previewing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110246686.2A CN113011128B (en) 2021-03-05 2021-03-05 Document online previewing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113011128A true CN113011128A (en) 2021-06-22
CN113011128B CN113011128B (en) 2024-09-06

Family

ID=76407237

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110246686.2A Active CN113011128B (en) 2021-03-05 2021-03-05 Document online previewing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113011128B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100613600B1 (en) * 2005-05-25 2006-08-22 삼성전자주식회사 Printer for directly printing pdf batch file and method thereof
CN103329113A (en) * 2010-10-10 2013-09-25 阿卡麦科技公司 Proxy server configured for hierarchical caching and dynamic site acceleration and custom object and associated method
CN103609059A (en) * 2010-09-20 2014-02-26 安全第一公司 Systems and methods for secure data sharing
CN103678698A (en) * 2013-12-27 2014-03-26 福建福昕软件开发股份有限公司北京分公司 Method and device for improving on-line browsing loading speed of PDF document
CN105765559A (en) * 2013-09-09 2016-07-13 尤奈特戴克斯公司 Interactive case management system
CN106250385A (en) * 2015-06-10 2016-12-21 埃森哲环球服务有限公司 The system and method for the abstract process of automated information for document
CN110325961A (en) * 2016-12-03 2019-10-11 托马斯·斯塔胡拉 Software application exploitation based on electrical form

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100613600B1 (en) * 2005-05-25 2006-08-22 삼성전자주식회사 Printer for directly printing pdf batch file and method thereof
CN103609059A (en) * 2010-09-20 2014-02-26 安全第一公司 Systems and methods for secure data sharing
CN103329113A (en) * 2010-10-10 2013-09-25 阿卡麦科技公司 Proxy server configured for hierarchical caching and dynamic site acceleration and custom object and associated method
CN105765559A (en) * 2013-09-09 2016-07-13 尤奈特戴克斯公司 Interactive case management system
CN103678698A (en) * 2013-12-27 2014-03-26 福建福昕软件开发股份有限公司北京分公司 Method and device for improving on-line browsing loading speed of PDF document
CN106250385A (en) * 2015-06-10 2016-12-21 埃森哲环球服务有限公司 The system and method for the abstract process of automated information for document
CN110325961A (en) * 2016-12-03 2019-10-11 托马斯·斯塔胡拉 Software application exploitation based on electrical form

Also Published As

Publication number Publication date
CN113011128B (en) 2024-09-06

Similar Documents

Publication Publication Date Title
MX2010011403A (en) Techniques to modify a document using a latent transfer surface.
US9898516B2 (en) Verification of transformed content
US20140344669A1 (en) Document conversion apparatus
CN113538450B (en) Method and device for generating image
CN113656533A (en) Tree control processing method and device and electronic equipment
CN116245052A (en) Drawing migration method, device, equipment and storage medium
JP7309811B2 (en) Data annotation method, apparatus, electronics and storage medium
US20170154022A1 (en) Information processing apparatus, method for controlling the same, and storage medium
CN111191174A (en) Method, system and device for integrating Spanish Bitums
WO2021164193A1 (en) Mini program material processing method and apparatus, electronic device, and medium
CN113011128B (en) Document online previewing method and device, electronic equipment and storage medium
CN111026916A (en) Text description conversion method and device, electronic equipment and storage medium
CN111400431A (en) Event argument extraction method and device and electronic equipment
JP2010020703A (en) Document management system, document management method, and program
CN112148279B (en) Log information processing method, device, electronic equipment and storage medium
CN113988893B (en) Commodity information processing method, device, equipment and storage medium
CN115469849A (en) Service processing system, method, electronic device and storage medium
CN112052347B (en) Image storage method and device and electronic equipment
CN113051504A (en) Document preview method, apparatus, device, storage medium and program product
CN113138760A (en) Page generation method and device, electronic equipment and medium
CN111506787A (en) Webpage updating method and device, electronic equipment and computer-readable storage medium
US9489363B2 (en) User configurable user interface
KR101371584B1 (en) Method of displaying screen of web browser
JP2021157335A (en) Program, information processing method, information processing device, and information processing system
CN111292223A (en) Graph calculation processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant