File processing method and device, equipment and storage medium thereof

By uploading image data of web page format content to a cloud object storage device and replacing the original data with a link address, the problems of poor user experience and high resource usage caused by manual operations during file conversion are solved, and more efficient file format conversion and loading speed are achieved.

CN114329283BActive Publication Date: 2025-10-17TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011051857.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-29
Publication Date
2025-10-17
Estimated Expiration
2040-09-29

AI Technical Summary

Technical Problem

In the prior art, manual copying and pasting is required during the file conversion process, resulting in a poor user experience, high server storage space and bandwidth usage, and slow page loading speed.

Method used

By extracting image data from web page format content and uploading it to a cloud object storage device, the original data is replaced with the image link address, reducing storage space usage and speeding up loading.

Benefits of technology

It improves the efficiency of file format conversion, reduces data storage space and bandwidth usage, and speeds up page loading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114329283B_ABST
    Figure CN114329283B_ABST
Patent Text Reader

Abstract

The application discloses a file processing method and device, equipment and a storage medium thereof. The method comprises the following steps: when a save operation input for web format content is received, picture data contained in the web format content is extracted, wherein the web format content refers to content filled into a rich text editor; the picture data is uploaded to a cloud object storage device; a picture link address corresponding to the picture data returned by the cloud object storage device is received; and the picture link address is used to replace the picture data to obtain target web format content. According to the technical scheme of the embodiment of the application, the picture data is replaced by the picture link address, the storage space of the picture data in the database is reduced, the bandwidth occupation is reduced, the page loading speed is accelerated, and the efficiency of the file format conversion is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application generally relates to the technical field of file conversion, and particularly relates to a file processing method and device, equipment and a storage medium thereof. BACKGROUND

[0002] In some application scenarios, it is required to convert the content contained in a common office file into a rich text editor in a webpage, and display the content of the office file in the rich text editor in the webpage. For example, the content in the office file is copied and pasted one by one into the rich text editor in the webpage by manual copy-paste. Alternatively, it is required to convert the rich text content displayed in the rich text editor in the webpage into an office file and download it to the local. During the downloading process, the relevant content needs to be manually copied from the rich text editor and then pasted into the office file, and then the format of the office file needs to be adjusted according to the user's requirements. The repeated copy-paste and repeated operation make the user experience not good.

[0003] For another example, the office file to be converted is uploaded to a certain transcoding webpage (or transcoding server) for transcoding processing, and the content corresponding to the format expected to be converted by the user is obtained. This way results in too long waiting time for the user, and the user experience is not good. SUMMARY

[0004] In view of the above defects or deficiencies in the prior art, it is desirable to provide a file processing method, device, equipment and storage medium thereof to improve the user experience.

[0005] In a first aspect, an embodiment of the present application provides a file processing method, which comprises:

[0006] When a save operation input for a webpage format content is received, picture data contained in the webpage format content is extracted, wherein the webpage format content refers to content filled into a rich text editor;

[0007] The picture data is uploaded to a cloud object storage device;

[0008] A picture link address corresponding to the picture data returned by the cloud object storage device is received;

[0009] The picture link address is used to replace the picture data, and target webpage format content is obtained.

[0010] In a second aspect, an embodiment of the present application provides a file processing method, which comprises:

[0011] When a first download request for a webpage format content is received, a picture link address contained in the webpage format content is extracted, wherein the webpage format content refers to webpage content corresponding to the first download request stored in a cloud database;

[0012] download the picture data from the cloud object storage device according to the picture link address request;

[0013] replace the picture link address with the picture data;

[0014] perform format conversion processing on the replaced web page format content to obtain a first target electronic file.

[0015] In a third aspect, an embodiment of the present application provides a file processing apparatus, which comprises:

[0016] a data extraction unit configured to extract picture data contained in web page format content when receiving a save operation input for the web page format content, the web page format content being content filled into a rich text editor;

[0017] a data uploading unit configured to upload the picture data to a cloud object storage device;

[0018] an address receiving unit configured to receive a picture link address corresponding to the picture data returned by the cloud object storage device;

[0019] a first replacement unit configured to replace the picture data with the picture link address to obtain target web page format content.

[0020] In a fourth aspect, an embodiment of the present application provides a file processing apparatus, which comprises:

[0021] an address extraction unit configured to extract a picture link address contained in web page format content when receiving a first download request for the web page format content, the web page format content being web page content corresponding to the first download request and stored in a cloud database;

[0022] a data downloading unit configured to download picture data from the cloud object storage device according to the picture link address;

[0023] a second replacement unit configured to replace the picture link address contained in the web page format content with the picture data;

[0024] a second format conversion unit configured to perform format conversion processing on the replaced web page format content to obtain a first target electronic file.

[0025] In a fifth aspect, an embodiment of the present application provides a computer device, which comprises a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor implements the method described in the embodiments of the present application when executing the program.

[0026] In a sixth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is used for:

[0027] The computer program is executed by the processor to implement the method described in the embodiments of the present application.

[0028] The file processing method, device, equipment and storage medium provided by the embodiments of the present application, when receiving the save operation input for the web format content, the picture data contained in the web format content is extracted, and then the picture data is uploaded to the cloud object storage device; the picture link address corresponding to the picture data returned by the cloud object storage device is received; finally, the picture link address is used to replace the picture data, and the target web format content is obtained, wherein the web format content is the content filled into the rich text editor after the original format electronic file to be converted is format converted. The picture link address is used to replace the picture data, the storage space of the picture data in the database is reduced, the bandwidth occupation is reduced, the page loading speed is accelerated, and the efficiency of the file format conversion is effectively improved. BRIEF DESCRIPTION OF DRAWINGS

