CN108153845A - Method and device derived from a kind of realization backstage image data - Google Patents
Method and device derived from a kind of realization backstage image data Download PDFInfo
- Publication number
- CN108153845A CN108153845A CN201711377489.4A CN201711377489A CN108153845A CN 108153845 A CN108153845 A CN 108153845A CN 201711377489 A CN201711377489 A CN 201711377489A CN 108153845 A CN108153845 A CN 108153845A
- Authority
- CN
- China
- Prior art keywords
- file
- target
- page
- static page
- graphic
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 52
- 230000003068 static effect Effects 0.000 claims abstract description 122
- 238000009877 rendering Methods 0.000 claims description 42
- 238000004891 communication Methods 0.000 claims description 19
- 230000005540 biological transmission Effects 0.000 claims description 3
- 238000009795 derivation Methods 0.000 claims description 3
- 230000000694 effects Effects 0.000 abstract description 15
- 238000010586 diagram Methods 0.000 description 6
- 238000011161 development Methods 0.000 description 4
- 238000004590 computer program Methods 0.000 description 3
- 238000009434 installation Methods 0.000 description 2
- 238000007726 management method Methods 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 238000013523 data management Methods 0.000 description 1
- 230000003203 everyday effect Effects 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000016776 visual perception Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
- G06F16/9577—Optimising the visualization of content, e.g. distillation of HTML documents
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Transfer Between Computers (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Embodiment of the invention discloses that a kind of method and device derived from realization backstage image data, this method will be in the corresponding static page storage to predetermined server of each Drawing Object by access path, and generate the instruction for exporting the static page, predetermined server can render the first file in each static page according to the instruction, the second file is obtained, the second file is exported.First file is obtained according to the data source and graphical format information of Drawing Object, second file is rendered to obtain to the first file, it ensure that the information integrity of Drawing Object so that the export effect and the display effect of the page to be exported of the second file derived from predetermined server are consistent.On the other hand, the batch for realizing the second file by instruction exports, and improves the export efficiency of image object.
Description
Technical Field
The embodiment of the invention relates to the technical field of computer picture data management, in particular to a method and a device for exporting background image data.
Background
A performance management system (PM) manages a large number of NE network element devices, and performance data collected every day is also in a massive level, so that a user can customize a plurality of monitoring windows and a large number of report timing tasks in order to monitor, count and analyze the index performance of a network. In consideration of style and visual effect, a fusion Chart component is introduced into the PM at the initial development stage, and the use requirements of operation and maintenance personnel under various service scenes can be met through rapid configuration and flexible extension of programs by the foreground. Since the PM relates to a plurality of background scheduling tasks, how to directly generate a result file with the same display effect as a foreground interface at a server side becomes one of the research problems.
The PM System is generally used for monitoring the performance of a communication Network, and provides visual display of the overall performance and development trend of a telecommunication operator Network by collecting, analyzing, warehousing, summarizing and displaying performance data of an EMS (Element Management System) System and an NE (Network Element equipment) Network Element. In the PM system, a variety of 20 chart styles such as line charts, bar chart, pie charts, area charts, bubble charts, instrument panels, and the like are used in a great number. These graphics, if exported at the browser client, can be conducted using the API provided by fusionchart. However, the system also requires that an analysis file such as a report form is generated at the server end through a timed task, namely, a background needs to be automatically executed by using a java program to generate a result, and the complete matching of a picture pattern in the file and a foreground display pattern cannot be realized. Although Jfreechart is a chart drawing class library on a java platform and supports the display and output of various graphic styles, the drawing effect of Jfreechart is greatly different from that of fusionchart, and finally the requirement of a user cannot be met.
In the process of implementing the embodiment of the invention, the inventor finds that the existing server cannot export the graphic object displayed on the page according to the style of the graphic object and the display mode on the page, so that the server cannot effectively monitor the page.
Disclosure of Invention
The technical problem to be solved by the invention is how to solve the problem that the existing server can not export the graphic object displayed on the page according to the style of the graphic object and the display mode on the page, so that the server side can not effectively monitor the page.
In view of the above technical problems, an embodiment of the present invention provides a method for exporting background image data, including:
creating an access path for accessing a preset server by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object aiming at each graphic object;
generating a first file corresponding to the graphic object according to the data source and the graphic format information to obtain a static page containing the first file, storing the static page according to the access path, and generating an instruction for exporting the static page;
rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction;
wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
Optionally, the creating a preset server access path accessed by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object for each graphic object includes:
and establishing the access path through wkhtmltox installed on the preset server, and acquiring the data source and the graphic format information corresponding to each graphic object on the page to be exported through the wkhtmltox.
Optionally, the generating a first file corresponding to the graphic object according to the data source and the graphic format information to obtain a static page including the first file, storing the static page according to the access path, and generating an instruction for exporting the static page includes:
generating the first file according to the data source and the graphic format information to obtain the static page containing the first file;
storing the static page to a preset storage position of a preset server according to the access path, and generating a cmd command for exporting the static page through the wkhtmltox to serve as an instruction for exporting the static page;
wherein the first file is an html file.
Optionally, the rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction includes:
and circularly executing file export operation until exporting the first file corresponding to each graphic object, wherein the file export operation comprises the following steps:
acquiring any static page from the preset storage position to serve as a target static page, and acquiring a cmd command corresponding to the target static page to serve as a target cmd command;
judging whether a target first file in the target static page is rendered or not according to the cmd command, if so, rendering the target first file to obtain a target second file corresponding to the target first file, and otherwise, taking the target first file as the target second file;
according to a storage path used for storing the second target file in the target cmd command, exporting the second target file to a preset Excel file, and deleting the static target page from the preset storage position;
the format of the second file is an image file or a PDF file.
In a second aspect, an embodiment of the present invention provides an apparatus for implementing background image data export, including:
the system comprises a creating module, a searching module and a display module, wherein the creating module is used for creating an access path for accessing a preset server by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object aiming at each graphic object;
the storage module is used for generating a first file corresponding to the graphic object according to the data source and the graphic format information, obtaining a static page containing the first file, storing the static page according to the access path, and generating an instruction for exporting the static page;
the export module is used for rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path used for storing the second file in the instruction;
wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
Optionally, the creating module is further configured to create the access path through a wkhtmltox installed on the preset server, and obtain the data source and the graphic format information corresponding to each graphic object on the page to be exported through the wkhtmltox. Optionally, the storage module is further configured to generate the first file according to the data source and the graphic format information, so as to obtain the static page including the first file; storing the static page to a preset storage position of a preset server according to the access path, and generating a cmd command for exporting the static page through the wkhtmltox to serve as an instruction for exporting the static page; wherein the first file is an html file.
Optionally, the export module is further configured to perform a file export operation in a loop until the first file corresponding to each of the graphic objects is exported, where the file export operation includes:
acquiring any static page from the preset storage position to serve as a target static page, and acquiring a cmd command corresponding to the target static page to serve as a target cmd command;
judging whether a target first file in the target static page is rendered or not according to the cmd command, if so, rendering the target first file to obtain a target second file corresponding to the target first file, and otherwise, taking the target first file as the target second file;
according to a storage path used for storing the second target file in the target cmd command, exporting the second target file to a preset Excel file, and deleting the static target page from the preset storage position;
the format of the second file is an image file or a PDF file.
In a third aspect, an embodiment of the present invention provides an electronic device, including:
at least one processor, at least one memory, a communication interface, and a bus; wherein,
the processor, the memory and the communication interface complete mutual communication through the bus;
the communication interface is used for information transmission between the electronic equipment and the communication equipment of the server or the communication equipment of the terminal;
the memory stores program instructions executable by the processor, which when called by the processor are capable of performing the methods described above.
In a fourth aspect, an embodiment of the present invention provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions that cause the computer to perform the method described above.
The embodiment of the invention provides a method and a device for exporting background image data. And generating a static page corresponding to the graphic object according to the data source and the graphic format information, storing the static page into a preset server according to the access path, and simultaneously generating an instruction for leading the static page out by the preset server. When the preset server exports the graphic object of the page to be exported, rendering a first file corresponding to the graphic object in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path in the command. The method includes the steps that a static page corresponding to each graphic object is stored in a preset server through an access path, an instruction for exporting the static page is generated, the preset server can render a first file in each static page according to the instruction to obtain a second file, and the second file is exported. The first file is obtained according to the data source of the graphic object and the graphic format information, and the second file is obtained by rendering the first file, so that the information integrity of the graphic object is ensured, and the export effect of the second file exported by the preset server is consistent with the display effect of the page to be exported. On the other hand, batch export of the second files is realized through the instructions, and export efficiency of the image objects is improved.
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, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flow chart illustrating a method for implementing background image data export according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a graphical object on a page to be exported according to another embodiment of the present invention;
fig. 3 is a schematic diagram of a preset server-derived graphical object according to the method provided in this embodiment according to another embodiment of the present invention;
FIG. 4 is a schematic structural diagram of an apparatus for implementing background image data export according to another embodiment of the present invention;
fig. 5 is a block diagram of an electronic device according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic flowchart of a method for implementing background image data export according to this embodiment, and referring to fig. 1, the method includes:
101: creating an access path for accessing a preset server by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object aiming at each graphic object;
102: generating a first file corresponding to the graphic object according to the data source and the graphic format information to obtain a static page containing the first file, storing the static page according to the access path, and generating an instruction for exporting the static page;
103: rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction;
wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
It should be noted that the method provided by the present embodiment is executed by a server. The access path may be implemented by a wkhtmltox plug-in installed on a preset server, which is not specifically limited in this embodiment. The graphic objects are graphics displayed on a page to be exported, for example, four graphic objects are included in the page to be exported shown in fig. 2. The data source is data used to recover the graphical object, e.g., the data source is the value of each pixel of the graphical object. The graphic format information includes a graphic style, a length-width ratio, etc. of the graphic object.
The embodiment provides a method for exporting background image data, which includes creating an access path between a page to be exported and a preset server, and acquiring data source and graphic format information of each graphic object of the page to be exported through the access path. And generating a static page corresponding to the graphic object according to the data source and the graphic format information, storing the static page into a preset server according to the access path, and simultaneously generating an instruction for leading the static page out by the preset server. When the preset server exports the graphic object of the page to be exported, rendering a first file corresponding to the graphic object in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path in the command. The method includes the steps that a static page corresponding to each graphic object is stored in a preset server through an access path, an instruction for exporting the static page is generated, the preset server can render a first file in each static page according to the instruction to obtain a second file, and the second file is exported. The first file is obtained according to the data source of the graphic object and the graphic format information, and the second file is obtained by rendering the first file, so that the information integrity of the graphic object is ensured, and the export effect of the second file exported by the preset server is consistent with the display effect of the page to be exported. On the other hand, batch export of the second files is realized through the instructions, and export efficiency of the image objects is improved.
Further, on the basis of the above embodiment, the creating a preset server access path accessed by a page to be exported, and acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object for each graphic object includes:
and establishing the access path through wkhtmltox installed on the preset server, and acquiring the data source and the graphic format information corresponding to each graphic object on the page to be exported through the wkhtmltox.
wkhtmltox is a powerful open source tool, can convert any page which can be rendered in a browser into an image or pdf file, and can run independently in the background through cmd command batch processing to ensure consistency of foreground and background export results. And installing wkhtmltox matched with the operating system on the preset server according to the operating system of the preset server.
The embodiment provides a method for exporting background image data, which realizes the establishment of an access path and the acquisition of a data source and graphic format information of a graphic object through wkhtmltox. The method enables the derivation process of various background graphic styles to be normalized. By using the wkhtmltox tool, the graphics rendered on the page can be directly exported in a screen capture-like mode, each graphic style does not need to be processed independently, development cost is saved, export of all the graphic styles can be completely realized by fewer code lines, and export efficiency is greatly improved.
Further, on the basis of the foregoing embodiments, the generating a first file corresponding to the graphic object according to the data source and the graphic format information to obtain a static page including the first file, storing the static page according to the access path, and generating an instruction for exporting the static page includes:
generating the first file according to the data source and the graphic format information to obtain the static page containing the first file;
storing the static page to a preset storage position of a preset server according to the access path, and generating a cmd command for exporting the static page through the wkhtmltox to serve as an instruction for exporting the static page;
wherein the first file is an html file.
It should be noted that, when the preset server executes the cmd command to export the second file, a new process is started.
The embodiment provides a method for exporting background image data, which is used for exporting static pages through cmd command character strings, so that the operation is simple and easy to implement, and the exporting efficiency and the picture quality are greatly improved.
Further, on the basis of the foregoing embodiments, the rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction includes:
and circularly executing file export operation until exporting the first file corresponding to each graphic object, wherein the file export operation comprises the following steps:
acquiring any static page from the preset storage position to serve as a target static page, and acquiring a cmd command corresponding to the target static page to serve as a target cmd command;
judging whether a target first file in the target static page is rendered or not according to the cmd command, if so, rendering the target first file to obtain a target second file corresponding to the target first file, and otherwise, taking the target first file as the target second file;
according to a storage path used for storing the second target file in the target cmd command, exporting the second target file to a preset Excel file, and deleting the static target page from the preset storage position;
the format of the second file is an image file or a PDF file.
The embodiment provides a method for exporting background image data, which is a method for exporting background images by using a wkhtmltox plug-in, so that result differences caused by different drawing mechanisms are effectively avoided, a file generated by a timing task can also keep a 'what you see is what you get' display effect with a foreground interface, and consistency of export effects of a foreground and a background is ensured. The method for exporting the background picture by using the wkhtmltox plug-in can be well suitable for the expansion, does not need to add extra codes even if more graphic styles are customized subsequently, and shows good universality and adaptability.
As a more specific embodiment, the method provided in this embodiment includes:
(1) and installing a wkhtmltox tool on the preset server.
Specifically, the wkhtmltox toolkit is downloaded to the official, and is installed on a preset server. Note that different operating systems need to download different installation packages. And creating a path which can be accessed by the web on the server as a specified path (access path) for storing the html file temporarily generated by the program.
(2) Decomposing each graphic object on the interface, acquiring a respective data source, and acquiring a presentation form of each graphic object, such as a graphic style, a length-width ratio and the like.
(3) And a background program (a program on a preset server) generates a temporary static html page (static page) under a specified path, only one graph is rendered in the page, and the style and the data source of the graph are consistent with the foreground interface of the system.
(4) A cmd command string is generated to be executed.
(5) A new process call cmd command is initiated.
(6) And generating a export picture under the specified path, and deleting the temporary html page.
(7) And (5) repeating the steps (3) to (6) for multiple times until all images in the interface are exported.
(8) And generating an Excel file, and writing all images exported under the specified path into the Excel file.
Likewise, pdf files or other file formats may be generated in the same manner.
Or, exporting the image object in the page to be exported according to the following method, specifically comprising:
(1) downloading the wkhtmltox toolkit to an official party and installing the wkhtmltox toolkit on a server (a preset server). Note that different operating systems need to download different installation packages.
(2) A path accessible to the web (page to be exported) is created on the server for storing the html file (first file) temporarily generated by the program.
(3) A specific export operation is started. Assuming that there is a report timing task, the foreground (to-be-exported page) previews the result as shown in fig. 2. The report result generated by the timing task of the background (preset server) will also be consistent with the effect of fig. 2. Each graphic component on the circular interface records its style, size (graphic format information) and data source.
(4) And generating a temporary html file. And (4) aiming at each graph to be exported, and individually rendering the graph in one static page by using the data source and the style acquired in the step (3). The page is automatically generated by a program, stored below a temporary path created in advance and named as a specific elementary +. html format.
(5) And generating a command character string used by the wkhtmltox tool for exporting the pictures, wherein the command comprises parameters such as exporting formats, storage paths, the length and width of the pictures, whether to delay rendering and the like, and exporting the pictures rendered in the static page.
(6) And enabling the new process to execute (5) the command generated in the step.
(7) And circularly exporting each picture until all the pictures are exported, and integrating the pictures into the Excel file according to the sequence on the page. As shown in fig. 3, it can be seen that, by the method for exporting background image data provided by this embodiment, the file exported by the preset server in fig. 3 well maintains consistency with the page to be exported in fig. 2.
(8) And after the Excel file is successfully generated, deleting all html files under the temporary path.
The method provided by the embodiment enables the derivation process of various background graphic styles to be normalized. Because various graph styles such as line graphs, column graphs, pie graphs, area graphs and the like are involved in the system, if the system is realized by using a class library similar to Jfreechart, each graph needs to write a corresponding derivation program, and the code is complicated and the realization is complex. By using the wkhtmltox tool, the graphics rendered on the page can be directly exported in a screen capture-like mode, each graphic style does not need to be processed independently, development cost is saved, export of all the graphic styles can be completely realized by fewer code lines, and export efficiency is greatly improved.
The consistency of the leading-out effect of the foreground and the background is ensured. The fusionChart component provides good visual perception for users, but background export is not supported, and the background export realized by using other library interfaces cannot be completely consistent with interface display, and the display styles are quite different. By using the method for exporting the background picture by using the wkhtmltox plug-in, the result difference caused by different drawing mechanisms is effectively avoided, and the file generated by the timing task can also keep the 'what you see is what you get' display effect with the foreground interface.
The method can be well adapted to the customized expansion of the chart in the subsequent system. The PM system is solidified to realize various common charts and cover most of service scenes, but in order to meet different service requirements of overseas operators, an expansion interface is reserved in the system to support the customization and expansion of the charts. The method for exporting the background picture by using the wkhtmltox plug-in can be well suitable for the expansion, does not need to add extra codes even if more graphic styles are customized subsequently, and shows good universality and adaptability.
Fig. 4 shows a block diagram of an apparatus for implementing background image data export according to an embodiment of the present invention, and referring to fig. 4, the apparatus for implementing background image data export according to the embodiment includes a creation module 401, a storage module 402, and an export module 403, wherein,
a creating module 401, configured to create an access path for accessing a preset server by a page to be exported, acquire a graphical object on the page to be exported, and acquire, for each graphical object, a data source and graphical format information of the graphical object;
a storage module 402, configured to generate a first file corresponding to the graphic object according to the data source and the graphic format information, obtain a static page including the first file, store the static page according to the access path, and generate an instruction for exporting the static page;
an export module 403, configured to render the first file in the static page according to the instruction to obtain a second file, and export the second file according to a storage path in the instruction, where the storage path is used to store the second file;
wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
The apparatus for implementing export of background image data provided in this embodiment is suitable for the method for implementing export of background image data provided in the foregoing embodiment, and details are not repeated here.
The embodiment of the invention provides a device for exporting background image data, which is used for establishing an access path of a page to be exported and a preset server and acquiring data source and graphic format information of each graphic object of the page to be exported through the access path. And generating a static page corresponding to the graphic object according to the data source and the graphic format information, storing the static page into a preset server according to the access path, and simultaneously generating an instruction for leading the static page out by the preset server. When the preset server exports the graphic object of the page to be exported, rendering a first file corresponding to the graphic object in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path in the command. The device stores the static page corresponding to each graphic object into a preset server through an access path, generates an instruction for exporting the static page, and the preset server can render the first file in each static page according to the instruction to obtain a second file and export the second file. The first file is obtained according to the data source of the graphic object and the graphic format information, and the second file is obtained by rendering the first file, so that the information integrity of the graphic object is ensured, and the export effect of the second file exported by the preset server is consistent with the display effect of the page to be exported. On the other hand, batch export of the second files is realized through the instructions, and export efficiency of the image objects is improved.
In a third aspect, fig. 5 is a block diagram illustrating a structure of an electronic apparatus provided in the present embodiment.
Referring to fig. 5, the electronic device includes: a processor (processor)501, a memory (memory)502, a communication Interface (Communications Interface)503, and a bus 504;
wherein,
the processor 501, the memory 502 and the communication interface 503 complete mutual communication through the bus 504;
the communication interface 503 is used for information transmission between the electronic device and a communication device of a device corresponding to the page to be exported;
the processor 501 is configured to call program instructions in the memory 502 to perform the methods provided by the above-mentioned method embodiments, for example, including: creating an access path for accessing a preset server by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object aiming at each graphic object; generating a first file corresponding to the graphic object according to the data source and the graphic format information to obtain a static page containing the first file, storing the static page according to the access path, and generating an instruction for exporting the static page; rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction; wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
In a fourth aspect, the present embodiment provides a non-transitory computer-readable storage medium storing computer instructions that cause the computer to perform the method provided by the above method embodiments, for example, including: creating an access path for accessing a preset server by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object aiming at each graphic object; generating a first file corresponding to the graphic object according to the data source and the graphic format information to obtain a static page containing the first file, storing the static page according to the access path, and generating an instruction for exporting the static page; rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction; wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
The present embodiments disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the methods provided by the above-described method embodiments, for example, comprising: creating an access path for accessing a preset server by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object aiming at each graphic object; generating a first file corresponding to the graphic object according to the data source and the graphic format information to obtain a static page containing the first file, storing the static page according to the access path, and generating an instruction for exporting the static page; rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction; wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The above-described embodiments of the electronic device and the like are merely illustrative, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may also be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the embodiments of the present invention, and are not limited thereto; although embodiments of the present invention have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.
Claims (10)
1. A method of enabling background image data export, comprising:
creating an access path for accessing a preset server by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object aiming at each graphic object;
generating a first file corresponding to the graphic object according to the data source and the graphic format information to obtain a static page containing the first file, storing the static page according to the access path, and generating an instruction for exporting the static page;
rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction;
wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
2. The method according to claim 1, wherein the creating accesses a preset server access path from a page to be exported, and acquiring the graphic objects on the page to be exported, and for each graphic object, acquiring the data source and graphic format information of the graphic object comprises:
and establishing the access path through wkhtmltox installed on the preset server, and acquiring the data source and the graphic format information corresponding to each graphic object on the page to be exported through the wkhtmltox.
3. The method of claim 2, wherein generating a first file corresponding to the graphical object based on the data source and the graphical format information, obtaining a static page containing the first file, storing the static page according to the access path, and generating instructions to export the static page comprises:
generating the first file according to the data source and the graphic format information to obtain the static page containing the first file;
storing the static page to a preset storage position of a preset server according to the access path, and generating a cmd command for exporting the static page through the wkhtmltox to serve as an instruction for exporting the static page;
wherein the first file is an html file.
4. The method of claim 3, wherein the rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path for storing the second file in the instruction comprises:
and circularly executing file export operation until exporting the first file corresponding to each graphic object, wherein the file export operation comprises the following steps:
acquiring any static page from the preset storage position to serve as a target static page, and acquiring a cmd command corresponding to the target static page to serve as a target cmd command;
judging whether a target first file in the target static page is rendered or not according to the cmd command, if so, rendering the target first file to obtain a target second file corresponding to the target first file, and otherwise, taking the target first file as the target second file;
according to a storage path used for storing the second target file in the target cmd command, exporting the second target file to a preset Excel file, and deleting the static target page from the preset storage position;
the format of the second file is an image file or a PDF file.
5. An apparatus for enabling background image data derivation, comprising:
the system comprises a creating module, a searching module and a display module, wherein the creating module is used for creating an access path for accessing a preset server by a page to be exported, acquiring a graphic object on the page to be exported, and acquiring a data source and graphic format information of the graphic object aiming at each graphic object;
the storage module is used for generating a first file corresponding to the graphic object according to the data source and the graphic format information, obtaining a static page containing the first file, storing the static page according to the access path, and generating an instruction for exporting the static page;
the export module is used for rendering the first file in the static page according to the instruction to obtain a second file, and exporting the second file according to a storage path used for storing the second file in the instruction;
wherein the graphic format information includes a style, a size, and an aspect ratio of the graphic object, and the command includes the graphic format information, the deposit path, and rendering information regarding rendering the first file.
6. The apparatus of claim 5, wherein the creating module is further configured to create the access path through a wkhtmltox installed on the preset server, and obtain the data source and the graphic format information corresponding to each graphic object on the page to be exported through the wkhtmltox.
7. The apparatus of claim 6, wherein the storage module is further configured to generate the first file according to the data source and the graphic format information, and obtain the static page including the first file; storing the static page to a preset storage position of a preset server according to the access path, and generating a cmd command for exporting the static page through the wkhtmltox to serve as an instruction for exporting the static page; wherein the first file is an html file.
8. The apparatus of claim 7, wherein the export module is further configured to loop file export operations until exporting the first file corresponding to each of the graphics objects, wherein the file export operations comprise:
acquiring any static page from the preset storage position to serve as a target static page, and acquiring a cmd command corresponding to the target static page to serve as a target cmd command;
judging whether a target first file in the target static page is rendered or not according to the cmd command, if so, rendering the target first file to obtain a target second file corresponding to the target first file, and otherwise, taking the target first file as the target second file;
according to a storage path used for storing the second target file in the target cmd command, exporting the second target file to a preset Excel file, and deleting the static target page from the preset storage position;
the format of the second file is an image file or a PDF file.
9. An electronic device, comprising:
at least one processor, at least one memory, a communication interface, and a bus; wherein,
the processor, the memory and the communication interface complete mutual communication through the bus;
the communication interface is used for information transmission between the electronic equipment and the communication equipment of the server or the communication equipment of the terminal;
the memory stores program instructions executable by the processor, the processor invoking the program instructions to perform the method of any of claims 1-4.
10. A non-transitory computer-readable storage medium storing computer instructions that cause a computer to perform the method of any one of claims 1-4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711377489.4A CN108153845B (en) | 2017-12-19 | 2017-12-19 | Method and device for exporting background image data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711377489.4A CN108153845B (en) | 2017-12-19 | 2017-12-19 | Method and device for exporting background image data |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108153845A true CN108153845A (en) | 2018-06-12 |
CN108153845B CN108153845B (en) | 2020-06-16 |
Family
ID=62463960
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711377489.4A Active CN108153845B (en) | 2017-12-19 | 2017-12-19 | Method and device for exporting background image data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108153845B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109815645A (en) * | 2019-01-25 | 2019-05-28 | 浪潮天元通信信息系统有限公司 | A method of realizing that background server exports foreground interface |
CN113361235A (en) * | 2021-06-30 | 2021-09-07 | 北京百度网讯科技有限公司 | HTML file generation method and device, electronic equipment and readable storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105955730A (en) * | 2016-04-26 | 2016-09-21 | 浪潮电子信息产业股份有限公司 | Method for managing platform report forms in ssr (service support manager) centralized manner |
US20160342577A1 (en) * | 2015-05-20 | 2016-11-24 | Mitsuo Ando | Information processing apparatus, information processing system, and information processing method |
CN107341005A (en) * | 2017-06-20 | 2017-11-10 | 东软集团股份有限公司 | Chart generation method and its device |
-
2017
- 2017-12-19 CN CN201711377489.4A patent/CN108153845B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20160342577A1 (en) * | 2015-05-20 | 2016-11-24 | Mitsuo Ando | Information processing apparatus, information processing system, and information processing method |
CN105955730A (en) * | 2016-04-26 | 2016-09-21 | 浪潮电子信息产业股份有限公司 | Method for managing platform report forms in ssr (service support manager) centralized manner |
CN107341005A (en) * | 2017-06-20 | 2017-11-10 | 东软集团股份有限公司 | Chart generation method and its device |
Non-Patent Citations (1)
Title |
---|
STANZHAI: "Highcharts结合PhantomJS在服务端生成高质量的图表图片", 《HTTPS://WWW.CNBLOGS.COM/JASONDAN/P/3504120.HTM1》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109815645A (en) * | 2019-01-25 | 2019-05-28 | 浪潮天元通信信息系统有限公司 | A method of realizing that background server exports foreground interface |
CN113361235A (en) * | 2021-06-30 | 2021-09-07 | 北京百度网讯科技有限公司 | HTML file generation method and device, electronic equipment and readable storage medium |
CN113361235B (en) * | 2021-06-30 | 2024-03-22 | 北京百度网讯科技有限公司 | HTML file generation method and device, electronic equipment and readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN108153845B (en) | 2020-06-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10705942B1 (en) | Simulated testing of API | |
CN109375914B (en) | Information remote interaction method and system | |
CN110347383B (en) | Front-end development method and device for cross-platform desktop application | |
CN112286513A (en) | Visual design method and device based on component metadata | |
CN109783757B (en) | Method, device and system for rendering webpage, storage medium and electronic device | |
EP3499360B1 (en) | Systems and methods for client-side data analysis | |
CN113382083B (en) | Webpage screenshot method and device | |
CN111399831A (en) | Page display method and device, storage medium and electronic device | |
CN112131837B (en) | Service report configuration method, device, computer equipment and storage medium | |
CN112631590B (en) | Component library generation method, device, electronic equipment and computer readable medium | |
CN113505302A (en) | Method, device and system for supporting dynamic acquisition of buried point data and electronic equipment | |
CN108153845B (en) | Method and device for exporting background image data | |
CN114612279A (en) | Watermark adding method and device | |
CN114860205A (en) | Application extension system, method and device of low-code development platform | |
CN109582317A (en) | Method and apparatus for debugging boarding application | |
CN115526160A (en) | Rich text processing method, device and equipment and storage medium | |
CN113220381A (en) | Click data display method and device | |
US10956026B2 (en) | Smart element filtering method via gestures | |
CN114756228A (en) | Page processing method, device, equipment and storage medium | |
CN110442782B (en) | Cloud resource retrieval method and device | |
CN108021317B (en) | Method and device for screen editing | |
CN113282852A (en) | Method and device for editing webpage | |
CN112445394A (en) | Screenshot method and device | |
CN112346774A (en) | Method and device for generating application installation package | |
CN116775174A (en) | Processing method, device, equipment and medium based on user interface frame |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |