CN115878572A - Intelligent previewing method, device and equipment for multi-format electronic archive - Google Patents

Intelligent previewing method, device and equipment for multi-format electronic archive Download PDF

Info

Publication number
CN115878572A
CN115878572A CN202211513407.5A CN202211513407A CN115878572A CN 115878572 A CN115878572 A CN 115878572A CN 202211513407 A CN202211513407 A CN 202211513407A CN 115878572 A CN115878572 A CN 115878572A
Authority
CN
China
Prior art keywords
file
format
previewing
picture
preview
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
CN202211513407.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.)
Xiamen Hordor Architecture & Engineering Design Group Co ltd
Original Assignee
Xiamen Hordor Architecture & Engineering Design Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Hordor Architecture & Engineering Design Group Co ltd filed Critical Xiamen Hordor Architecture & Engineering Design Group Co ltd
Priority to CN202211513407.5A priority Critical patent/CN115878572A/en
Publication of CN115878572A publication Critical patent/CN115878572A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses a method, a device and equipment for intelligently previewing a multi-format electronic file. Wherein the method comprises the following steps: acquiring a file URL and an authority control parameter; optimizing Nginx load balancing optimization and distributing Nginx reverse proxies based on file URLs and authority control parameters; format conversion is carried out on the electronic file based on the Nginx reverse proxy; previewing and inserting a watermark based on the format conversion result. According to the method and the device, the homonym file which reserves the original content of the file of each file in the file system is generated in advance, and then the corresponding homonym file is obtained when the user needs to preview and check the file in the file system, so that the file format of the file to be previewed does not need to be recognized directly by the client side, the format is converted uniformly, and the consumption of format conversion time caused by the fact that the file format cannot be recognized directly after a preview instruction is received is avoided.

Description