[0029] Other features, objects and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments made with reference to the accompanying drawings:

[0030] Figure 1 is the implementation environment architecture diagram of the file processing method provided by the embodiments of the present application;

[0031] Figure 2 The flowchart of the file processing method provided by the embodiments of the present application is shown;

[0032] Figure 3 The operation schematic diagram of the file selection interface provided by the embodiments of the present application is shown;

[0033] Figure 4 The interface schematic diagram of the file conversion result provided by the embodiments of the present application is shown;

[0034] Figure 5 The flowchart of the file processing method provided by the embodiments of the present application is shown;

[0035] Figure 6 The flowchart of the file processing method provided by the embodiments of the present application is shown;

[0036] Figure 7 The interface schematic diagram of the file processing method provided by the embodiments of the present application is shown;

[0037] Figure 8 The file upload progress interface schematic diagram provided by the embodiments of the present application is shown;

[0038] Figure 9 The flowchart of the file processing method provided by the embodiments of the present application is shown;

[0039] Figure 10 Fig. 1 shows a flow diagram of a file processing method provided by an embodiment of the present application;

[0040] Fig. 11(a) shows an interface diagram of a student writing an experiment report under a superior provided by an embodiment of the present application;

[0041] Fig. 11(b) shows an interface diagram of a student submitting an experiment report provided by an embodiment of the present application;

[0042] Fig. 11(c) shows an interface diagram of a teacher checking an experiment report submitted by a student provided by an embodiment of the present application;

[0043] Fig. 11(d) shows an interface diagram of saving an experiment report provided by an embodiment of the present application;

[0044] Fig. 11(e) shows an interface diagram of saving an experiment report in a DOC format provided by an embodiment of the present application;

[0045] Fig. 11(f) shows an interface diagram of saving an experiment report in a PDF format provided by an embodiment of the present application;

[0046] Figure 12 Fig. 12 shows a structure diagram of a file processing apparatus provided by an embodiment of the present application;

[0047] Figure 13 Fig. 12 shows a structure diagram of a file processing apparatus provided by an embodiment of the present application

[0048] Figure 14 Fig. 13 shows a structure diagram of a computer system of a terminal device or a server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION

[0049] The present application will be further described below in conjunction with the drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the related disclosure, but not to limit the disclosure. In addition, it should be noted that only the parts related to the disclosure are shown in the drawings for the convenience of description.

[0050] It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict. The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments.

[0051] Explanation of technical terms

[0052] Rich text format refers to a document rendered and calculated at a high level and then presented to a user for browsing. For example, an HTML format document, a Word document.

[0053] Rich Text Editor (RTE) refers to the user can directly edit the text, graphics or other elements in the editable area of the document, which can achieve bold, italic, underline, color word, picture effect. Rich Text Editor is often used in interactive platform, for example, for editing blogs, user interaction. Rich text editing can also be understood as a kind of embedded in the browser, what you see is what you get text editor.

[0054] Cloud object storage: also known as cloud object storage, is a cloud device for implementing object storage. Object storage is a method for solving and processing objects, that is, taking objects as the basic unit of storage, an object can be a combination of file data and a set of attribute information.

[0055] Figure 1 is the implementation environment architecture diagram of the file processing method provided by the embodiment of the application. As shown in Figure 1 the implementation environment architecture includes a plurality of terminal devices 101 and a server 103, and a public network 102 for connecting the terminal devices 101 and the server 103.

[0056] In the online education scenario, teachers use terminal devices 101 to upload existing electronic files to the server 103, or third-party service providers upload existing shared electronic documents to the server 103 to facilitate students' online learning. The format of the existing electronic file can be a Doc file, a Docx file, and a PDF file, etc. After the students complete the course learning online using the terminal device 103, the web page rich text format content such as classroom notes and experiment reports is created in the form of rich text in the web page, and then can be downloaded in the local in the form of Doc file, Docx file and PDF file, etc.

[0057] The terminal device 101 can be a smart TV, a smart phone, a tablet computer, a smart glasses, etc. mobile device, but also can be a desktop computer, etc. electronic equipment, but not limited to this.

[0058] The server 103 processes and stores the electronic documents uploaded by the teachers using the terminal devices 101. The server 103 can also process and store the web page format content edited online by the students using the terminal devices 101.

[0059] The server 103 can be a standalone physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms, etc. basic cloud computing services.

[0060] The server 103 can receive the uploaded file content from the terminal device 101, and the server 103 can also send the converted electronic document to the terminal device 101. The terminal device 101 and the server 103 are connected directly or indirectly through the public network 102. Optionally, the public network can include a wireless network or a wired network, and standard communication technology and / or protocols are used through the wireless network or the wired network. The network is usually the Internet, and can also be any network, including but not limited to a local area network (LAN), a metropolitan area network (MAN), a wide area network (WAN), a mobile, wired or wireless network, a private network or any combination of virtual private networks.

[0061] In the above implementation environment, in order to realize the mutual conversion between the file format and the webpage rich text format, for example, a teacher uploads a file, and needs to convert the uploaded file into a webpage rich text format, and a student downloads the content of the webpage rich text format, and needs to convert the content of the webpage rich text format into an office file format. In the related art, an operator such as a teacher or a student manually copies the content of a file to be uploaded into a webpage rich text editor step by step, or copies the content in the webpage rich text editor into a file to be downloaded step by step. Such repeated copying and pasting makes the operation efficiency of the user extremely low in the process of using an online teaching product.

[0062] For example, in other related technologies, a file uploaded by a user can be transmitted to a server, the server performs format conversion processing, and then transmits the data back to the client. The client converts the transmitted data to obtain a webpage rich text format that can be displayed and edited on a page of the client. The server needs to store the entire content of the uploaded file in an associated database, which requires a high storage space of the database. If a large number of users perform synchronous operations and access the server, the bandwidth occupancy rate of the server will be too high, and the page loading speed will be too slow.

