CN111444671A - Online pdf file previewing method and device, computer equipment and storage medium - Google Patents

Online pdf file previewing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN111444671A
CN111444671A CN202010156690.5A CN202010156690A CN111444671A CN 111444671 A CN111444671 A CN 111444671A CN 202010156690 A CN202010156690 A CN 202010156690A CN 111444671 A CN111444671 A CN 111444671A
Authority
CN
China
Prior art keywords
event
plug
pdf file
path
preview request
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.)
Pending
Application number
CN202010156690.5A
Other languages
Chinese (zh)
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.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China 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 Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202010156690.5A priority Critical patent/CN111444671A/en
Publication of CN111444671A publication Critical patent/CN111444671A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the field of research and development management, and discloses a pdf file online preview method, a pdf file online preview device, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring a preview request initiated by a browser, generating a corresponding event according to the preview request, processing the event and monitoring the processing state of the event; analyzing the preview request to obtain a plug-in path and a file path, and obtaining a corresponding pdf file according to the file path; calling a plug-in corresponding to the plug-in path to analyze the pdf file to obtain encoded data of the pdf file; and sending the coding format corresponding to the event and the coding data of the pdf file to a browser for previewing and displaying. The method and the device can effectively improve the capability of processing the preview request at the background, do not need to pre-install a pdf reader in the browser, have no requirement on the browser, greatly facilitate the preview of the user and improve the feeling of the user.

Description

