Method for solving online preview of non-office file
The method addresses user experience and security issues in non-Office document preview by converting files to PDF and images via an API gateway, ensuring fast and stable online preview across devices with asynchronous processing and storage.
Patent Information
- Application Number
- CN202510178003.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-18
- Publication Date
- 2025-06-03
AI Technical Summary
Existing methods for online previewing non-Office documents face issues such as user experience degradation due to plugin requirements, security vulnerabilities, performance bottlenecks, high technical complexity, and the need for client-side installations, while maintaining compatibility and security.
A method involving user upload and conversion of non-Office files through an API gateway, followed by conversion to PDF and images, with asynchronous processing and storage in a MySQL database, enabling fast and stable online preview across multiple devices.
Enables fast, format-preserving, and stable online preview of non-Office documents with asynchronous conversion, failure retries, and real-time notifications, supporting multiple platforms without plugin installation or cloud dependency.
Smart Images

Figure CN120087326A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer networks, and specifically to a method for solving the online preview of non-office files. Background Art
[0002] The preview of non-Office documents means that the documents are displayed in the form of flash on the web page. In the prior art, the following methods are mostly adopted for the online preview of non-office documents: 1. Plugin and extension-based preview technology: Through browser plugins or extension programs, non-office files are directly parsed and rendered in the browser. Although the files can be directly parsed in the browser without uploading to the server, and it supports in-depth parsing and rendering of specific formats, this method requires users to install plugins, resulting in a poor user experience. Moreover, different plugins may be required for different browsers and operating systems. At the same time, the installed plugins may have vulnerabilities, leading to malicious file attacks.
[0003] 2. Cloud rendering-based preview technology: The file is uploaded to the cloud server, and the preview content is generated through the cloud rendering engine and then viewed through the browser. Although it can support multiple file formats and users can directly access through the browser without installing software, this method depends on cloud services, may have performance bottlenecks, and there are certain privacy and security risks in uploading files to the cloud. At the same time, the upload and rendering time for large files is relatively long.
[0004] 3. WebAssembly-based preview technology: Utilizing WebAssembly technology, the file parsing and rendering engine is compiled into binary code executable by the browser and directly runs in the browser. This method has the advantages of high performance, fast parsing and rendering speed, no need to install plugins, good compatibility, and support for in-depth parsing and rendering of complex file formats. However, the required technical implementation is complex, the technology development cost is relatively high, and additional parsing engines are still required for some special formats.
[0005] 4. Client-side rendering-based preview technology: The file is previewed through the client (such as a desktop application or a mobile application), and then the preview content is displayed through the browser. Although it supports in-depth parsing and rendering of complex file formats, does not depend on cloud services, and has good performance, this method requires users to install the client, resulting in a poor user experience, cannot achieve true online preview, and depends on local devices. Summary of the Invention
[0006] To solve the above problems, the present invention provides a method for solving online preview of non-office files, including the following steps: S1. The user uploads a non-office file and sends an online preview request; S2. Process and convert the user-requested file; S3. Return and send the converted mq message to the user; S4. The user performs an online preview of the non-office file by consuming the mq message.
[0007] Further, the specific sub-steps in the S1 step include: S11. The user uploads a non-office file and sends an online preview request; S12. The request is delivered to the backend through the API gateway and F5 load balancing for processing and conversion.
[0008] Further, a file conversion service and a file reading service are set in the API gateway; the file conversion service is used to obtain the address of the non-office file; the file reading service is used to read the file content information through the obtained address of the non-office file.
[0009] Further, the conversion of the user-requested file in the S2 step is specifically: converting the non-office file into a PDF file, and then outputting after converting the PDF file into a picture.
[0010] Further, when the file conversion fails in the S2 step, the file is automatically re-converted.
[0011] Further, it also includes a file storage step: storing the generated preview pictures and call information files in a file storage server, and storing the user requests and conversion data in an sql database.
[0012] Further, the sql database is specifically a MySQL database.
[0013] The present invention provides a method for solving online preview of non-office files, having the following beneficial effects: The present invention supports fast preview of non-office documents, previewing in the form of pictures, without destroying the original format and style, fast response to preview, chapter-by-chapter display, and achieving fast page turning without lag. The online preview component also has functions such as file conversion and picture conversion. The present invention can meet the requirement of fast preview of office documents on multiple terminals (mobile phones, PCs, PADs), and supports the function of file conversion, realizing functions such as asynchronous conversion, failure retry, and message notification, maximizing the guarantee of the stability and real-time performance of the preview. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.
[0015] Figure 1 It is the flowchart of the method provided by the present invention. Specific embodiments
[0016] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0017] The following will detail the implementation method of the present invention in conjunction with the drawings. What is described is only some embodiments, not all embodiments. For the purpose of clarity, the representations and descriptions unrelated to the present invention are omitted in the drawings and the description.
[0018] In order to have a clearer understanding of the technical features, objectives, and beneficial effects of the present invention, the technical solutions of the present invention are described in detail below. Obviously, the described embodiments are part of the embodiments of the present invention, not all embodiments, and should not be construed as limiting the scope of the present invention that can be implemented. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present invention.
[0019] As Figure 1 shown, the present invention provides a method for solving online preview of non-office files, including the following steps: S1. The user uploads a non-office file and sends an online preview request; S2. Process and convert the user-requested file; S3. Return the converted mq message to the user; S4. The user performs an online preview of the non-office file by consuming the mq message.
[0020] The specific sub-steps in step S1 include the following: S11. The user uploads a non-office file and sends an online preview request; S12. The request is delivered to the backend through the API gateway and the F5 load balancer for processing and conversion.
[0021] The API gateway is provided with a file conversion service and a file reading service; the file conversion service is used to obtain the address of the non-office file; the file reading service is used to read the file content information through the obtained address of the non-office file.
[0022] In step S2, the conversion of the user request file is specifically as follows: non-office files are converted into PDF files, and after the PDF files are converted into pictures, they are output; when the file conversion fails, the files are automatically reconverted.
[0023] It further includes a file storage step: the generated preview pictures and call information files are stored in a file storage server, and the user requests and conversion data are stored in an SQL database; specifically, the SQL database is a MySQL database.
[0024] In the present invention, it is deployed in a cluster mode, supports horizontal expansion of services, supports access to backend services and submission of front-end pages, which is convenient for developers to use. At the same time, it supports submitting multiple files at one time for conversion processing.
[0025] An asynchronous conversion process is also set up, which can immediately return the file path and perform asynchronous conversion in the background to avoid long waiting. And before the file conversion is completed, accessing pictures or non-office files through the path will display "processing" to avoid conversion failure caused by inaccessible paths.
[0026] The present invention supports quick preview of non-office documents, previewing in the form of pictures without destroying the original format and style, with quick response to preview, chapter-by-chapter display, and smooth page turning without lag. The online preview component also has functions such as file conversion and picture conversion. The present invention can meet the needs of quick preview of office documents on multiple devices (mobile phones, PCs, PADs), supports the function of file conversion, and realizes functions such as asynchronous conversion, failure retry, and message notification, maximizing the stability and real-time performance of the preview.
[0027] The above are only the preferred embodiments of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, should not be regarded as excluding other embodiments, and can be used in various other combinations, modifications, and environments, and can be changed within the scope of the concept described herein through the above teachings or the technology or knowledge in related fields. And the changes and modifications made by those skilled in the art without departing from the spirit and scope of the present invention shall fall within the protection scope of the appended claims of the present invention.
Claims
1. A method for solving the problem of online preview of non-office files, characterized in that: The following steps are involved: S1. The user uploads a non-office file and sends an online preview request; S2. Process and convert the user request file; S3. Send the converted MQ message back to the user; S4. Users preview non-office files online by consuming MQ messages.
2. The method for solving the problem of online preview of non-office files according to claim 1, characterized in that: The S1 step specifically includes the following sub-steps: S11. The user uploads a non-office file and sends an online preview request; S12. The request is transmitted to the backend through the API gateway and F5 load balancing for processing and conversion.
3. The method for solving the problem of online preview of non-office files according to claim 2, characterized in that: The API gateway is provided with a file conversion service and a file reading service; the file conversion service is used to obtain a non-office file address; the file reading service is used to read file content information through the obtained non-office file address.
4. The method for solving the problem of online preview of non-office files according to claim 1, characterized in that: The conversion of the user requested file in step S2 specifically includes: converting the non-office file into a PDF file, and then converting the PDF file into a picture and outputting it.
5. The method for solving the problem of online preview of non-office files according to claim 4, characterized in that: When the file conversion fails in the step S2, the file is automatically reconverted.
6. The method for solving the problem of online preview of non-office files according to claim 1, characterized in that: The method also includes a file storage step: storing the generated preview image and call information file in a file storage server, and storing the user request and conversion data in a SQL database.
7. The method for solving the problem of online preview of non-office files according to claim 6, characterized in that: The sql database is specifically a MySQL database.