Intelligent previewing method, device and equipment for multi-format electronic archive
Technical Field
The invention relates to the technical field of Nginx reverse proxy, in particular to a method, a device and equipment for intelligently previewing a multi-format electronic file.
Background
For most of the existing file systems, if a user wants to preview the content of a file in the system, the user generally needs to open the file through various software on the client, and the client performs display rendering processing on the file according to different file types, so that the user can view the content of the file on the front-end page of the client. Based on the file preview mode, when different types of files which a user wants to view currently need to call various software on a client, the time consumption is long in both file downloading and page rendering, the experience feeling of online preview is affected, and the experience expectation when the user previews the files is obviously not met.
According to different file types, the traditional method of opening and rendering through various software on a client side has the disadvantages of large occupied resources, long time consumption, complex environment and influence on the experience of online preview. Therefore, intelligent preview and watermark anti-counterfeiting of multi-format electronic files applicable to complex environments become an urgent issue to be solved in the industry at present. The system can call in advance to perform transcoding and file format conversion when the file is uploaded, and cache the transcoded or format converted file, and follow-up personnel call the same format to call the cached file to preview without transcoding and format conversion. Thereby greatly improving the speed of format conversion.
The IT technology utilized by the system is mature, particularly, the data transmission technology, the Web, big data, cloud service and other technologies are greatly improved compared with the prior art, and the performance of the hardware such as network equipment, a server and the like is also rapidly improved. These all provide powerful guarantee for multi-format electronic file intelligent preview and watermark anti-counterfeiting.
Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, and a device for intelligently previewing a multi-format electronic file, so as to solve the problem in the prior art that it is difficult to directly preview different file types and prevent counterfeit by watermarking.
According to one aspect of the invention, a multi-format electronic archive intelligent preview method is provided, which comprises the following steps: the method comprises the following steps: acquiring a file URL and an authority control parameter; optimizing Nginx load balancing optimization and distributing Nginx reverse proxies based on the file URL and the authority control parameters; format conversion is carried out on the electronic file based on the Nginx reverse proxy; previewing and inserting a watermark based on the format conversion result.
According to another aspect of the present invention, there is provided a multi-format electronic archive intelligent preview apparatus, including: the device comprises an acquisition module, a configuration module, a conversion module and a preview module; the acquisition module is used for acquiring the file URL and the authority control parameter; the configuration module is used for matching Nginx reverse proxy based on the file URL and the authority control parameters; the conversion module is used for carrying out format conversion on the electronic file based on the Nginx reverse proxy; and the prediction module is used for previewing and inserting the watermark based on the format conversion result.
According to still another aspect of the present invention, there is provided a multi-format electronic archive intelligent preview device, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method for intelligent previewing of a multi-format electronic archive according to any one of the preceding claims.
According to still another aspect of the present invention, there is provided a computer-readable storage medium storing a computer program, wherein the computer program is executed by a processor to implement the intelligent multi-format electronic archive previewing method according to any one of the above items.
According to the scheme, the same-name files of all the files in the file system, which retain the original file contents, are generated in advance, and then the corresponding same-name files are obtained when the user needs to preview and view the files in the file system, so that the file format of the file to be previewed does not need to be directly identified by the client, the format is uniformly converted, and the consumption of format conversion time caused by the fact that the file format cannot be directly identified after a preview instruction is received is avoided. The method and the device can realize the on-line browsing of the common type files without installing a plug-in at the front end, reduce the requirements on the environment of the client, reduce the configuration of the client by a user and facilitate the user to directly use the browser to browse the files on line. The method has high efficiency, has less pressure on the server, and can achieve the preview effect by carrying out one-time file conversion on the uploaded files. The probability of data distortion is less, and the data validity is higher because one conversion is less. The file does not need to be downloaded to the local, and the safety of the file is improved. And automatically adding anti-counterfeiting watermarks to the files with different formats in the conversion process. By supporting the preview of files in various formats, the completeness of the scheme is enhanced, and the user experience is further improved. Further, in order to better realize load balancing of a distributed server cluster under various high concurrency conditions in format conversion, a format conversion server load balancing algorithm based on a goblet ascidian algorithm is provided based on node load performance indexes integrating the performances of three servers including throughput, memory and a disk and combining the advantages of the goblet ascidian algorithm. Load balancing for high concurrency conditions under format conversion conditions can be achieved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flowchart illustrating an embodiment of a method for intelligently previewing a multi-format electronic file according to the present invention;
fig. 2 is a schematic diagram of a process of performing format conversion on an electronic file based on the Nginx reverse proxy in S103 according to an embodiment of the method for intelligently previewing a multi-format electronic file of the present invention;
FIG. 3 is a schematic interface diagram of an embodiment of an intelligent preview apparatus for multi-format electronic files according to the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be noted that the following examples are only illustrative of the present invention, and do not limit the scope of the present invention. Similarly, the following examples are only some but not all examples of the present invention, and all other examples obtained by those skilled in the art without any inventive work are within the scope of the present invention.
The invention provides an intelligent previewing method for a multi-format electronic file, which solves the defects that different file types are difficult to be previewed directly and watermark is difficult to prevent counterfeiting in the prior art.
Referring to fig. 1, fig. 1 is a schematic flow chart diagram illustrating an embodiment of an intelligent multi-format electronic file previewing method according to the present invention. It should be noted that the method of the present invention is not limited to the flow sequence shown in fig. 1 if the results are substantially the same. As shown in fig. 1, the method comprises the steps of:
s101: and acquiring a file URL and an authority control parameter.
In this embodiment, by adding a request to the configuration file, nginx. Conf, in Nginx to match the location configuration, a URL match definition is first configured, such as —. Then configuring a reverse proxy to a real processing back end proxy _ pass: http:// static _ pools. The preview requests can be classified and proxied to different types of preview services at the back end. And (3) configuring a complete code: location: (gif | jpg) $ { proxy _ pass http:// static _ spots; }.
In this embodiment, the file URL is used to acquire and download a corresponding file, and convert the file into a PDF or a picture before previewing; the permission control parameter is used to control whether a preview of the document can be downloaded or printed.
S102: optimizing Nginx load balancing optimization and distributing Nginx reverse proxies based on file URLs and permission control parameters.
In the embodiment, N server clusters in the cluster are initialized randomly through Nginx, fitness values of the N server clusters and fitness values of target positions are calculated, whether the server clusters exceed the fitness values of the target positions is judged according to the obtained file URL and authority control parameters and the types of access equipment, if the server clusters do not exceed the fitness values, the server clusters of the target positions are matched with different Nginx reverse proxies through the file URL and the authority control parameters, and different resources are analyzed to corresponding node servers through the different Nginx reverse proxies; and if the current resource is beyond the preset value, iteratively calculating the fitness values of the N server clusters based on the position update of the leader and the follower, comparing the fitness values with the fitness value of the target position, updating the optimal scheme by using the position of the minimum fitness value, obtaining the optimal server cluster by continuously iteratively updating until the circulation is stopped, outputting the optimal server cluster, matching different Nginx reverse agents by adopting the optimal server cluster through a file URL and authority control parameters, and analyzing different resources to corresponding node servers through different Nginx reverse agents.
The Nginx is a high-performance Web server, is commonly used for proxy service, load balancing and Web cache, and the implementation of load balancing is a key application of reverse proxy service of the Nginx server. The format conversion preview method provided by the scheme is established on the basis of the Nginx server, but in fact, a larger problem encountered in the use process of the method is a load balancing problem. In the using process, the access amount is increased, the memory occupation of different files is huge, and huge load pressure is brought to a back-end server, especially in the group application process, the number of people is large, high concurrent access requirements are brought, and single server equipment is hard to bear. The current common method deals with the huge access demand by building a server cluster to improve the system performance. A server cluster refers to a collection of servers that together perform the same service, and appears to a client as if there is only one server. The cluster can use a plurality of computers to perform parallel computation so as to obtain high computation speed, and can also use a plurality of computers to perform backup so as to ensure that any one machine damages the whole system or can normally run. Therefore, the concurrent processing capacity of the system and the error redundancy capacity of the system with the single machine failed can be increased, the condition that the cluster system cannot normally provide services when the single server runs abnormally is effectively avoided, and the high reliability of the system and the high availability of resources are realized. In a cluster system, how to reasonably configure system resources and balance loads in the cluster system are the most critical issues. The load balancing technology is used as a key technology of a server cluster, and generally a load balancing distribution strategy is adopted to distribute loads to a back-end server in a balanced manner, and the back-end server processes heavy load requests in parallel, so that the processing efficiency of a cluster system is improved.
In the field of load balancing technology of a Nginx server cluster, many traditional static scheduling algorithms have appeared, such as a polling and weighted polling algorithm, a minimum connection number algorithm, an IP _ Hash algorithm and the like which are already supported by the Nginx, and these algorithms can play a certain role in a simple working scene, but have highlighted various problems in an increasingly complex modern network environment. Therefore, on the basis of the static algorithm, a dynamic load balancing algorithm for performing load balancing scheduling by changing a load distribution strategy in real time according to actual load information fed back by the server appears, and the requirement of performing algorithm adjustment in real time according to the load condition is met to a certain extent, but the following problems exist: such as low load balancing efficiency under low load conditions, occupation of network resources and suboptimal overall allocation due to local peaks, etc. Based on this, a solution is provided for the problems of format conversion requirement and high concurrency requirement, and the server distribution problem is solved by introducing the ascidian algorithm while the problems of the dynamic and static algorithms are solved.
The goblet sea squirt algorithm simulates the living habits of the gathered chain of sea squirts and provides an optimization algorithm. The algorithm divides the group into a leader and a follower, the leader searches by taking global optimum as a center, global search capability is provided for the algorithm, the convergence of the group is ensured, the follower follows the previous individual, local search capability is provided for the algorithm, and the accuracy of the algorithm is ensured. The model of the goblet sea selling algorithm is very simple, the implementation process is simple and clear, and meanwhile, the algorithm has good effect and is not easy to fall into a local optimal state.
Specifically, first, the scheme of the goblet maritime marketing algorithm is explained
(1) And initializing the population, wherein the number of the population is represented as N, the spatial dimension is represented as D, and the target space is represented as N multiplied by D. The position of goblet sea squirt is represented as X i So the position of each bottle sea squirt can be expressed as Xi = [ X = [) i1 ,X i2 ,X i3 ,…,X iD ]I =1,2,3, …, N; wherein the virtual mobile food source, i.e., the target of goblet sea squirt, is defined as F = [ F1, F2, F3, …, FD](ii) a The upper and lower bounds of each dimension search range are Ub = [ Ub1, ub2, ub3, …, ubD]And Lb = [ Lb1, lb2, lb3, …, lbD]。
The initial population position is represented by the following formula
X N×D =rand(N,D)×(Ub-Lb)+Lb
(2) Location update of leader
The leader updates as follows
Figure BDA0003970733680000081
Wherein d represents the dimension in which the image is located,
Figure BDA0003970733680000082
values representing each dimension leader, based on the values in the database, and based on the values in the database>
Figure BDA0003970733680000083
A value representing a follower, N =2,3,4, …, N; f d Is the value of the target position in d dimension; c1 C2, c3 denote control parameters, c1 denotes a convergence factor; l denotes the number of iterations, l max When the maximum number of iterations is expressed, the convergence rate is expressed as follows
Figure BDA0003970733680000084
Wherein c is 2 ,c 3 Is in [0,1]The random number generated in the step (b) determines the direction and step size of the leader position update.
(3) Tracker location update. In the iterative process, the coordinate value of the nth goblet sea squirt in the dimension d is represented as
Figure BDA0003970733680000085
The iteration time is represented by l, the acceleration is represented by a, the initial velocity is represented by v0, and the position of the follower according to Newton's law of motion is defined as follows
Figure BDA0003970733680000086
The position of the former sea squirt affects the update of the position of the follower, i.e. the speed
Figure BDA0003970733680000087
Figure BDA0003970733680000088
Further, the formula can be represented as the following formula
Figure BDA0003970733680000089
Next, an explanation will be given for the problem of the format conversion requirement and the high concurrency requirement.
S1, randomly initializing N server clusters in the cluster through Nginx.
And S2, calculating the fitness values of the N server clusters and the fitness value of the target position.
And S3, iteratively calculating the fitness values of the N server clusters based on the position updating of the leader and the follower, comparing the fitness values with the fitness value of the target position, and updating the optimal scheme by using the position with the minimum fitness value.
And S4, obtaining and outputting the optimal server cluster through continuous iteration updating until the circulation is stopped.
The model is designed according to the goblet sea squirt algorithm. According to the method, the throughput, the memory and the disk of each server are used as comprehensive performance evaluation indexes according to format conversion requirements and high concurrency requirements in combination with literature conclusions and experimental feedback. The general server indexes are usually CPU (C), memory (M), disk I/O (I) and network bandwidth (N) as comprehensive performance evaluation indexes. But in fact, the preview format converted by the method is a file readable by a PDF (portable document format) or JPG (Java native page) or H5 player, and the requirements on CPU (central processing unit) and network bandwidth are not high.
Assume that there are a total of N server clusters N = { i = { i } 1 、i 2 、i 3 …i N N task indices a = { a = } 1 、a 2 、a 3 …a n B, each index needs to complete three tasks of calling components, setting authority and format preview in turn A ={b Calling component 、b Setting permissions 、b Format preview },C A Number of tasks is =3N, assuming N ≠ m, and the assignment aims at making N server clusters complete C with minimum cost A And (4) each task.
Suppose u =1,2,3, …, N; v =1,2,3, …, n; w =1,2,3, …, C A . Decision variables
Figure BDA0003970733680000091
Expressed as:
Figure BDA0003970733680000092
probability that server cluster u can continue to complete next index after executing task w of index v
Figure BDA0003970733680000093
Is shown as
Figure BDA0003970733680000094
Wherein f is uv Relative distance F between server cluster u and index v for dominance probability uv Is shown as
Figure BDA0003970733680000095
Relative velocity V of server cluster u and index V uv Is shown as
V uv =|V u cosθ u + v cosθ v |
And (4) restricting the number of tasks: the number of tasks constraint ensures that each task of each index is executed, which can be expressed as
Figure BDA0003970733680000101
And task timing constraint: task timing constraints ensure that target v executes in the order of calling components, setting permissions, format preview, which can be expressed as
Figure BDA0003970733680000102
Target function formula construction execution cost function I 1 And a time cost function I 2 The execution cost is the occupation amount of the server cluster to the throughput, the memory and the disk when the index is completed, and the time cost is the time required by the complete index.
Figure BDA0003970733680000103
Figure BDA0003970733680000104
The overall objective function can be expressed as
minI=I 1 + 2
Subject to
Figure BDA0003970733680000105
Constraint satisfaction formula of overall objective function
Figure BDA0003970733680000111
Figure BDA0003970733680000112
Figure BDA0003970733680000113
Figure BDA0003970733680000114
Figure BDA0003970733680000115
The target function represents the minimum execution cost and time cost and the constraint condition
Figure BDA0003970733680000116
Ensuring that a task is completed by only one cluster of servers.
After the model is built, N server clusters in the cluster are initialized randomly through Nginx, fitness values of the N server clusters and fitness values of target positions are calculated, the fitness values of the N server clusters are calculated based on position updating iteration of a leader and a follower, the fitness values of the N server clusters are compared with the fitness values of the target positions, an optimal scheme is updated by the position of the minimum fitness value, the optimal server cluster is obtained and output when circulation is stopped through continuous iteration updating, different Nginx reverse agents are matched by adopting the optimal server cluster through file URLs and authority control parameters, and different resources are analyzed to corresponding node servers through the different Nginx reverse agents.
It should be further noted that parameters such as fitness value and location update of the goblet sea squirt can be set according to actual requirements, and this embodiment is not specifically described.
In this embodiment, when the server cluster does not exceed the moderate value of the target location, in order to implement dynamic and static separation of resources, a dynamic resource server, a static resource server, an upload resource server, a default server, and the like may be deployed, so that when a front-end user accesses a server, different Nginx reverse proxies may be matched according to a URL address transmitted by the user, thereby allowing different resources to be resolved to corresponding node servers. The specific method comprises the following steps:
example (c): e.g., access the domain name www.hordor.com, then:
when a user accesses www.hordor.com, a default server is requested by the Nginx reverse proxy. When a user accesses WWW.HORDOR.COM/UPLOAD/XXX, an Nginx reverse proxy requests an uploading resource server; when a user accesses WWW.HORDOR.COM/MOVE/XXX, a dynamic resource server is requested by a Nginx reverse proxy; user access
At www.hordor.com/STATIC/XXX, the Nginx reverse proxy requests a STATIC resource server;
in this embodiment, nginx implements the forwarding request according to the USER _ AGENT device type. Different proxy forwarding is realized according to a URL (uniform resource locator), nginx can also realize different request forwarding according to the type of user equipment, in order to enable different client users to have better experience, different servers need to be erected on a back-end server, for example, a mobile-end client accesses a mobile website server, a PC client accesses a PC server, the problem is solved in conventional four-layer load balancing, different domain names are manually distributed to clients, for example, a mobile end accesses WAP
And $ HTTP _ USER _ AGENT to forward the request to the corresponding server.
S103: and converting the format of the electronic file based on the Nginx reverse proxy.
In the present embodiment, it is preferred that,
i. if the PDF file is the PDF file, setting printing and downloading permissions through a PDFJS service component, and directly rendering and previewing in a browser;
if the CAD file, calling ASPOSE CAD component to convert DWG file into PDF
The PDFJS service component is used for setting printing and downloading permissions and directly rendering preview in the browser; if the OFFICE file exists, calling LIBREOFFICE to convert the document into a picture, calling a picture preview component to set a printing download parameter, and previewing in a browser;
if the OFD national standard document format is adopted, an OFD READER and WRITER component is called to convert the document into a picture, a picture preview component is called to set printing and downloading parameters, and the picture is previewed on a browser; v, if the picture format file is available, calling a picture preview component to set a printing downloading parameter and previewing on a browser;
and vi, if the video type file exists, calling the FFMPEG video file group video transcoding and calling a browser H5 player.
In particular, the method comprises the following steps of,
1, if the PDF file is in a PDF JS service component, setting printing and downloading permissions, and directly rendering preview in a browser. The printing parameters are passed when the file calls the preview interface at the same time:
print =1, and whether printing is permitted is automatically controlled by the preview component itself.
And 2, if the CAD file is the CAD file, calling an ASPOSE CAD component to convert the DWG file into PDF, setting printing and downloading permissions through a PDFJS service component, and directly rendering preview in the browser. The printing parameters are passed when the file calls the preview interface at the same time: print =1, and whether printing is permitted is automatically controlled by the preview component itself.
And 3, if the OFFICE file (DOC, DOCX and the like) is available, calling LIBREOFFICE to convert the document into a picture, calling a picture preview component to set a printing download parameter, and previewing on a browser. The print parameters are passed through when the document calls the preview interface at the same time: print =1, and whether printing is permitted is automatically controlled by the preview component itself.
And 4, if the OFD national standard document format is adopted, calling an OFD READER and WRITER component to convert the document into a picture, calling a picture preview component to set printing and downloading parameters, and previewing in a browser. The print parameters are passed through when the document calls the preview interface at the same time: print =1, and whether printing is permitted is automatically controlled by the preview component itself.
And 5, if the picture format file is in the picture format, calling a picture preview component to set a printing downloading parameter, and previewing in a browser. The printing parameters are passed when the file calls the preview interface at the same time: print =1, and whether printing is permitted is automatically controlled by the preview component itself.
6, if the video type file exists, the FFMPEG video file group video transcoding is called, and a browser H5 player is called. Other video formats are converted to H256 MP4 format files by FFMPEG for playback in a browser with a new tag video in HTML 5. H265 can reduce the video file size substantially.
The above implementation method can be referred to fig. 2.
S104: previewing and inserting a watermark based on the format conversion result.
In the present embodiment, the method includes:
i. the electronic file can be converted into PDF, and when PDF is generated, bottom layer watermarks are inserted by using spot.
ii, converting the electronic file into an electronic file of a picture, and adding a watermark through a CSS mask layer when the picture is generated;
an electronic archive convertible into a video file is watermarked when transcoded by FFMPEG video.
In particular, the method comprises the following steps of,
watermark provides watermark control by requesting URL: ) & watermark txt = (watermark). The method comprises the following specific steps:
for PDF convertible, the expose may insert the underlying watermark by using the space.
For conversion to pictures, the watermark may be added by a CSS mask layer 3.
And 4, adding a watermark when the video file is transcoded through FFMPEG video.
It can be found that, in this embodiment, by generating the homonym file of each file in the file system in advance, which retains the original content of the file, and then acquiring the corresponding homonym file when the user needs to preview and view the file in the file system, the client does not need to consider whether the file format of the file to be previewed can be directly identified, but the file format is uniformly converted, so that the consumption of format conversion time caused by the fact that the file format cannot be directly identified after the preview instruction is received is avoided. The method and the device can realize the on-line browsing of the common type files without installing a plug-in at the front end, reduce the requirements on the environment of the client, reduce the configuration of the client by a user and facilitate the user to directly use the browser to browse the files on line. The method has high efficiency, has less pressure on the server, and can achieve the preview effect by carrying out one-time file conversion on the uploaded files. The probability of data distortion is less, and the data validity is higher because one conversion is less. The file does not need to be downloaded to the local, and the safety of the file is improved. And automatically adding anti-counterfeiting watermarks to the files with different formats in the conversion process. By supporting the preview of files in various formats, the completeness of the scheme is enhanced, and the user experience is further improved. Further, in order to better realize load balancing of a distributed server cluster under various high concurrency conditions under format conversion, a format conversion server load balancing algorithm based on the goblet sea squirt algorithm is provided based on node load performance indexes integrating throughput, memory and disk performance and combining the advantages of the goblet sea squirt algorithm. Load balancing for high concurrency conditions under format conversion conditions can be achieved.
Referring to fig. 3, fig. 3 is a schematic interface diagram of an intelligent preview device for multi-format electronic files according to the present invention. The invention also provides an intelligent previewing device for the multi-format electronic file, which solves the defects that different file types are difficult to be previewed directly and the watermarks are difficult to prevent counterfeiting in the prior art. In this embodiment, the intelligent previewing device for the multi-format electronic file comprises an acquisition module, a configuration module, a conversion module and a previewing module;
the acquisition module is used for acquiring the file URL and the authority control parameter;
the configuration module is used for matching Nginx reverse proxy based on the file URL and the authority control parameters;
the conversion module is used for carrying out format conversion on the electronic file based on the Nginx reverse proxy;
and the prediction module is used for previewing and inserting the watermark based on the format conversion result.
Optionally, the configuration module may be specifically configured to:
initializing N server clusters in the cluster at random through Nginx, calculating the fitness value of the N server clusters and the fitness value of a target position, judging whether the server clusters exceed the fitness value of the target position according to the acquired file URL and authority control parameters and the type of access equipment, if not, matching different Nginx reverse proxies with the server clusters of the target position through the file URL and the authority control parameters, and analyzing different resources to corresponding node servers through the different Nginx reverse proxies; and if the current node server is beyond the preset range, iteratively calculating the fitness values of the N server clusters based on the position updating of the leader and the follower, comparing the fitness values with the fitness value of the target position, updating the optimal scheme by using the position of the minimum fitness value, obtaining the optimal server cluster by continuously iteratively updating until the circulation is stopped, outputting the optimal server cluster, matching different Nginx reverse proxies by using the optimal server cluster through the file URL and the authority control parameter, and analyzing different resources to the corresponding node servers through the different Nginx reverse proxies.
Optionally, the conversion module may be specifically configured to:
i. if the PDF file is in the PDF file, setting printing and downloading permissions through a PDFJS service component, and directly rendering preview in a browser;
if the CAD file, calling ASPOSE CAD component to convert DWG file into PDF
The PDFJS service component is used for setting printing and downloading permissions and directly rendering preview in the browser; if the OFFICE file exists, calling LIBREOFFICE to convert the document into a picture, calling a picture preview component to set a printing download parameter, and previewing in a browser;
if the OFD national standard document format is adopted, an OFD READER and WRITER component is called to convert the document into a picture, a picture preview component is called to set printing and downloading parameters, and the picture is previewed on a browser; if the picture format file exists, calling a picture preview component to set a printing downloading parameter and previewing the picture in a browser;
and vi, if the video type file exists, calling the FFMPEG video file group video transcoding and calling a browser H5 player.
Optionally, the conversion module may be specifically configured to:
an electronic file which can be converted into PDF, and the bottom watermark is inserted by using spot.
v. electronic file capable of being converted into picture, adding watermark through CSS mask layer when generating picture;
and vi, adding a watermark when the electronic archive which can be converted into the video file is transcoded by the FFMPEG video.
Each unit module of the multi-format electronic file intelligent preview device can respectively execute the corresponding steps in the method embodiment, so that the description of each unit module is not repeated here, and please refer to the description of the corresponding steps in detail.
The invention also provides a multi-format electronic file intelligent preview device, which comprises: at least one processor; and a memory communicatively coupled to the at least one processor; the storage stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the multi-format electronic file intelligent preview method.
Where the memory and processor are connected by a bus, the bus may comprise any number of interconnected buses and bridges, the buses connecting together one or more of the various circuits of the processor and the memory. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor is transmitted over a wireless medium via an antenna, which further receives the data and transmits the data to the processor.
The processor is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And the memory may be used to store data used by the processor in performing operations.
The present invention further provides a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
According to the scheme, the same-name files of the original content of the reserved files of the files in the file system are generated in advance, and then the corresponding same-name files are obtained when the user needs to preview and view the files in the file system, so that the file format of the file to be previewed does not need to be directly identified by the client, the format is uniformly converted, and the consumption of format conversion time caused by the fact that the file format cannot be directly identified after the preview instruction is received is avoided. The invention can realize the on-line browsing of common files without installing a plug-in at the front end, thereby reducing the requirements on the environment of the client, reducing the configuration of the client by a user and facilitating the user to directly use the browser to browse the files on line. The method has high efficiency, has less pressure on the server, and can achieve the preview effect by carrying out one-time file conversion on the uploaded files. The probability of data distortion is less, and the data validity is higher because one conversion is less. The file does not need to be downloaded to the local, and the safety of the file is improved. And automatically adding anti-counterfeiting watermarks to the files with different formats in the conversion process. By supporting the preview of files in various formats, the completeness of the scheme is enhanced, and the user experience is further improved. Further, in order to better realize load balancing of a distributed server cluster under various high concurrency conditions in format conversion, a format conversion server load balancing algorithm based on a goblet ascidian algorithm is provided based on node load performance indexes integrating the performances of three servers including throughput, memory and a disk and combining the advantages of the goblet ascidian algorithm. Load balancing for high concurrency conditions under format conversion conditions can be achieved.
In the several embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a module or a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each of the units may exist alone physically, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be substantially or partially implemented in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, a network device, or the like) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only a part of the embodiments of the present invention, and not intended to limit the scope of the present invention, and all equivalent devices or equivalent processes performed by the present invention through the contents of the specification and the drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An intelligent previewing method for a multi-format electronic archive is characterized by comprising the following steps:
acquiring a file URL and an authority control parameter;
optimizing Nginx load balancing optimization and distributing Nginx reverse proxies based on file URLs and authority control parameters;
performing format conversion on the electronic file based on the Nginx reverse proxy;
previewing and inserting a watermark based on the format conversion result.
2. The method for intelligent previewing of multi-format electronic archive of claim 1 wherein said optimizing a Nginx load balancing optimization and assigning a Nginx reverse proxy based on a file URL and an entitlement control parameter comprises:
initializing N server clusters in the cluster at random through Nginx, calculating the fitness value of the N server clusters and the fitness value of a target position, judging whether the server clusters exceed the fitness value of the target position according to the acquired file URL and authority control parameters and the type of access equipment, if not, matching different Nginx reverse proxies with the server clusters of the target position through the file URL and the authority control parameters, and analyzing different resources to corresponding node servers through the different Nginx reverse proxies; and if the current resource is beyond the preset value, iteratively calculating the fitness values of the N server clusters based on the position update of the leader and the follower, comparing the fitness values with the fitness value of the target position, updating the optimal scheme by using the position of the minimum fitness value, obtaining the optimal server cluster by continuously iteratively updating until the circulation is stopped, outputting the optimal server cluster, matching different Nginx reverse agents by adopting the optimal server cluster through a file URL and authority control parameters, and analyzing different resources to corresponding node servers through different Nginx reverse agents.
3. The method for intelligently previewing the multi-format electronic file according to claim 1, wherein said converting the format of the electronic file based on the Nginx reverse proxy comprises:
i. if the PDF file is in the PDF file, setting printing and downloading permissions through a PDFJS service component, and directly rendering preview in a browser;
if the CAD file is the document, calling an ASPOSE CAD component to convert the DWG document into PDF, setting printing and downloading permissions through a PDFJS service component, and directly rendering preview in a browser;
if the OFFICE file exists, calling LIBREOFFICE to convert the document into a picture, calling a picture preview component to set a printing download parameter, and previewing in a browser;
if the OFD national standard document format is adopted, an OFD READER and WRITER component is called to convert the document into a picture, a picture preview component is called to set printing downloading parameters, and the picture is previewed on a browser;
if the picture format file exists, calling a picture preview component to set a printing downloading parameter and previewing the picture in a browser;
and vi, if the video type file exists, calling the FFMPEG video file group video transcoding and calling a browser H5 player.
4. The intelligent multi-format electronic archive previewing method according to claim 1, wherein previewing and inserting the watermark based on the format conversion result comprises:
i. electronic file convertible into PDF, and PDF generated by using the file
Inserting a bottom watermark into spot, pdf, background and artifact;
ii, converting the electronic file into an electronic file of a picture, and adding a watermark through a CSS (cascading Style sheets) mask layer when the picture is generated;
an electronic archive convertible into a video file is watermarked when transcoded by FFMPEG video.
5. An intelligent previewing device for multi-format electronic files is characterized by comprising:
the device comprises an acquisition module, a configuration module, a conversion module and a preview module;
the acquisition module is used for acquiring the file URL and the authority control parameter;
the configuration module is used for matching Nginx reverse proxy based on the file URL and the authority control parameters;
the conversion module is used for carrying out format conversion on the electronic file based on the Nginx reverse proxy;
and the prediction module is used for previewing and inserting the watermark based on the format conversion result.
6. The intelligent multi-format electronic archive previewing apparatus according to claim 5, wherein the configuration module is specifically configured to:
initializing N server clusters in the cluster at random through Nginx, calculating the fitness value of the N server clusters and the fitness value of a target position, judging whether the server clusters exceed the fitness value of the target position according to the acquired file URL and authority control parameters and the type of access equipment, if not, matching different Nginx reverse proxies with the server clusters of the target position through the file URL and the authority control parameters, and analyzing different resources to corresponding node servers through the different Nginx reverse proxies; and if the current node server is beyond the preset range, iteratively calculating the fitness values of the N server clusters based on the position updating of the leader and the follower, comparing the fitness values with the fitness value of the target position, updating the optimal scheme by using the position of the minimum fitness value, obtaining the optimal server cluster by continuously iteratively updating until the circulation is stopped, outputting the optimal server cluster, matching different Nginx reverse proxies by using the optimal server cluster through the file URL and the authority control parameter, and analyzing different resources to the corresponding node servers through the different Nginx reverse proxies.
7. The intelligent multi-format electronic archive previewing apparatus according to claim 5, wherein the conversion module is specifically configured to:
i. if the PDF file is in the PDF file, setting printing and downloading permissions through a PDFJS service component, and directly rendering preview in a browser;
if the CAD file is the document, calling an ASPOSE CAD component to convert the DWG document into PDF, setting printing and downloading permissions through a PDFJS service component, and directly rendering preview in a browser;
if the OFFICE file exists, calling LIBREOFFICE to convert the document into a picture, calling a picture preview component to set a printing download parameter, and previewing in a browser;
if the OFD national standard document format is adopted, an OFD READER and WRITER component is called to convert the document into a picture, a picture preview component is called to set printing and downloading parameters, and the picture is previewed on a browser;
v, if the picture format file is available, calling a picture preview component to set a printing downloading parameter and previewing on a browser;
and vi, if the video type file exists, calling the FFMPEG video file group video transcoding and calling a browser H5 player.
8. The intelligent multi-format electronic archive previewing apparatus according to claim 5, wherein the previewing module is specifically configured to:
i. electronic file convertible into PDF by using it when generating PDF
Inserting a bottom watermark into spot, pdf, background and artifact;
ii, converting the electronic file into an electronic file of a picture, and adding a watermark through a CSS (cascading Style sheets) mask layer when the picture is generated;
an electronic archive convertible into a video file is watermarked when transcoded by FFMPEG video.
9. An intelligent multi-format electronic archive previewing device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the multi-format electronic archive intelligent preview method of any of claims 1 to 4.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the intelligent multi-format electronic archive previewing method according to any one of claims 1 to 4.
CN202211513407.5A 2022-11-29 2022-11-29 Intelligent previewing method, device and equipment for multi-format electronic archive Pending CN115878572A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211513407.5A CN115878572A (en) 2022-11-29 2022-11-29 Intelligent previewing method, device and equipment for multi-format electronic archive

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211513407.5A CN115878572A (en) 2022-11-29 2022-11-29 Intelligent previewing method, device and equipment for multi-format electronic archive