Online pdf file previewing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of research and development management, and in particular, to a pdf file online preview method, apparatus, computer device and storage medium.
Background
An online preview pdf file is a common function in a web application, and similar requirements such as online browsing of pdf file contents, online embedding of a dynamic pdf and the like are often met in the development requirement process, and the traditional solution is as follows: the first is to install a client pdf reader; the disadvantages are as follows: the user is required to install the pdf reader by himself, which is inconvenient for the user. And the second method comprises the following steps: some browsers without browsing plug-ins are used to perform previewing by performing a double process on the code in advance. And the third is that: previewing by using a front-end plug-in; the disadvantages are as follows: the file to be previewed must be placed under the front-end engineering directory and the dynamically generated document cannot be previewed. In summary, the existing preview pdf file can be previewed only by means of some clients or intermediate plug-ins, so that the condition for implementing the preview function is severe and the steps are complicated.
Disclosure of Invention
The method and the device for previewing the pdf files on line are provided, the online previewing of the pdf files is realized by the method, the previewing request can be processed in parallel due to the use of a node.js environment, so that the capability of processing the previewing request at a background can be effectively improved, the pdf files are analyzed at the background and restored at a browser page, a pdf reader does not need to be pre-installed in the browser, the browser does not have requirements, the previewing of a user is greatly facilitated, and the user experience is improved.
In order to achieve the above purpose, the technical solution of the present application provides a pdf file online previewing method, apparatus, computer device and storage medium.
The application discloses a pdf file online previewing method, which comprises the following steps:
acquiring a preview request initiated by a browser, generating a corresponding event according to the preview request, triggering analysis of the corresponding preview request according to the event, and monitoring the processing state of the event, wherein the processing state of the event comprises completion and incompletion;
analyzing the preview request to obtain a plug-in path and a file path, and obtaining a corresponding pdf file according to the file path, wherein the plug-in path is used for identifying an address stored by a plug-in and the plug-in is used for analyzing the pdf file;
calling a plug-in corresponding to the plug-in path to analyze the pdf file to obtain coded data of the pdf file, wherein the coded data comprises coding format information corresponding to the plug-in;
and when the processing state of any event is detected to be a finished state, sending the coding format corresponding to the event and the coding data of the pdf file to a browser for preview display.
Preferably, the acquiring a preview request initiated by a browser, and generating a corresponding event according to the preview request includes:
acquiring preview requests initiated by a browser, and distributing a preview request ID to each preview request;
and generating a corresponding event according to the preview request, and distributing an event ID to the event, wherein the preview request ID corresponds to the event ID one to one.
Preferably, the monitoring the processing state of the event includes:
creating a queue, storing the events in the queue, sequentially extracting the events from the queue for processing, and detecting whether the events being processed exist outside the queue;
and when detecting that the event which is being processed exists outside the queue, monitoring the processing state of the event which is being processed.
Preferably, the creating a queue, storing the event in the queue, and before sequentially extracting the event from the queue for processing, further includes:
opening up a separate background service, wherein the separate background service is only used for processing the preview request;
and creating a thread for the background service, wherein the thread is used for processing the preview request, and when any preview request is processed, the thread is informed to execute a callback function corresponding to the preview request.
Preferably, when it is detected that there is a processing event outside the queue, performing processing state monitoring on the processing event includes:
when detecting that there is a processing event outside the queue, detecting the processing state of the processing event;
when the processing state of the event being processed is monitored to be incomplete, suspending the extraction of the event in the queue until the processing state of the event being processed is complete, and continuing to extract the event from the queue for processing.
Preferably, the analyzing the preview request to obtain a plug-in path and a file path, and obtaining a corresponding pdf file according to the file path includes:
analyzing the preview request to obtain a file path in the preview request, and obtaining a corresponding pdf file according to the file path;
and obtaining a preset plug-in path according to the preview request.
Preferably, the invoking the plug-in corresponding to the plug-in path parses the pdf file to obtain encoded data of the pdf file, where the encoded data includes encoding format information corresponding to the plug-in, and includes:
obtaining a corresponding plug-in according to the plug-in path, calling the plug-in to perform binary conversion on the pdf file, and obtaining binary conversion data;
and converting the binary conversion data according to a preset coding format to obtain coded data.
The application also discloses a pdf file online previewing device, which comprises:
the system comprises an acquisition module, a preview module and a display module, wherein the acquisition module is used for acquiring a preview request initiated by a browser, generating a corresponding event according to the preview request, triggering the analysis of the corresponding preview request according to the event and monitoring the processing state of the event, and the event processing state comprises completion and incompletion;
the analysis module is used for analyzing the preview request to obtain a plug-in path and a file path, and obtaining a corresponding pdf file according to the file path, wherein the plug-in path is used for identifying an address stored by a plug-in, and the plug-in is used for analyzing the pdf file;
the coding module is used for calling the plug-in corresponding to the plug-in path to analyze the pdf file to obtain coded data of the pdf file, wherein the coded data comprises coding format information corresponding to the plug-in;
and the sending module is used for sending the coding format corresponding to the event and the coded data of the pdf file to a browser for preview display when the processing state of any event is detected to be a finished state.
The application also discloses a pdf document online previewing device, which comprises a memory and a processor, wherein the memory stores computer readable instructions, and when the computer readable instructions are executed by one or more of the processors, the one or more of the processors execute the steps of the pdf document online previewing method.
The application also discloses a computer readable storage medium, which can be read and written by a processor, and the storage medium stores computer instructions, and when the computer readable instructions are executed by one or more processors, the one or more processors execute the steps of the pdf file online previewing method.
The beneficial effect of this application is: the method and the device have the advantages that the pdf file requested to be previewed is analyzed in the background to obtain the data text in the base64 coding format, and then the data text and the coding format are sent to the browser page, so that the browser page is restored into the pdf file to be previewed.
Drawings
Fig. 1 is a schematic flow chart of a pdf document online previewing method according to a first embodiment of the present application;
fig. 2 is a schematic flow chart of a pdf document online previewing method according to a second embodiment of the present application;
fig. 3 is a schematic flow chart of a pdf file online previewing method according to a third embodiment of the present application;
fig. 4 is a schematic flowchart of a pdf file online previewing method according to a fourth embodiment of the present application;
fig. 5 is a schematic flowchart of a pdf file online previewing method according to a fifth embodiment of the present application;
fig. 6 is a schematic flow chart of a pdf file online previewing method according to a sixth embodiment of the present application;
fig. 7 is a schematic flowchart of a pdf file online previewing method according to a seventh embodiment of the present application;
fig. 8 is a schematic structural diagram of an apparatus for previewing pdf files online according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
A flow of a pdf file online previewing method according to a first embodiment of the present application is shown in fig. 1, where this embodiment includes the following steps:
step s101, acquiring a preview request initiated by a browser, generating a corresponding event according to the preview request, triggering analysis of the corresponding preview request according to the event, and monitoring the processing state of the event, wherein the processing state of the event comprises completion and incompletion;
specifically, in this step, a user may start previewing a pdf file by clicking a preview button in a browser page, and after the browser page monitors a click operation of the user, a corresponding preview request may be generated according to the click operation of the current user, where the click operation of the user is a preview instruction of the user, and after the system receives the preview instruction, a corresponding preview request may be generated, where the preview request may include a plug-in path and a file path, the plug-in path includes a storage address of a plug-in a background (server), the plug-in is used to analyze and encode the pdf file and convert the pdf file into another encoded data text, and the file path includes a storage location of the pdf file in the background (server), where the pdf file is a pdf file that needs to be previewed currently.
Specifically, after a browsing request is sent to a background, the background is a server, where the background includes a background service written in node.js, and the background service is used to process the browsing request, where node.js is a JavaScript running environment based on a Chrome V8 engine, and node.js uses an event-driven non-blocking I/O model, so node.js does not create a new thread for each user connection, but only uses one thread. When a user is connected, an internal event is triggered, node.js programs are macroscopically parallel through a non-blocking I/O and event driving mechanism, namely, background services are enabled to process preview requests in parallel. For example, by using node. js, a server with 8GB memory, it is possible to handle connections of more than 4 ten thousand users at the same time. Thus, the operating system has no time overhead of thread creation and destruction.
Specifically, the preview request sent by each user can be regarded as an event, so that when a background receives the preview request of the user, the preview request can be generated into a corresponding event, and then a state is set for the event.
Step s102, analyzing the preview request to obtain a plug-in path and a file path, and obtaining a corresponding pdf file according to the file path, wherein the plug-in path is used for identifying an address stored by a plug-in, and the plug-in is used for analyzing the pdf file;
specifically, in this step, when processing a preview request, first, parsing the preview request is started, and a plug-in path and a file path in the preview request are obtained, where the plug-in path includes an address stored in a background or in a server, where the address is usually one UR L (uniform resource locator) and includes a prefix, and the prefix includes an IP address and a port number, so that the complete plug-in path and file path includes the prefix + UR L, and the path of the plug-in can be identified by the prefix corresponding to the plug-in and the UR L, then the corresponding plug-in is obtained under the plug-in path, the path of the file can be identified by the prefix corresponding to the file and the UR L, and then the corresponding pdf file is obtained under the file path according to the file name of the request.
Step s103, calling a plug-in corresponding to the plug-in path to analyze the pdf file to obtain encoded data of the pdf file, where the encoded data includes encoding format information corresponding to the plug-in;
specifically, in this step, after a plug-in and a pdf file are obtained, the pdf file may be parsed, where the parsing is to parse the pdf file through the plug-in, where the parsing includes converting binary content of the pdf file into data in other encoding formats, and new encoded data may be generated after the pdf file is re-encoded, where the format of the encoded data includes Base64, UTF8, and unicode, where the Base64 encoding format is most effective.
And step s104, when the processing state of any event is detected to be a finished state, sending the coding format corresponding to the event and the coding data of the pdf file to a browser for preview display.
Specifically, in this step, after the pdf file is parsed, that is, after the event is processed, the processing state of the event may be set to be complete, and in the background or server system, through monitoring the processing state of the event, once the state of any event is detected to be complete, the encoded data and the encoding format corresponding to the event are sent to the browser, so that the browser previews the pdf file online, where the encoding format may be informed in the feedback information, for example, the following characters may be added:
data:application/pdf;base64
after the browser page receives feedback information of the server, previewing the pdf file according to data in the feedback information, wherein the feedback information comprises returned encoded data and an encoding format, acquiring the encoding format to know that the encoding format is Base64, and restoring the encoded file according to the Base64 encoding format to preview the current pdf file.
In this embodiment, the pdf file requested to be previewed is analyzed in the background to obtain the data text in the base64 coding format, and then the data text and the coding format are sent to the browser page, so that the browser page is restored to the pdf file for previewing, the preview request can be processed in parallel, the capability of processing the preview request in the background is effectively improved, a pdf reader does not need to be pre-installed in the browser, no requirement is imposed on the browser, great convenience is provided for the user to preview, and the user experience is improved.
Fig. 2 is a schematic flow chart of a pdf file online previewing method according to a second embodiment of the present application, as shown in the drawing, in step s101, acquiring a preview request initiated by a browser, and generating a corresponding event according to the preview request, where the method includes:
step s201, acquiring a preview request initiated by a browser, and allocating a preview request ID to each preview request;
specifically, after a browsing request initiated by a browser is acquired, a unique ID may be allocated to the browsing request, where the ID is an identification number of the browsing request and is used to distinguish different browsing requests.
Step s202, generating a corresponding event according to the preview request, and assigning an event ID to the event, where the preview request ID corresponds to the event ID one to one.
Specifically, the corresponding event may be generated according to the preview request, because different types of events are processed in the background, and the event generated by the preview request is also to be distinguished from other types of events, the ID of the preview request may be used for the event generated by the preview request, or an event ID may be additionally assigned to the event for distinguishing different times, and the event ID and the preview request ID are corresponding to each other, that is, one event corresponds to one preview request.
In the embodiment, the event and the preview request are allocated with the identity identification numbers and are corresponded, so that the event and the preview request can be effectively distinguished, and the system processing efficiency is improved.
Fig. 3 is a schematic flow chart of a pdf file online previewing method according to a third embodiment of the present application, where as shown in the drawing, in step s101, the process status monitoring on the event includes:
step s301, creating a queue, storing the events in the queue, sequentially extracting the events from the queue for processing, and detecting whether there is an event being processed outside the queue;
particularly, a separate node.js service can be developed in the background service for processing the preview request sent by the user, and other services except the node.js service in the background service can be used for processing services which need a large amount of calculation, such as java service, and as the node.js service is in a single-thread non-blocking mode, the problem of the preview request which is not complex in logic and simple in operation is solved, and the processing efficiency can be greatly improved; the node.js service can receive preview requests from different users at the same time, firstly, a queue can be created in the node.js service for storing events corresponding to the preview requests, and when the node.js service receives a preview request of a user, corresponding events can be generated according to the preview request. Js notifies a thread executing an I/O operation in the form of an event when the execution of a certain I/O is completed, and the thread executes a callback function of the event, so that a single thread can process a plurality of events at the same time, wherein each event corresponds to a preview request.
Specifically, after the events are stored in the queue, the events can be extracted from the queue and processed sequentially, that is, the events are extracted from one queue one by one, so that before one event is extracted from the queue, it is necessary to detect whether there is an event being processed outside the queue, and in an initial state, there is no event outside the queue for processing, so that an event can be extracted from the queue arbitrarily for processing, and the extraction can also be performed according to the sequence of events stored in the queue, for example, the event stored in the queue first is processed preferentially.
Step s302, when detecting that there is a processing event outside the queue, monitoring a processing state of the processing event.
Specifically, when it is found that there is an event being processed outside the queue through detection, the processing state of the event being processed needs to be monitored, if the processing state of the event is complete, the event can be continuously extracted from the queue for processing, and if the processing state of the event is incomplete, the extraction of the event from the queue needs to be suspended.
In this embodiment, the events in the queue are extracted and processed by monitoring the events outside the queue, so that the efficiency of processing the events at the server side can be effectively improved.
Fig. 4 is a schematic flow chart of a pdf file online previewing method according to a fourth embodiment of the present application, where as shown in the step s301, a queue is created, the event is stored in the queue, and before the event is sequentially extracted from the queue and processed, the method further includes:
step s401, opening up an individual background service, where the individual background service is only used for processing a preview request;
particularly, a separate node.js service can be developed in the background service for processing the preview request sent by the user, and other services except the node.js service in the background service can be used for processing services which need a large amount of calculation, such as java service.
Step s402, creating a thread for the background service, where the thread is used to process the preview request, and when any preview request is processed, notifying the thread to execute a callback function corresponding to the preview request.
Specifically, the node.js service may receive preview requests from different users at the same time, first, a queue may be created in the node.js service for storing events corresponding to the preview requests, and each time the node.js service receives a preview request from a user, the node.js service may generate a corresponding event according to the preview request. Js notifies a thread executing an I/O operation in the form of an event when the execution of a certain I/O is completed, and the thread executes a callback function of the event, so that a single thread can process a plurality of events at the same time, wherein each event corresponds to a preview request.
Js service is developed to process a large amount of lightweight preview requests, and other services with large computation amount are processed by other services, so that the processing efficiency can be greatly improved.
Fig. 5 is a schematic flow chart of a pdf file online previewing method according to a fifth embodiment of the present application, as shown in step s302, when a processing event is detected outside the queue, performing processing state monitoring on the processing event, including:
step s501, when detecting that there is a processing event outside the queue, detecting a processing state of the processing event;
specifically, when it is detected that there is an event being processed outside the queue, the processing state of the event being processed may be further detected, where the processing state includes complete and incomplete.
Step s502, when it is monitored that the processing state of the event being processed is not completed, suspending the extraction of the event in the queue until the processing state of the event being processed is completed, and continuing to extract the event from the queue for processing.
Specifically, if it is detected that the processing status of the event being processed is not complete, the extraction of the event in the queue may be suspended, and the processing of the event being processed may be waited for to be complete, whereas if the processing status of the event being processed is complete, the extraction of the event from the queue may be continued for processing.
In this embodiment, the processing state of the event outside the queue is monitored, so that the event in the queue is extracted and processed, and the efficiency of processing the event at the server side can be effectively improved.
Fig. 6 is a schematic flow chart of a pdf file online previewing method according to a sixth embodiment of the present application, where as shown in the drawing, in step s102, the previewing request is parsed to obtain a plug-in path and a file path, and a corresponding pdf file is obtained according to the file path, including:
step s601, analyzing the preview request, obtaining a file path in the preview request, and obtaining a corresponding pdf file according to the file path;
specifically, after a preview request is obtained, the preview request may be analyzed, the preview request includes a file path, an address for storing the pdf file may be obtained by analyzing the file path, and then the corresponding pdf file is obtained according to the address.
And step s602, obtaining a preset plug-in path according to the preview request.
Specifically, the preview request may include a file path and a plug-in path, where the plug-in path is used to indicate an address for storing a plug-in, and since the address of the plug-in is generally fixed and will not change with different pdf files, the path for storing the plug-in may be preset at the server side, and after the preview request is obtained, the preset plug-in path may be obtained.
In this embodiment, the file path and the preset plugin path are obtained through analyzing the preview request, so that the corresponding pdf file and plugin can be effectively found through the path, and the processing efficiency of the server side is improved.
Fig. 7 is a schematic flow chart of a pdf file online previewing method according to a seventh embodiment of the present application, as shown in fig. 103, invoking a plug-in corresponding to the plug-in path to parse the pdf file to obtain encoded data of the pdf file, where the encoded data includes encoding format information corresponding to the plug-in, and includes:
step s701, obtaining a corresponding plug-in according to the plug-in path, and calling the plug-in to perform binary conversion on the pdf file to obtain binary conversion data;
specifically, after a plug-in path is obtained, a corresponding plug-in can be found according to the path, and then the plug-in can be called to convert the pdf file, where the pdf file can be regarded as a character string component, and the conversion includes converting a character string in the pdf file into a binary byte stream.
Step s702, converting the binary conversion data according to a preset encoding format to obtain encoded data.
Specifically, after converting the character string in the pdf file into the binary byte stream, then performing encoding format conversion on the binary byte stream, where the encoding format may be preset, where the encoding format includes base64, UTF8, unicode, etc., and the encoding format of base64 has the best effect, so the encoding format of base64 is usually selected; after the coding format conversion is carried out, corresponding coded data can be obtained, and the coded data are returned to the browser for previewing after the event processing is finished.
In this embodiment, the pdf file is converted in the encoding format at the server side, so that the preview is performed in the browser according to the encoding format, and the preview efficiency can be effectively improved.
Fig. 8 shows a structure of an online pdf file previewing apparatus according to the embodiment of the present application, including:
an obtaining module 801, an analyzing module 802, an encoding module 803 and a sending module 804; the acquiring module 801 is connected with the analyzing module 802, the analyzing module 802 is connected with the encoding module 803, and the encoding module 803 is connected with the sending module 804; the obtaining module 801 is configured to obtain a preview request initiated by a browser, generate a corresponding event according to the preview request, trigger analysis of the corresponding preview request according to the event, and monitor a processing state of the event, where the event processing state includes completion and incompletion; the parsing module 802 is configured to parse the preview request to obtain a plug-in path and a file path, and obtain a corresponding pdf file according to the file path, where the plug-in path is used to identify an address where a plug-in is stored, and the plug-in is used to parse the pdf file; the encoding module 803 is configured to invoke a plug-in corresponding to the plug-in path to analyze the pdf file, so as to obtain encoded data of the pdf file, where the encoded data includes encoding format information corresponding to the plug-in; the sending module 804 is configured to send the encoding format corresponding to the event and the encoded data of the pdf file to a browser for preview display when it is detected that the processing state of any event is the completion state.
The embodiment of the present application further discloses a pdf file online previewing device, which comprises a memory and a processor, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by one or more of the processors, the one or more of the processors execute the steps in the pdf file online previewing method in the foregoing embodiments.
The embodiment of the present application further discloses a computer-readable storage medium, which can be read and written by a processor, where the memory stores computer-readable instructions, and the computer-readable instructions, when executed by one or more processors, cause the one or more processors to execute the steps in the pdf file online previewing method in the above embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An online previewing method for a pdf file is characterized by comprising the following steps:
acquiring a preview request initiated by a browser, generating a corresponding event according to the preview request, triggering analysis of the corresponding preview request according to the event, and monitoring the processing state of the event, wherein the processing state of the event comprises completion and incompletion;
analyzing the preview request to obtain a plug-in path and a file path, and obtaining a corresponding pdf file according to the file path, wherein the plug-in path is used for identifying an address stored by a plug-in and the plug-in is used for analyzing the pdf file;
calling a plug-in corresponding to the plug-in path to analyze the pdf file to obtain coded data of the pdf file, wherein the coded data comprises coding format information corresponding to the plug-in;
and when the processing state of any event is detected to be a finished state, sending the coding format corresponding to the event and the coding data of the pdf file to a browser for preview display.
2. The method for previewing the pdf file online according to claim 1, wherein said obtaining a preview request initiated by a browser, and generating a corresponding event according to the preview request comprises:
acquiring preview requests initiated by a browser, and distributing a preview request ID to each preview request;
and generating a corresponding event according to the preview request, and distributing an event ID to the event, wherein the preview request ID corresponds to the event ID one to one.
3. The pdf file online previewing method of claim 2, wherein said monitoring the processing status of said event comprises:
creating a queue, storing the events in the queue, sequentially extracting the events from the queue for processing, and detecting whether the events being processed exist outside the queue;
and when detecting that the event which is being processed exists outside the queue, monitoring the processing state of the event which is being processed.
4. The method for on-line previewing pdf file according to claim 3, wherein said creating a queue, storing said event in said queue, and before extracting said event from said queue in turn for processing, further comprises:
opening up a separate background service, wherein the separate background service is only used for processing the preview request;
and creating a thread for the background service, wherein the thread is used for processing the preview request, and when any preview request is processed, the thread is informed to execute a callback function corresponding to the preview request.
5. The method for on-line previewing of a pdf file according to claim 4, wherein said monitoring the processing status of said processing event when it is detected that there is a processing event outside said queue comprises:
when detecting that there is a processing event outside the queue, detecting the processing state of the processing event;
when the processing state of the event being processed is monitored to be incomplete, suspending the extraction of the event in the queue until the processing state of the event being processed is complete, and continuing to extract the event from the queue for processing.
6. The method for on-line previewing of a pdf file according to claim 5, wherein said parsing said preview request to obtain a plug-in path and a file path, and obtaining a corresponding pdf file according to said file path comprises:
analyzing the preview request to obtain a file path in the preview request, and obtaining a corresponding pdf file according to the file path;
and obtaining a preset plug-in path according to the preview request.
7. The method for on-line previewing of a pdf file according to claim 6, wherein said invoking a plug-in corresponding to said plug-in path to parse said pdf file to obtain encoded data of said pdf file, wherein said encoded data includes encoding format information corresponding to said plug-in, includes:
obtaining a corresponding plug-in according to the plug-in path, calling the plug-in to perform binary conversion on the pdf file, and obtaining binary conversion data;
and converting the binary conversion data according to a preset coding format to obtain coded data.
8. An online pdf file previewing device, comprising:
the system comprises an acquisition module, a preview module and a display module, wherein the acquisition module is used for acquiring a preview request initiated by a browser, generating a corresponding event according to the preview request, triggering the analysis of the corresponding preview request according to the event and monitoring the processing state of the event, and the event processing state comprises completion and incompletion;
the analysis module is used for analyzing the preview request to obtain a plug-in path and a file path, and obtaining a corresponding pdf file according to the file path, wherein the plug-in path is used for identifying an address stored by a plug-in, and the plug-in is used for analyzing the pdf file;
the coding module is used for calling the plug-in corresponding to the plug-in path to analyze the pdf file to obtain coded data of the pdf file, wherein the coded data comprises coding format information corresponding to the plug-in;
and the sending module is used for sending the coding format corresponding to the event and the coded data of the pdf file to a browser for preview display when the processing state of any event is detected to be a finished state.
9. A pdf document online previewing apparatus comprising a memory and a processor, said memory having stored therein computer readable instructions which, when executed by one or more of said processors, cause one or more of said processors to perform the steps of the pdf document online previewing method recited in any one of claims 1-7.
10. A computer-readable storage medium readable by a processor, the storage medium storing computer instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the pdf file online preview method recited in any of claims 1-7.
CN202010156690.5A 2020-03-09 2020-03-09 Online pdf file previewing method and device, computer equipment and storage medium Pending CN111444671A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010156690.5A CN111444671A (en) 2020-03-09 2020-03-09 Online pdf file previewing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010156690.5A CN111444671A (en) 2020-03-09 2020-03-09 Online pdf file previewing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111444671A true CN111444671A (en) 2020-07-24