[0063] Based on the above problems, the present application provides a file processing method, which can effectively solve the above problems, improve the operation efficiency of the user, and improve the experience of the user.

[0064] As shown in Figure 2 As shown in Figure 2 A flowchart of a file processing method provided by an embodiment of the present application is shown. The file processing device can be arranged on a terminal device, or arranged on a server, or distributed on the terminal device and the server. The method includes the following steps.

[0065] Step 201, upon receiving a save operation input for web page format content in a rich text editor, extracting picture data contained in the web page format content.

[0066] Step 202, uploading the picture data to a cloud object storage device;

[0067] Step 203, receiving a picture link address corresponding to the picture data returned by the cloud object storage device;

[0068] Step 204, replacing the picture data with the picture link address to obtain target web page format content.

[0069] In the above steps, the web page format content refers to the content filled into the rich text editor after the original format electronic file to be converted is format-converted. For example, Figure 4 as shown in the specific experimental content.

[0070] The original format electronic file to be converted refers to an electronic file uploaded through a client pre-installed on a terminal device. The original format refers to an initial format without conversion. For example, it can be in Doc, Docx, PDF, etc.

[0071] When the browser receives the uploaded electronic file, the browser sends the electronic file to the conversion cluster service for conversion and then fills it into the rich text editor to obtain web page format content. The web page format content can also be referred to as web page rich text format content. It can include picture content and text content. As shown in Figure 3 , the file with the name "experimental scene introduction.docx" shown in the figure is the original format electronic file to be converted. After format conversion processing, the content displayed in the rich text editor as shown in Figure 4 is obtained, i.e., the web page format content. The web page format content displayed in the rich text editor content includes text content and picture content.

[0072] The above picture data refers to data processed according to the picture encoding method. For example, the picture in the word document is processed according to the Base64 format encoding to obtain Base64 code. The picture data can be written into the picture address label of the web page format content. For example, the Base64 format picture data written into the picture address label content can be:

[0073] <img

[0074] src="data:image / png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEA AAAkCAYAAABIdFAMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHhJREFUeNo8zjsOxCAMBFB / KEAUFFR0Cbng3nQPw68ArZdAlOZppPFIBhH5EAB8b+Tlt9MYQ6i1BuqFaq1CKSVcxZ2Acs6406KUgpt5 / LCKuVgz5BDCSb13ZO99ZOdcZGvt4mJjzMVKqcha68iIePB86GAiOv8CDADlIUQBs7MD3wAAAABJRU5ErkJggg%3D%3D" / >

[0075] The process of converting the electronic file into the web page format content: the electronic file can be converted into intermediate web page format content first; then the intermediate web page format content is filled into the rich text editor of the browser to obtain the web page format content. The intermediate web page format content may be, for example, HTML format content or HTML5 format content.

[0076] After obtaining the web page format content, the user (for example, a teacher) can edit the web page format content multiple times, for example, deleting, modifying, adjusting, etc. operation on the text content in the rich text editor, or replacing, adjusting, etc. operation on the picture.

[0077] When the user inputs a save operation for the web page format content, the picture data contained in the web page format content is extracted, and the picture data is uploaded to the cloud object storage device. Then the picture link address corresponding to the picture data is received from the cloud object storage device, and the picture link address is used to replace the picture data to obtain the modified web page format content, that is, the target web page format content.

[0078] The above-mentioned picture link address refers to a uniform resource locator (English full name, Uniform Resource Locator, English abbreviation URL) for storing a picture binary object. URL is a concise representation of the location and access method of the resource obtained from the Internet, and is the address of the standard resource on the Internet. In this application, the picture link address is the address resource allocated by the cloud object storage device for the picture binary object. For example, the picture link address written in the picture tag address can be:

[0079] <img

[0080] src="https: / / sandbox-images-pro-1255701415.cos.ap-guangzhou.myqcloud.com / companyId-95 / qcloudId-100004645036 / 1534925316674-2.png">.

[0081] The present application saves the storage space of the picture data by uploading the picture data to the cloud object storage device and replacing the picture data of the web page format content with the picture link address, and does not affect the display of the picture in the rich text editor, effectively improving the efficiency of the file format conversion.

[0082] The present application also provides a file processing method, as shown in Figure 5 Figure 5 The flowchart of the file processing method provided by the embodiments of the present application is shown. The method can be executed by a file processing device. The file processing device can be set on a terminal device, or on a server, or distributed on the terminal device and the server. The method comprises the following steps:

[0083] Step 301, obtaining an original format electronic file to be converted;

[0084] Step 302, performing format conversion on the electronic file to obtain intermediate web page format content;

[0085] Step 303, filling the intermediate web page format content into a rich text editor to obtain web page format content;

[0086] Step 304, when receiving a save operation input for the web page format content in the rich text editor, extracting picture data contained in the web page format content.

[0087] Step 305, uploading the picture data to a cloud object storage device;

[0088] Step 306, receiving a picture link address corresponding to the picture data returned by the cloud object storage device;

[0089] Step 307, replacing the picture data with the picture link address to obtain target web page format content.

[0090] ​In the above steps, obtaining the electronic file of the original format to be converted can filter a plurality of electronic files of the original format according to a preconfigured file magic number and file parameters to obtain the electronic file of the original format to be converted. The file magic number refers to the content corresponding to a plurality of bytes starting from the initial position of the file. The content of the plurality of bytes is usually fixed and can be intentionally filled or fixedly generated. The file type corresponding to the file can be determined through the content of the plurality of bytes.