Publications (1)

Publication Number Publication Date
CN115878572A true CN115878572A (en) 2023-03-31

Family

ID=85764679

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211513407.5A Pending CN115878572A (en) 2022-11-29 2022-11-29 Intelligent previewing method, device and equipment for multi-format electronic archive

Country Status (1)

Country Link
CN (1) CN115878572A (en)

Similar Documents

Publication Publication Date Title
JP3974307B2 (en) Method and apparatus for cooperative proxy system for distributed placement of object rendering
US20040003117A1 (en) Method and apparatus for dynamic optimization and network delivery of multimedia content
CN103782294B (en) Remote browsing session management
JP5274589B2 (en) Customization system and method for migrating desktop applications to web applications
JP6736440B2 (en) Device, method and program for providing document file generation service in cloud system
US20210049569A1 (en) Method of providing creative work trading service for increasing capitalization and accessibility of creative works
US20110173253A1 (en) Methods, Apparatus and Systems for Providing Local and Online Data Services
US8909675B2 (en) Executing transcription requests on files
CN106453572B (en) Method and system based on Cloud Server synchronous images
US20050256874A1 (en) Document file read system using network
CN105224510B (en) Method for converting file in document format
CN104050227A (en) PDF File Preview Manipulation
US9344466B1 (en) Methods and systems for facilitating online collaboration and distribution of geospatial data
US8312111B2 (en) Image processing in a computer network
US8341216B2 (en) Efficient method for image processing in a computer network
US20140337708A1 (en) Method and apparatus for providing web browsing service
US8676849B2 (en) Storing lossless transforms of data
CN115878572A (en) Intelligent previewing method, device and equipment for multi-format electronic archive
Mohomed et al. Urica: Usage-aware interactive content adaptation for mobile devices
CN104219277A (en) Rearranging a server response
CN111367525B (en) Front end framework system
Louafi et al. Robust QoE-aware prediction-based dynamic content adaptation framework applied to slides documents in mobile Web conferencing
JP2009205197A (en) Cgm distribution system and cgm distribution method
Louafi et al. A TOPSIS-based QoE model for adapted content selection of slide documents
KR20010044248A (en) Digital web paper service system

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