Family

ID=71627279

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010156690.5A Pending CN111444671A (en) 2020-03-09 2020-03-09 Online pdf file previewing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111444671A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377950A (en) * 2021-06-02 2021-09-10 浪潮软件股份有限公司 Method for realizing flat storage and real-time preview of unstructured document

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113377950A (en) * 2021-06-02 2021-09-10 浪潮软件股份有限公司 Method for realizing flat storage and real-time preview of unstructured document

Similar Documents

Publication Publication Date Title
US8413044B2 (en) Method and system of retrieving Ajax web page content
JP2011028737A (en) Method for enhancement of screen-capturing function so as to process form, and computer program
CN109558199B (en) Information pushing method, device, equipment and storage medium
JP2010128877A (en) Web system and method of collecting processing record
US20100017426A1 (en) Form Attachment Metadata Generation
US10452730B2 (en) Methods for analyzing web sites using web services and devices thereof
CN105468587B (en) A kind of webpage method for monitoring abnormality and device
CN106951270B (en) Code processing method, system and server
CN114465741B (en) Abnormality detection method, abnormality detection device, computer equipment and storage medium
CN111679886A (en) Heterogeneous computing resource scheduling method, system, electronic device and storage medium
US10775751B2 (en) Automatic generation of regular expression based on log line data
US10574773B2 (en) Method, device, terminal, server and storage medium of processing network request and response
CN111444671A (en) Online pdf file previewing method and device, computer equipment and storage medium
JP6015849B2 (en) Log output control device, method and program
JP2008134906A (en) Business process definition generation method, device and program
WO2023092580A1 (en) Page display method and apparatus, storage medium, and electronic device
KR101595882B1 (en) Apparatus and method for analyzing video and image
CN108287874B (en) DB2 database management method and device
JP2000090120A (en) Method and device for document processing and machine readable medium
CN113704216A (en) System log processing method and device, computer equipment and storage medium
CN108287831B (en) URL classification method and system and data processing method and system
JP7304196B2 (en) Information analysis device, information analysis method, program and information analysis system
CN112751891B (en) Kafka-based message processing method, electronic equipment and storage medium
CN113867726A (en) Method and device for expanding page rich text editor, storage medium and electronic equipment
CN116502192B (en) Data confusion method and device and electronic equipment

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