[0091] By filtering and screening a plurality of electronic files of the original format through the preconfigured file magic number and file parameters, electronic documents that are too large or do not conform to the processing requirements of the format can be excluded, and the file parameters can prevent overload of the engine caused by large documents. The file format can be screened through the file magic number, and the efficiency of file processing can be effectively improved. The file parameters, for example, the size parameter of the file. According to the processing capacity of the system, the size of the file allowed to be converted can be set to 10-50 MB or 50 MB or less. The size of the file can be set according to the processing capacity of the system, and is not limited here. The file magic number, for example, the magic number of PDF is 25504446, and the magic number of Docx is 504b030414000600. The representation of the file magic number has other ways, and is not limited here.

[0092] The electronic file includes text and pictures, and the format conversion of the electronic file can include:

[0093] The picture data included in the electronic file is encoded using an encoder corresponding to the picture data to obtain picture data;

[0094] The picture data is converted into a picture binary object;

[0095] The text data included in the electronic file is processed using an intermediate web page format to obtain intermediate web page format text data;

[0096] The picture binary object and the intermediate web page format text data are filled into an intermediate web page format template to obtain intermediate web page format content.

[0097] The picture binary object and the intermediate web page format text data are filled into an intermediate web page format template to obtain intermediate web page format content, which can include:

[0098] The picture binary object is filled into a picture address tag attribute of the intermediate web page format template to obtain picture content;

[0099] The intermediate web page format text data is filled into a text tag attribute of the intermediate web page format template to obtain text content.

[0100] The intermediate web page format content includes image content and text content.

[0101] The above-mentioned image address tag attributes include but are not limited to img src. Text tag attributes include but are not limited to title, paragraph, format, font, font size, font color, etc.

[0102] Taking a Word file as an example, when converting a Word file into an HTML file, the image and text within the Word file can be separated and the image can be encoded using a Base64 encoder to obtain a Base64-formatted image. The text content within the Word file is then processed according to predetermined text attributes to obtain the text content to be filled into the HTML file. According to the image address tag attribute and text tag attribute defined in the HTML template, the Base64-formatted image is entered into the image address tag attribute, and the text content to be filled into the HTML file is entered into the text tag attribute.

[0103] The image data can be, for example, Base64-encoded image data. During the upload of the image data to the cloud server, the Base64-encoded image data can be converted into an image binary object. The image binary object is then uploaded to the cloud object repository of the cloud database. The image is stored in the cloud object repository as an object. The cloud object repository returns the image link address corresponding to the image binary object.

[0104] The embodiment provided by the present application utilizes an image link address to replace image data in a web page format content, thereby effectively saving space for data storage and not affecting the display of the image in a rich text editor.

[0105] Optionally, in order to reduce the processing cost of file conversion and improve the processing efficiency of file conversion, this application also proposes a file conversion method. Figures 6-8 , Figure 6 A flowchart of a file processing method provided by an embodiment of the present application is shown. The method can be executed interactively between a terminal device and a server device. For example, an online education client is pre-installed on the terminal device, or a web page is accessed through a browser to implement the corresponding function. A document conversion service component is pre-installed on the server, and the server also includes a cloud object storage device and a cloud database. For example, the server includes a cloud container engine and a cloud object repository.

[0106] Step 401: The browser receives an operation input by a user to load a target document, where the target document is an electronic file in an original format to be processed.

[0107] In this step, it is assumed that a new experiment management object is created in the teaching and practicing one-stop platform, the experiment related information is filled in the page of creating a new experiment management, and the import of the word document in the rich text editor is selected. That is, the target document is loaded in the browser.

[0108] As shown in Figure 7 , the user clicks "select file" displayed in the page, and the page jumps to the interface diagram as shown in Figure 3 , the user selects the document with the name "experiment scene introduction.docx", and clicks open.

[0109] Step 402, the browser uploads the target document to the middleware;

[0110] Step 403, the middleware receives the target document, and checks whether the format of the target document meets the requirements.

[0111] In this step, the middleware checks the target document according to the pre-configured file magic number and file parameters, and sends a first file conversion request to the file conversion cluster service component if the file magic number and file parameters meet the requirements of the converted file. As shown in Figure 8 , the user can see the file upload progress on the upload progress bar of the browser.

[0112] Step 404, the middleware sends a first file conversion request to the file conversion cluster service component.

[0113] In this step, the electronic file that passes the middleware inspection sends a file conversion request to the file conversion cluster service component. For example, the first file conversion request is a conversion request for requesting conversion processing of the electronic file to obtain an HTML page.

[0114] The first file conversion request includes the original format of the electronic file to be converted and the intermediate web page format parameters. The intermediate web page format parameters may be, for example, HTML format or HTML5 format.

[0115] Step 405, the file conversion cluster service component receives the first file conversion request, and determines a working load in the file cluster service component according to a load balancing strategy.

[0116] In this step, the file conversion cluster service component refers to a plurality of service components for performing document conversion services, each service component including at least one working load. The working load is composed of one or more instances. An instance is composed of one or more containers, and each container corresponds to a container image.

[0117] The file conversion cluster service component selects one workload from the plurality of workloads according to a load balancing strategy. Then the LibreOffice document conversion engine in the workload is utilized to convert the electronic file in the first file conversion request. The first file conversion request can be an HTTP format request. After the LibreOffice document conversion engine receives the HTTP request, the document in the HTTP request is converted into an HTML page, in which the pictures are embedded in Base64 format. That is, the LibreOffice document conversion engine encodes the pictures in the document according to the Base64 encoding format to obtain picture data and text data.

[0118] Step 406, the workload is used to convert the electronic file into intermediate web page format content.

[0119] Step 407, the LibreOffice document conversion engine of the workload of the file conversion cluster service component returns the HTML page content middleware, which transmits the HTML page content to the browser.

[0120] In this step, as shown in the figure, the HTML page content is displayed in the rich text editor of the browser. The user can modify, add or delete the web page format content after conversion in the rich text editor content. Figure 4

[0121] Step 408, the browser fills the rich text editor with the HTML page content;

[0122] After filling the HTML page content into the rich text editor, the user can edit the content in the rich text editor multiple times, for example, the user manually modifies the text and pictures in the document, such as adding or deleting picture processing.

[0123] Step 409, the browser receives the user input save operation.

[0124] The save operation can be the user input click on the save button displayed on the page, including but not limited to receiving the user input click through the touch screen, or the click input through the mouse.

[0125] Step 410, the browser sends a submission save request to the middleware;

[0126] Step 411, the middleware traverses and extracts the base64 format pictures contained in the document corresponding to the submission save request;

[0127] In this step, the middleware separates the document content corresponding to the submission save request, that is, separates the document content in the rich text editor to obtain picture data and text data.

[0128] ​Step 412, the middleware converts the base64 format picture to obtain a picture binary object.

[0129] Step 412, the middleware uploads the picture binary object to a cloud object storage.

[0130] Step 413, the cloud object storage receives a picture link address URL corresponding to the picture binary object.

[0131] Step 414, the middleware replaces the picture data in the picture tag with the picture link address URL.

[0132] Step 415, the middleware sends a submission saving request to the cloud database, and the submission saving request includes the code content corresponding to the replaced rich text editor.

[0133] Step 416, the middleware receives a saving result returned by the cloud database, and sends the saving result to the browser.

[0134] The saving result is, for example, a saving success or a saving failure prompt message. When the saving result is returned, the webpage format content after the replacement processing can also be displayed in the browser.

[0135] The embodiments provided in the present application replace the picture data in the webpage format content with the picture link address, effectively saving the data storage space and speeding up the page loading speed. In addition, the open source LibreOffice and the load balancing strategy are used in the file conversion cluster service component, which can effectively improve the file processing efficiency.

[0136] In the online education scenario, after the student completes the experimental data filling operation on the webpage, in order to save the experimental data, it is necessary to convert the webpage format content into an electronic document. Please refer to Figure 9 , Figure 9 A flowchart of a file processing method provided by an embodiment of the present application is shown, which can be executed by a file processing device. The file processing device can be set on a terminal device or a server, or can be distributed on the terminal device and the server at the same time. The method comprises the following steps:

[0137] Step 501, when a first download request for webpage format content is received, a picture link address contained in the webpage format content is extracted.

[0138] Step 502, according to the picture link address, picture data is downloaded from a cloud object storage device.

[0139] Step 503, the picture data is used to replace the picture link address contained in the webpage format content.

[0140] In step 504, the replaced web page format content is subjected to format conversion processing to obtain a first target electronic file.

[0141] In the above steps, the web page format content refers to the content corresponding to the rich text editor stored in the cloud database. The web page format content is the content contained in the experiment report page filled in by the student. For example, the rich text editor content in the page displayed on the student client, the experiment data and experiment pictures filled in by the user (e.g., the student). After filling in, the content in the web page rich text editor is saved in the cloud database. The web page format content contains a picture link address. The picture link address is the address corresponding to the experiment picture in the cloud object storage device.

[0142] The download operation input by the user on the teacher client for the web page format content can be an operation of clicking a download button.

[0143] After receiving the download operation, all picture link addresses contained in the web page format content are traversed, and the picture data is downloaded from the cloud object storage device according to the picture link address. Then, the picture link address contained in the web page format is replaced with the picture data.

[0144] Traversing the web page format content to find the picture link address can include: determining the picture address tag contained in the web page format content; obtaining the picture link address contained in the picture address tag. Then, the picture binary object is downloaded from the cloud object storage library of the cloud database according to the picture link address; the picture binary object is converted to obtain picture data. The conversion of the picture binary object can also include converting the picture binary object to obtain Base64 format picture data.

[0145] The picture link address contained in the web page format content is replaced with the Base64 format picture data, and the replaced web page format content is subjected to format conversion processing to obtain a first target electronic file, including:

[0146] The text data contained in the web page format content is processed in an intermediate web page format to obtain intermediate web page format text data;

[0147] The Base64 format picture data and the intermediate web page format text data are filled into the intermediate web page format template to obtain intermediate web page format content.

[0148] The Base64 format picture data and the intermediate web page format text data are filled into the intermediate web page format template to obtain intermediate web page format content, which can include:

[0149] The Base64 format picture data is filled into the picture address tag attribute of the intermediate web page format template to obtain picture content;

[0150] The intermediate webpage format text data is filled into the text label attribute of the intermediate webpage format template to obtain text content.

[0151] The intermediate webpage format content includes picture content and text content.

[0152] The embodiments provided in the present application replace picture data in webpage format content with picture link addresses, effectively saving data storage space, and also do not affect the display of pictures in a rich text editor.

[0153] Optionally, in order to reduce the processing cost of file conversion and improve the processing efficiency of file conversion, the present application further provides a file conversion method. In the following Figure 10 Further illustrate the file conversion method provided by the present application. Please refer to Figure 10 , Figure 10 The flowchart of the file processing method provided by the embodiments of the present application is shown. The method can be executed by the terminal device and the server device. For example, the client of online education is pre-installed on the terminal device, or the corresponding function is realized by logging in and accessing the webpage through the browser. The document conversion service component is pre-installed on the server, and the server also includes a cloud object storage device and a cloud database. For example, the server includes a cloud container engine and a cloud object storage library.

[0154] The first user realizes the submission process of the electronic experiment report by operating the first browser, such as steps 601-605. As shown in FIG. 11(a), the user displays the corresponding operation interface in the tab page of the browser to realize the editing of the experiment report. As shown in FIG. 11(b), the user displays the corresponding operation interface in the tab page of the browser to realize the submission interface of the experiment report.

[0155] Step 601, the first browser pre-installed on the first terminal device receives the online editing of the electronic experiment report input by the user. The first terminal device is a terminal device used by a student. The electronic experiment report is in webpage format. The student edits the electronic experiment report online through the browser pre-installed on the first terminal device.

[0156] Step 602, the first browser sends a submission request, which contains the online editing of the electronic experiment report by the user, and the electronic experiment report is in webpage format, such as HTML format. For example, the student can click the submission button on the browser pre-installed on the first terminal device, and the browser responds to the click operation of the user to submit the electronic experiment report to the intermediate layer.

[0157] Step 603, the intermediate layer receives the submission request and performs data filtering processing on the electronic experiment report contained in the submission request.

[0158] In this step, the filtering of the electronic experiment report can be achieved by pre-setting the filtering settings.

[0159] In step 604, the intermediate layer sends a submission request to the cloud server, and the submission request contains the electronic experiment report to be saved. The cloud server receives the submission request, parses the electronic experiment report, and stores it.

[0160] In step 605, the cloud server returns the submission result of the electronic experiment report to the intermediate layer, and the intermediate layer transmits the submission result to the first browser. The submission result can indicate that the storage of the electronic experiment report is successful, i.e., the submission is successful, otherwise it will prompt the submission failure.

[0161] The second user can view the electronic experiment report by operating the second browser, as shown in steps 606-609. The second user can be the same user as the first user, or the same user. The second user can also be a user different from the first user. As shown in FIG. 11(c), the first user or the second user can view the electronic experiment report submitted by the first user.

[0162] In step 606, the second browser receives the viewing operation of the electronic experiment report input by the second user. The second terminal device can be used by a teacher. The teacher sends a request for viewing the electronic experiment report to the intermediate layer through the browser pre-installed on the second terminal device.

[0163] In step 607, the second browser sends a viewing request to the intermediate layer, and the viewing request contains the content of the electronic experiment report corresponding to the viewing operation input by the user.

[0164] In step 608, the intermediate layer forwards the viewing request to the cloud database.

[0165] In step 609, the cloud database responds to the viewing request and returns the content of the electronic experiment report in the web format corresponding to the viewing request to the intermediate layer. The content in the web format is the content in the HTML format. The intermediate layer forwards the content in the web format to the browser.

[0166] The second user can also operate the second browser to download the electronic experiment report, as shown in steps 610-619.

[0167] In step 610, the second browser receives the first download operation input by the user for the content in the web format. As shown in FIG. 11(d), the second browser displays the content in the web format, i.e., the electronic experiment report, and the user can click “Save as DOC” as the first download operation.

[0168] Step 611, the second browser sends a first download request to the middleware, the first download request containing the web format content to be downloaded;

[0169] Step 612, the middleware traverses the picture link address URL contained in the extracted web format content.

[0170] Step 613, the middleware requests to download the picture binary object corresponding to the picture link address from the cloud object storage device according to the picture link address;

[0171] Step 614, the middleware receives the picture binary object corresponding to the picture link address returned by the cloud object storage device.

[0172] Step 615, the middleware replaces the picture link address with the picture binary object to obtain the replaced web format content.

[0173] Step 616, the middleware sends a second file conversion request to the file conversion cluster service component; the second file conversion request includes the replaced web format content and the electronic file format parameter.

[0174] Step 617, the file conversion cluster service component receives the second file conversion request, and determines a workload in the file cluster service component according to a load balancing strategy; the open source LibreOffice and the load balancing strategy are used in the file conversion cluster service component, which is the same as the foregoing method.

[0175] Step 618, the workload converts the web format content into a first target electronic file corresponding to the electronic file format parameter. The first target electronic file is shown in FIG. 11(e).

[0176] Step 619, the workload returns the conversion result to the middleware, and the middleware transmits the conversion result to the second browser.

[0177] In the process of downloading the electronic experiment report by the second user, the embodiments provided in the present application replace the picture data in the web format content with the picture link address, effectively save the data storage space, and speed up the page loading speed. Since the link address does not need complex logic and program processing, the burden of the server program can be well reduced.

[0178] And the open source LibreOffice and the load balancing strategy are used in the file conversion cluster service component, which improves the efficiency of file processing.

[0179] The following also describes the operation of the second user to download the PDF format of the electronic experiment report by operating the second browser, such as steps 620-621.

[0180] In step 620, the second browser may also receive a second download request for the webpage format content. The second download request is used to request downloading a PDF electronic file corresponding to the webpage format content. The second download operation can be performed by clicking "Save as PDF".

[0181] Step 621: In response to the second download request, the second browser obtains a Document Object Model (DOM) structure corresponding to the webpage format content.

[0182] Step 622: The second browser converts the web page format content into a Canvas image according to the document object model structure.

[0183] Step 623: The browser calls the JSPDF library to generate a PDF object corresponding to the Canvas image.

[0184] In step 624, the browser inserts the Canvas image into the PDF object corresponding to the Canvas image to generate a second target electronic file, as shown in FIG11(f).

[0185] The first target electronic file and the second target electronic file are in the Doc format or the Docx format. The second target electronic file is in the PDF format. Canvas, a component of HTML5, allows scripting languages ​​to dynamically render images. jsPDF is an HTML5-based client-side solution and a library for generating PDFs in client-side JavaScript.

[0186] This application also provides a variety of format conversion methods to meet the different conversion needs of users. By inserting the canvas image into the JDF object generated by calling the JSPDF library, the document processing efficiency is effectively improved.

[0187] It should be noted that although the operations of the disclosed method are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in that particular order, or that all of the operations shown must be performed to achieve the desired results. Rather, the steps depicted in the flowcharts may be performed in a different order. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into a single step, and / or a single step may be broken down into multiple steps.

[0188] Please refer to Figure 12 , Figure 12 The following is a schematic diagram showing the structure of a file processing device provided in an embodiment of the present application. The device includes:

[0189] The data extraction unit 701 is configured to extract picture data contained in the web page format content when receiving a save operation input for the web page format content in the rich text editor. The web page format content refers to content filled into the rich text editor.

[0190] The data uploading unit 702 is configured to upload the picture data to a cloud object storage device.

[0191] The address receiving unit 703 is configured to receive a picture link address corresponding to the picture data returned by the cloud object storage device.

[0192] The first replacing unit 704 is configured to replace the picture data with the picture link address to obtain target web page format content.

[0193] The file processing device provided by the embodiments of the present application can be used to execute the method described above. Figures 2-3 , 6.

[0194] Optionally, the device further comprises:

[0195] The file obtaining unit is configured to filter a plurality of original format electronic files according to a preconfigured file magic number and file parameters to obtain original format electronic files to be converted.

[0196] The first format conversion unit is configured to convert the electronic files to obtain intermediate web page format content.

[0197] The content filling unit is configured to fill the intermediate web page format content into the rich text editor to obtain web page format content.

[0198] Optionally, the format conversion unit is further configured to send a first file conversion request to a file conversion cluster service component, the first file conversion request comprising the electronic file and intermediate web page format parameters; the file conversion cluster service component is configured to receive the first file conversion request, determine a workload in the file cluster service component according to a load balancing strategy; the workload is configured to convert the electronic file into intermediate web page format content; and receive the intermediate web page format content returned by the file conversion cluster service component.

[0199] Optionally, the data uploading unit is further configured to:

[0200] convert the picture data into a picture binary object;

[0201] upload the picture binary object to the cloud object storage device.

[0202] The first replacing unit is further configured to:

[0203] determine a picture address tag in the web page format content;

[0204] Replace the picture data contained in the picture address label with the picture link address to obtain the target webpage format content.

[0205] Further, please refer to Figure 13 , Figure 13 A structure diagram of a file processing device provided by the embodiment of the application is shown. The device includes:

[0206] The address extraction unit 801 is configured to extract a picture link address contained in webpage format content when receiving a first download request for the webpage format content. The webpage format content refers to webpage content corresponding to the first download request stored in a cloud database.

[0207] The data download unit 802 is configured to request to download picture data from a cloud object storage device according to the picture link address;

[0208] The second replacement unit 803 is configured to replace the picture link address contained in the webpage format content with the picture data;

[0209] The second format conversion unit 804 is configured to perform format conversion processing on the replaced webpage format content to obtain a first target electronic file.

[0210] The file processing device provided by the embodiment of the application can be used to execute the method described above Figures 9-10 .

[0211] Optionally, the data download unit is further configured to:

[0212] send a download request to the cloud object storage device according to the picture link address;

[0213] receive a picture binary object returned by the cloud object storage device according to the picture link address;

[0214] convert the picture binary object to obtain the picture data.

[0215] The second format conversion unit is further configured to:

[0216] send a second file conversion request to a file conversion cluster service component, the second file conversion request including the webpage format content and an electronic file format parameter; the file conversion cluster service component is configured to receive the second file conversion request, determine a workload in the file cluster service component according to a load balancing strategy; the workload is configured to convert the webpage format content into the first target electronic file corresponding to the electronic file format parameter;

[0217] receive the first target electronic file returned by the file conversion cluster service component.

[0218] The device further includes:

[0219] The second download request receiving unit is configured to receive a second download request for the webpage format content, the second download request being configured to request to download a PDF electronic file corresponding to the webpage format content.

[0220] In response to the second download request, a file object model structure corresponding to the webpage format content is obtained.

[0221] The webpage format content is converted into a Canvas picture according to the file object model structure.

[0222] The JSPDF library is called to generate a PDF object corresponding to the Canvas picture.

[0223] The Canvas picture is inserted into the PDF object to generate a second target electronic file.

[0224] The application also provides a plurality of format conversion modes, which can meet different conversion requirements of users. The Canvas picture is inserted into the JDF object generated by calling the JSPDF library, thereby effectively improving the processing efficiency of the document.

[0225] It should be understood that the units or modules described in the above apparatus correspond to the respective steps in the method described with reference to the above description. Figures 2-3 Therefore, the operations and features described above with respect to the method are also applicable to the above apparatus and the units contained therein, and will not be described here. The above apparatus can be pre- implemented in the browser or other security applications of the electronic device, or can be loaded into the browser or security applications thereof of the electronic device by downloading or the like. The corresponding units in the above apparatus can cooperate with the units in the electronic device to realize the schemes of the embodiments of the application.

[0226] In the above detailed description, several modules or units are mentioned, and the division is not mandatory. According to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into a plurality of modules or units.

[0227] The following refers to Figure 14 which shows a structural schematic diagram of a computer system suitable for realizing the terminal device or server of the embodiments of the present application.

[0228] As Figure 14As shown, the computer system includes a central processing unit (CPU) 901 which can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 902 or loaded into a random access memory (RAM) 903 from a storage section 908. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0229] Connected to the I / O interface 905 are an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a display device such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as necessary. A removable recording medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 910 as necessary, so that a computer program read therefrom is installed into the storage section 908 as necessary.

[0230] In particular, according to embodiments of the present disclosure, the above reference to flowcharts Figure 2 The processes described can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product which includes a computer program carried on a machine-readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 909, and / or installed from the removable recording medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-described functions defined in the system of the present application are executed.

[0231] It should be noted that the computer-readable medium shown in the disclosure can be a computer-readable signal medium or a computer-readable storage medium or any combination thereof. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any combination thereof. More specific examples of the computer-readable storage medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the disclosure, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or apparatus. In the disclosure, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take many forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or apparatus. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination thereof.

[0232] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a part of code, which contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and the combination of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0233] The units or modules described in the embodiments of the present application can be implemented in the form of software or in the form of hardware. The described units or modules can also be arranged in a processor, for example, a processor can be described as including a data extraction unit, a data uploading unit, and an address receiving unit, a first replacing unit. Among them, the name of these units or modules does not constitute a limitation on the units or modules themselves in some cases, for example, the data extraction unit can also be described as "a unit for extracting picture data contained in the web page format content".

[0234] As another aspect, the present application also provides a computer readable storage medium, which can be included in the electronic device described in the above embodiments, or can exist separately without being assembled into the electronic device. The computer readable storage medium stores one or more programs, and when the programs are used by one or more processors to execute the file processing method described in the present application.

[0235] The above description is merely preferred embodiments of the present application and a description of the principles of the technology used. Those skilled in the art should understand that the disclosed range in the present application is not limited to the technical solutions formed by the specific combinations of the above technical features, and also covers other technical solutions formed by any combination of the above technical features or equivalent features without departing from the disclosed concept. For example, the above features are replaced with the technical features disclosed in the present application (but not limited to) having similar functions to form technical solutions.

Claims

1. A file processing method, characterized in that: The method includes: The browser receives an operation input by a user to load a target document, the target document being an electronic file in an original format to be processed, performs format conversion on the electronic file to obtain intermediate webpage format content, encodes an image in the target document according to a Base64 encoding format to obtain image data; fills the intermediate webpage format content into a rich text editor to obtain webpage format content, edits the content in the rich text editor, and upon receiving an input save operation for the edited webpage format content, extracts the image data contained in the edited webpage format content, converts the image in base64 format to obtain an image binary object; Uploading the image binary object to a cloud object storage device; Receiving a picture link address corresponding to the picture binary object returned by the cloud object storage device; The image data is replaced with the image link address to obtain the target web page format content.

2. The method according to claim 1, characterized in that Before receiving a save operation input for webpage format content, the method includes: According to the pre-configured file magic number and file parameters, multiple electronic files in original formats are filtered to obtain electronic files in original formats to be converted.

3. The method according to claim 2, characterized in that The format conversion of the electronic file includes: Sending a first file conversion request to a file conversion cluster service component, the first file conversion request including the electronic file and intermediate webpage format parameters; the file conversion cluster service component is configured to receive the first file conversion request and determine a workload in the file conversion cluster service component according to a load balancing policy; the workload is configured to convert the electronic file into intermediate webpage format content; Receive the intermediate webpage format content returned by the file conversion cluster service component.

4. The method according to claim 1, wherein The replacing the picture data with the picture link address includes: Determining an image address tag in the webpage format content; The image data contained in the image address tag is replaced with the image link address to obtain the target web page format content.

5. A file processing method, characterized in that: The method includes: Upon receiving a first download request for webpage format content, extracting an image link address contained in the webpage format content, wherein the webpage format content refers to webpage content corresponding to the first download request and stored in a cloud database, the webpage format content including data and images filled in with a rich text editor content in a webpage displayed on the second terminal, the webpage format content in the webpage displayed on the second terminal including target webpage format content obtained by the first terminal using the method according to any one of claims 1 to 4; Requesting to download the image data from the cloud object storage device according to the image link address; Replacing the image link address with the image data; The replaced webpage format content is subjected to format conversion processing to obtain a first target electronic file.

6. A file processing device, characterized in that: The device includes: A data extraction unit is configured to receive, via a browser, an operation for loading a target document input by a user, the target document being an electronic file in an original format to be processed; perform format conversion on the electronic file to obtain intermediate webpage format content; encode an image in the target document according to a Base64 encoding format to obtain image data; fill the intermediate webpage format content into a rich text editor to obtain webpage format content; edit the content in the rich text editor; and upon receiving a save operation input for the edited webpage format content, extract the image data contained in the edited webpage format content; convert the image in Base64 format to obtain an image binary object; a data uploading unit, configured to upload the image binary object to a cloud object storage device; An address receiving unit, configured to receive a picture link address corresponding to the picture binary object returned by the cloud object storage device; The first replacing unit is used to replace the image data with the image link address to obtain the target web page format content.

7. A file processing device, characterized in that: The device includes: an address extraction unit configured to extract, upon receiving a first download request for webpage format content, an image link address contained in the webpage format content, wherein the webpage format content refers to webpage content corresponding to the first download request and stored in a cloud database, the webpage format content including data and images entered in a rich text editor in a webpage displayed on the second terminal, the webpage format content in the webpage displayed on the second terminal including target webpage format content obtained by the apparatus according to claim 6 through the first terminal; a data downloading unit, configured to download the image data from the cloud object storage device according to the image link address; A second replacing unit, configured to replace the image link address included in the webpage format content with the image data; The second format conversion unit is configured to perform format conversion processing on the replaced webpage format content to obtain a first target electronic file.

8. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the method according to any one of claims 1 to 5 when executed by a processor.

Citation Information

Patent Citations

  • Rich text editing method for importing documents and device thereof

    CN102662928A

  • Rich text picture insertion method and device

    CN110737860A

  • Online data generation method and device, electronic equipment and storage medium

    CN111159099A