CN112948737A - HTML page screenshot method and system - Google Patents

HTML page screenshot method and system Download PDF

Info

Publication number
CN112948737A
CN112948737A CN202110276422.1A CN202110276422A CN112948737A CN 112948737 A CN112948737 A CN 112948737A CN 202110276422 A CN202110276422 A CN 202110276422A CN 112948737 A CN112948737 A CN 112948737A
Authority
CN
China
Prior art keywords
screenshot
html page
picture
captured
client
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
CN202110276422.1A
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.)
Elane Inc
Original Assignee
Elane Inc
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 Elane Inc filed Critical Elane Inc
Priority to CN202110276422.1A priority Critical patent/CN112948737A/en
Publication of CN112948737A publication Critical patent/CN112948737A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Abstract

The invention provides an HTML page screenshot method and system. Neither on the client nor on the server side, there is a need to open a browser application. The client particularly supports that a request to the server can be initiated in a software development program, and the generated picture can be stored or processed in other ways. The screenshot operation of the HTML page to be screenshot can be completed under the invisible condition, manual screenshot is not needed, so that the screenshot efficiency is greatly improved, and the implementation difficulty is reduced.

Description

HTML page screenshot method and system
Technical Field
The invention relates to the technical field of computers, in particular to a method and a system for capturing HTML (hypertext markup language) pages.
Background
Since a HyperText Markup Language (HTML) page can present a lot of rich and practical contents, there are many scenes in practical application that the HTML page needs to be screenshot and stored. Particularly in the field of shipping analysis, there may be a scenario where a screenshot of an HTML page representing ship behavior may be required to generate a ship behavior report.
The ship behavior report is a complex report, the types of modules are complex, the covering data is various, and the contents of ship tracks, berth snapshot, ship images and the like are difficult to make and display. Therefore, screenshot of the HTML page in the ship behavior report system is the fastest mode for generating the ship behavior report. At present, many systems and tools for performing screenshot on an HTML page exist, but all of them are modes of manually performing screenshot after opening a browser to load the HTML page, so that the efficiency is low and the implementation difficulty is high.
Disclosure of Invention
The invention provides a method and a system for screenshot of an HTML page, which are used for overcoming the defects of low efficiency and high implementation difficulty of manual screenshot in the prior art, so that the screenshot efficiency is improved, and the implementation difficulty is reduced.
The invention provides a method for screenshot of an HTML page, which comprises the following steps:
acquiring screenshot request parameters transmitted by a client based on an HTTP request Application Program Interface (API), wherein the screenshot request parameters comprise websites of HTML pages to be screenshot;
and loading the HTML page to be captured from the website of the HTML page to be captured based on a rendering engine and a JS engine, drawing the HTML page to be captured into a picture, and feeding the picture back to the client.
According to the HTML page screenshot method provided by the invention, the screenshot request parameter further comprises: a delay time;
correspondingly, the drawing the HTML page to be captured into a picture specifically comprises the following steps:
and after the HTML page to be subjected to screenshot is loaded and the delay time is passed, drawing the HTML page to be subjected to screenshot into a picture.
According to the HTML page screenshot method provided by the invention, the screenshot request parameter further comprises: a target screenshot size;
correspondingly, the drawing the HTML page to be captured into a picture specifically comprises the following steps:
and drawing the HTML page to be subjected to screenshot into a picture based on the target screenshot size.
According to the HTML page screenshot method provided by the invention, the HTML page to be screenshot is drawn into a picture, and the method specifically comprises the following steps:
and drawing the HTML page to be captured into a picture by calling a GDI + plug-in.
According to the HTML page screenshot method provided by the invention, the screenshot request parameter further comprises: and browser cookie data corresponding to the HTML page to be captured.
According to the HTML page screenshot method provided by the invention, the number of the HTML pages to be screenshot is one or more.
According to the HTML page screenshot method provided by the invention, the screenshot request parameter is obtained by the client side after the address of the API is determined and then is transmitted to the API.
The invention also provides an HTML page screenshot system, which comprises: a screenshot request parameter acquisition module and a drawing feedback module. Wherein the content of the first and second substances,
the screenshot request parameter acquisition module is used for acquiring screenshot request parameters transmitted by a client based on an HTTP request Application Program Interface (API), wherein the screenshot request parameters comprise websites of HTML pages to be screenshot;
and the drawing feedback module is used for loading the HTML page to be captured from the website of the HTML page to be captured based on the rendering engine and the JS engine, drawing the HTML page to be captured into a picture, and feeding the picture back to the client.
The invention also provides electronic equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the program to realize the steps of any one of the HTML page screenshot methods.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method for HTML page screenshot as described in any one of the above.
The method comprises the steps of firstly obtaining screenshot request parameters transmitted by a client based on an HTTP request application program interface API, then loading an HTML page to be screenshot from a website of the HTML page to be screenshot based on a rendering engine and a JS engine, drawing the HTML page to be screenshot into a picture, and feeding the picture back to the client. Neither on the client nor on the server side, there is a need to open a browser application. The client particularly supports that a request to the server can be initiated in a software development program, and the generated picture can be stored or processed in other ways. The screenshot operation of the HTML page to be screenshot can be completed under the invisible condition, manual screenshot is not needed, so that the screenshot efficiency is greatly improved, and the implementation difficulty is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed to be 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 it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic flow chart diagram of a method for screenshot of an HTML page provided by the present invention;
FIG. 2 is a schematic diagram of a relationship between a client and a server in the HTML page screenshot method provided by the present invention;
FIG. 3 is a schematic diagram illustrating a request principle of an API in the HTML page screenshot method provided by the present invention;
FIG. 4 is a schematic structural diagram of a screenshot request parameter in the HTML page screenshot method provided by the present invention;
FIG. 5 is a schematic structural diagram of an HTML page screenshot system provided by the present invention;
fig. 6 is a schematic structural diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, 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.
Because the existing method for capturing the HTML page is usually a manual method for capturing the HTML page after the browser is opened and the HTML page is loaded, the efficiency is low, and the implementation difficulty is high. Therefore, the embodiment of the invention provides an HTML page screenshot method.
Fig. 1 is a method for screenshot in an HTML page provided in an embodiment of the present invention, including:
s1, acquiring screenshot request parameters transmitted by a client based on an HTTP request application program interface API, wherein the screenshot request parameters comprise a website of an HTML page to be screenshot;
and S2, loading the HTML page to be captured from the website of the HTML page to be captured based on the rendering engine and the JS engine, drawing the HTML page to be captured into a picture, and feeding the picture back to the client.
Specifically, in the HTML page screenshot method provided in the embodiment of the present invention, an execution subject is a server, and the server refers to a computer system capable of providing screenshot service for a client in a network. It may be a web service hosted on an internet data center server that is accessible by clients and through which corresponding picture files or streams of picture files may be provided to the clients. The web service can be an application program, the application program is generated through programming of related technologies, the application program is deployed at a service end, requests of a client side on a network are received, and an HTML page to be captured is subjected to rendering content processing, generated pictures and output back to the client side.
In the embodiment of the invention, the client is a user side and is a request side for initiating screen capture operation on the HTML page to be captured. Here, the client is not a web browser or desktop program in the conventional sense, but any program that can initiate a network request to the server. It can be requested through a browser or through a developed application. In brief, the client described in the present invention needs to connect with the server program through the internet and the program supporting the network request in the user computer to request the resource.
The server side can adapt to various scenes and client sides, and the client sides can be browsers, developed web pages, developed desktop programs and direct embedded display in other systems. The relationship between the client and the server in the embodiment of the invention is shown in fig. 2, the server can be connected with a plurality of clients through the internet, and the server can realize the provision of the HTML page screenshot service for each client. The client can send a screenshot request to the server through the Internet, and the screenshot request reaches the server through the Internet. And the server generates a picture through screenshot processing and then returns the processed picture, the picture is fed back to the client through the Internet, and the client acquires the generated picture until the flow of the whole HTML page screenshot method is finished.
Step S1 is executed first, and a screenshot request parameter transmitted by the client based on an HTTP request Application Programming Interface (API) is obtained. The server side can provide API capability, and the client side requests the server side to perform screenshot processing on the HTML page to be screenshot through an HTTP request API mode to generate a picture. The client does not need to consider development language and program compatibility, does not need to understand details of a working mechanism of the server, and only needs to call the API through HTTP. The method can conveniently and flexibly enable the client to carry out quick request while having strong openness.
The request principle of the API is as shown in fig. 3, the client sends an API request parameter through an HTTP request API, the API request parameter is called and analyzed by HTTP, and then an HTTP request is encapsulated according to a protocol, sent to the server via the internet, and handed to the server for processing. On the other hand, the picture stream generated by the server is returned through the Internet, and is transmitted to the client after http calling and analysis. In the embodiment of the invention, the screenshot request is an API request, and the screenshot request parameter is an API request parameter, which can include a website of an HTML page to be screenshot, and the website is an HTML website url. And when the server receives a screenshot request of the client, the server starts to analyze the screenshot request parameters and analyzes the HTML website url from the screenshot request parameters. The HTML page to be subjected to screenshot refers to an HTML page needing screenshot processing, and the HTML page is a resource on an accessible Internet site. The HTML page is a file with a suffix name made by HTML in computer storage, and is a visual page which can be opened in a browser and comprises a series of tags which can explain the contents of characters, graphics, animation, tables and the like. The HTML page may display some complex contents, such as canvas and svg complex page elements like a report chart, may also be a page with a long length, and may also be a page that may require a certain loading time to render successfully, which is not specifically limited in the embodiment of the present invention.
And then executing the step S2, and loading the HTML page to be captured from the website of the HTML page to be captured by the server according to the rendering engine and the JS engine. The rendering engine and the JS engine are browser engines built in the environment of the server side, HTML pages to be captured in the Internet can be loaded through the rendering engine, and the pages are beautified and loaded through the JS (Javascript, dynamic script) engine. The JS engine can add interaction behavior to the HTML page to be captured, so that the man-machine interaction of the HTML page to be captured is realized, and a function of partially operating a browser can be provided for a developer.
In the embodiment of the invention, the rendering engine is responsible for explaining the webpage language and rendering and displaying the webpage, and the JS engine is responsible for dynamically operating the webpage to change the rendering result. The rendering engine and the JS engine may be called in a software program, and thus the web service in the embodiment of the present invention may be a system based on the rendering engine and the JS engine. When the system works, a rendering engine in the system is called, an HTML page to be captured requested by a client is analyzed, a tag is converted into a DOM node of a document tree, and then style data including external CSS and an inline style of an element is analyzed; and then calling a JS engine, executing Javascript script, and modifying the webpage content and the style information through DOM, CSS and DOM interfaces so as to change the rendering result. The two engines can be initialized through a software background program without additionally starting a browser, so that the HTML page to be captured can be loaded through the background program.
And after the HTML page to be captured is loaded, drawing the HTML page to be captured into a picture, and feeding the picture back to the client. The drawing can be realized by adopting GDI plug-in, wherein GDI is a graphic equipment interface and is responsible for information exchange between the system and the drawing program and processing the graphic output of the windows program.
The HTML page screenshot method provided by the embodiment of the invention comprises the steps of firstly obtaining screenshot request parameters transmitted by a client based on an HTTP request application program interface API, then loading an HTML page to be screenshot from a website of the HTML page to be screenshot based on a rendering engine and a JS engine, drawing the HTML page to be screenshot into a picture, and feeding the picture back to the client. Neither on the client nor on the server side, there is a need to open a browser application. The client particularly supports that a request to the server can be initiated in a software development program, and the generated picture can be stored or processed in other ways. The screenshot operation of the HTML page to be screenshot can be completed under the invisible condition, manual screenshot is not needed, so that the screenshot efficiency is greatly improved, and the implementation difficulty is reduced.
On the basis of the above embodiment, in the HTML page screenshot method provided in the embodiment of the present invention, the screenshot request parameter further includes: a delay time;
correspondingly, the drawing the HTML page to be captured into a picture specifically comprises the following steps:
and after the HTML page to be subjected to screenshot is loaded and the delay time is passed, drawing the HTML page to be subjected to screenshot into a picture.
Specifically, for the situation that the HTML page to be screenshot is complex and loading is slow, if the server performs screenshot immediately after receiving the screenshot request, the HTML page to be screenshot may not be completely loaded and the complete page content may not be displayed. Therefore, in the embodiment of the invention, by designing the waiting time, namely the delay time, after the webpage is requested, which is transmitted into the API request parameter, the HTML page to be screenshot can be drawn into the picture after the HTML page to be screenshot is completely loaded.
In the embodiment of the invention, the delay time is added into the screenshot request parameter, so that the complete content of the HTML page to be screenshot can be ensured in the picture obtained by subsequent drawing, and the integrity of the HTML page to be screenshot is ensured.
On the basis of the above embodiment, in the HTML page screenshot method provided in the embodiment of the present invention, the screenshot request parameter further includes: a target screenshot size;
correspondingly, the drawing the HTML page to be captured into a picture specifically comprises the following steps:
and drawing the HTML page to be subjected to screenshot into a picture based on the target screenshot size.
Specifically, in the embodiment of the present invention, the screenshot request parameter may further include a target screenshot size, where the target screenshot size may be a screenshot size defined by the client, and the HTML page to be screenshot is drawn into a picture with the target screenshot size through the API request parameter. The target screenshot size may include information such as the screenshot height, width, etc.
In the embodiment of the invention, the target screenshot size is introduced into the screenshot request parameter, so that the picture obtained by subsequent drawing can be ensured to have the target screenshot size, the requirement of a user is better met, and the user experience is improved.
On the basis of the above embodiment, the method for screenshot in an HTML page provided in the embodiment of the present invention, where the HTML page to be screenshot is drawn into a picture, specifically includes:
and drawing the HTML page to be captured into a picture by calling a GDI + plug-in.
Specifically, in the embodiment of the invention, the HTML page to be captured is drawn into a picture by calling the GDI + plug-in. GDI + is an upgrade version of GDI, and provides a rich graph drawing method, so that HTML pages to be captured loaded in a rendering engine and a JS engine can be drawn in a background program. The embodiment of the invention mainly uses the Graphics class in the GDI +, the Graphics class provides a method for drawing graphs, images and texts, and the pictures can be beautified and processed in various individuations while the HTML pages to be captured are drawn, so that the server side has flexible capture operation and can process different HTML pages to be captured and different client side requirements.
In the embodiment of the invention, the HTML page to be subjected to screenshot is drawn into the picture by calling the GDI + type plug-in, so that the flexibility of the screenshot operation of the server side can be improved, and the method and the device for processing the HTML page to be subjected to screenshot and the requirements of different clients can be suitable for processing different HTML pages to be subjected to screenshot and different clients.
On the basis of the above embodiment, in the HTML page screenshot method provided in the embodiment of the present invention, the screenshot request parameter further includes: and browser cookie data corresponding to the HTML page to be captured.
Specifically, since some html pages require participation of data (cookie data) stored on the user's local terminal to be normally displayed. In the embodiment of the invention, the browser cookie data corresponding to the HTML page to be subjected to screenshot can be introduced into the screenshot request parameter, so that the client can send the cookie data to the server, and the server can load the HTML page to be subjected to screenshot when having the cookie data, thereby ensuring that the loading process is smoother.
As shown in fig. 4, the information included in the screenshot request parameter in the embodiment of the present invention may include information such as an address of an API, a website of an HTML page to be screenshot, a delay time, browser cookie data, and a target screenshot size.
On the basis of the above embodiment, in the HTML page screenshot method provided in the embodiment of the present invention, the number of the HTML pages to be screenshot is one or more.
Specifically, in the embodiment of the invention, the number of the HTML pages to be subjected to screenshot can be one or more, and when the number of the HTML pages to be subjected to screenshot is more, batch screenshot of the HTML pages to be subjected to screenshot can be realized, and the generation time of the picture can be greatly shortened.
On the basis of the above embodiment, in the HTML page screenshot method provided in the embodiment of the present invention, the screenshot request parameter is obtained by transmitting the client to the API after determining the address of the API.
Specifically, in the embodiment of the present invention, before the client transmits the screenshot request to the server, the client may first obtain an address of an API of the server, then call a plug-in of a corresponding web request, and request the client by using a request method such as GET or POST, that is, send a screenshot request parameter to the API.
On the basis of the above embodiment, the HTML page screenshot method provided in the embodiment of the present invention is configured such that the ship position report HTML page is composed of pictures and tables, and the pictures include contents such as a map background, ship information, ship images, ship tracks, port-in history, berth snapshot, track lists, and the like. The purpose of the ship position report HTML page is to generate information and pictures related to a specified ship, and finally combine the information and pictures on the page for display or printing. The most complicated and complicated pictures in the HTML page for ship position report are mostly based on the behavior of the ship in the map background, and the sources of the pictures are all other ship position report pages. At this time, if a manual screenshot combination mode is adopted, the method is undoubtedly a huge project, because ship position reports of a plurality of ships need to be generated. Based on the above, the embodiment of the invention adopts a task mechanism to newly establish a conversion task, and generates and stores pictures in advance by taking the ship position report HTML page as the HTML page to be captured according to the ship and the date.
In some ship position pages, a large amount of data needs to be loaded and script actions need to be executed while a ship is in progress, the time for normally loading the page needs 1-3 seconds, and the size of a finally generated picture needs to be fixed, so that each task needs to be set for different pages when the system is called and executed.
Firstly, screenshot request parameters are obtained, and the screenshot request parameters include a website url (uniform resource locator) of an HTML page to be screenshot, a target screenshot size, delay time and the like.
And then starting a rendering engine and a JS engine, and loading the content of the HTML page to be captured. After the signals of loading the HTML page to be captured are obtained in the rendering engine and the JS engine, the GDI + plug-in is started to be called after the delay time according to the analyzed delay time, the HTML page to be captured in the JS engine is subjected to corresponding format conversion and drawing, and meanwhile corresponding drawing is performed according to the analyzed target capture size.
And after the drawing is successful, converting the generated picture into a picture stream and outputting the picture stream to the request client, and after the client acquires the response, performing corresponding storage operation. By executing the tasks, the ship position images of all parts are saved.
Therefore, when a final ship position report HTML page is manufactured, HTML elements of all parts of contents are laid out in advance, and related pictures are loaded on the page according to different request parameters in url. By using the HTML page screenshot method provided by the embodiment of the invention, the steps are repeated, the HTML page of the final ship position report is converted into the picture, and the client end finishes the request after receiving the picture. Thus, the embodiments of the present invention are realized.
As shown in fig. 5, on the basis of the above embodiment, an HTML page screenshot system provided in the embodiment of the present invention includes: a screenshot request parameter acquisition module 51 and a drawing feedback module 52. Wherein the content of the first and second substances,
the screenshot request parameter acquiring module 51 is configured to acquire a screenshot request parameter transmitted by a client based on an HTTP request application program interface API, where the screenshot request parameter includes a website of an HTML page to be screenshot;
and the drawing feedback module 52 is used for loading the HTML page to be captured from the website of the HTML page to be captured based on the rendering engine and the JS engine, drawing the HTML page to be captured into a picture, and feeding the picture back to the client.
On the basis of the above embodiment, in the HTML page screenshot system provided in the embodiment of the present invention, the screenshot request parameter further includes: a delay time;
correspondingly, the drawing feedback module is specifically configured to:
and after the HTML page to be subjected to screenshot is loaded and the delay time is passed, drawing the HTML page to be subjected to screenshot into a picture.
On the basis of the above embodiment, in the HTML page screenshot system provided in the embodiment of the present invention, the screenshot request parameter further includes: a target screenshot size;
correspondingly, the drawing feedback module is specifically configured to:
and drawing the HTML page to be subjected to screenshot into a picture based on the target screenshot size.
On the basis of the above embodiment, in the HTML page screenshot system provided in the embodiment of the present invention, the rendering feedback module is specifically configured to:
and drawing the HTML page to be captured into a picture by calling a GDI + plug-in.
On the basis of the above embodiment, in the HTML page screenshot system provided in the embodiment of the present invention, the screenshot request parameter further includes: and browser cookie data corresponding to the HTML page to be captured.
On the basis of the above embodiment, in the HTML page screenshot system provided in the embodiment of the present invention, the number of the HTML pages to be screenshot is one or more.
On the basis of the above embodiment, in the HTML page screenshot system provided in the embodiment of the present invention, the screenshot request parameter is obtained by transmitting the client to the API after determining the address of the API.
Fig. 6 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 6: a processor (processor)610, a communication Interface (Communications Interface)620, a memory (memory)630 and a communication bus 640, wherein the processor 610, the communication Interface 620 and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call logic instructions in the memory 630 to perform the HTML page screen shot method provided in the above embodiments, which includes: acquiring screenshot request parameters transmitted by a client based on an HTTP request Application Program Interface (API), wherein the screenshot request parameters comprise websites of HTML pages to be screenshot; and loading the HTML page to be captured from the website of the HTML page to be captured based on a rendering engine and a JS engine, drawing the HTML page to be captured into a picture, and feeding the picture back to the client.
In addition, the logic instructions in the memory 630 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) 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.
In another aspect, the present invention also provides 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, the computer is capable of executing the HTML page screenshot method provided in the above embodiments, the method comprising: acquiring screenshot request parameters transmitted by a client based on an HTTP request Application Program Interface (API), wherein the screenshot request parameters comprise websites of HTML pages to be screenshot; and loading the HTML page to be captured from the website of the HTML page to be captured based on a rendering engine and a JS engine, drawing the HTML page to be captured into a picture, and feeding the picture back to the client.
In yet another aspect, the present invention further provides a non-transitory computer readable storage medium, on which a computer program is stored, the computer program being implemented by a processor to perform the HTML page screenshot method provided in the above embodiments, the method including: acquiring screenshot request parameters transmitted by a client based on an HTTP request Application Program Interface (API), wherein the screenshot request parameters comprise websites of HTML pages to be screenshot; and loading the HTML page to be captured from the website of the HTML page to be captured based on a rendering engine and a JS engine, drawing the HTML page to be captured into a picture, and feeding the picture back to the client.
The above-described embodiments of the apparatus are merely illustrative, and the 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 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 examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. An HTML page screenshot method, comprising:
acquiring screenshot request parameters transmitted by a client based on an HTTP request Application Program Interface (API), wherein the screenshot request parameters comprise websites of HTML pages to be screenshot;
and loading the HTML page to be captured from the website of the HTML page to be captured based on a rendering engine and a JS engine, drawing the HTML page to be captured into a picture, and feeding the picture back to the client.
2. The method of screenshot in an HTML page of claim 1, wherein said screenshot request parameters further include: a delay time;
correspondingly, the drawing the HTML page to be captured into a picture specifically comprises the following steps:
and after the HTML page to be subjected to screenshot is loaded and the delay time is passed, drawing the HTML page to be subjected to screenshot into a picture.
3. The method of screenshot in an HTML page of claim 1, wherein said screenshot request parameters further include: a target screenshot size;
correspondingly, the drawing the HTML page to be captured into a picture specifically comprises the following steps:
and drawing the HTML page to be subjected to screenshot into a picture based on the target screenshot size.
4. The method for screenshot in an HTML page according to claim 1, wherein the step of rendering the HTML page to be screenshot into a picture specifically includes:
and drawing the HTML page to be captured into a picture by calling a GDI + plug-in.
5. The method of screenshot in an HTML page of claim 1, wherein said screenshot request parameters further include: and browser cookie data corresponding to the HTML page to be captured.
6. The method for screenshot in an HTML page according to any one of claims 1-5, wherein said number of HTML pages to be screenshot is one or more.
7. The method for screenshot in an HTML page as recited in any one of claims 1-5, wherein said screenshot request parameter is transmitted by said client to said API after determining an address of said API.
8. An HTML page screenshot system, comprising:
the system comprises a screenshot request parameter acquisition module, a screenshot request parameter acquisition module and a screenshot request parameter acquisition module, wherein the screenshot request parameter acquisition module is used for acquiring a screenshot request parameter transmitted by a client based on an HTTP request Application Program Interface (API), and the screenshot request parameter comprises a website of an HTML page to be screenshot;
and the drawing feedback module is used for loading the HTML page to be subjected to screenshot from the website of the HTML page to be subjected to screenshot based on the rendering engine and the JS engine, drawing the HTML page to be subjected to screenshot into a picture, and feeding the picture back to the client.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the HTML page screenshot method of any one of claims 1 to 7 when executing the program.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the steps of the HTML page screenshot method of any one of claims 1 to 7.
CN202110276422.1A 2021-03-15 2021-03-15 HTML page screenshot method and system Pending CN112948737A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110276422.1A CN112948737A (en) 2021-03-15 2021-03-15 HTML page screenshot method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110276422.1A CN112948737A (en) 2021-03-15 2021-03-15 HTML page screenshot method and system

Publications (1)

Publication Number Publication Date
CN112948737A true CN112948737A (en) 2021-06-11

Family

ID=76229928

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110276422.1A Pending CN112948737A (en) 2021-03-15 2021-03-15 HTML page screenshot method and system

Country Status (1)

Country Link
CN (1) CN112948737A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101071438A (en) * 2007-03-26 2007-11-14 腾讯科技(深圳)有限公司 Capture server, distribution server, method and system for generating webpage capture
CN106406851A (en) * 2016-08-24 2017-02-15 北京松鼠山科技有限公司 Webpage image capture method and system
CN109491744A (en) * 2018-11-06 2019-03-19 成都知道创宇信息技术有限公司 A kind of webpage capture system and method
CN110704784A (en) * 2019-10-10 2020-01-17 深圳前海微众银行股份有限公司 Web page screen capturing method, device, equipment and computer readable storage medium
CN111814086A (en) * 2020-07-13 2020-10-23 杭州数澜科技有限公司 Method and system for screenshot of webpage
CN112347244A (en) * 2019-08-08 2021-02-09 四川大学 Method for detecting website involved in yellow and gambling based on mixed feature analysis

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101071438A (en) * 2007-03-26 2007-11-14 腾讯科技(深圳)有限公司 Capture server, distribution server, method and system for generating webpage capture
CN106406851A (en) * 2016-08-24 2017-02-15 北京松鼠山科技有限公司 Webpage image capture method and system
CN109491744A (en) * 2018-11-06 2019-03-19 成都知道创宇信息技术有限公司 A kind of webpage capture system and method
CN112347244A (en) * 2019-08-08 2021-02-09 四川大学 Method for detecting website involved in yellow and gambling based on mixed feature analysis
CN110704784A (en) * 2019-10-10 2020-01-17 深圳前海微众银行股份有限公司 Web page screen capturing method, device, equipment and computer readable storage medium
CN111814086A (en) * 2020-07-13 2020-10-23 杭州数澜科技有限公司 Method and system for screenshot of webpage

Similar Documents

Publication Publication Date Title
US8549395B2 (en) Method and system for transforming an integrated webpage
US11144711B2 (en) Webpage rendering method, device, electronic apparatus and storage medium
CN107133180B (en) Dynamic page testing method, testing device and storage medium
CN107766359B (en) Method and device for converting page content into picture and computing equipment
US8245125B1 (en) Hybrid rendering for webpages
US20110202854A1 (en) Metadata Capture for Screen Sharing
US20070061700A1 (en) Initial server-side content rendering for client-script web pages
CN104657499A (en) Webpage loading method and device of client-side APP (Application)
CN108416021B (en) Browser webpage content processing method and device, electronic equipment and readable medium
CN113382083B (en) Webpage screenshot method and device
CN106874271A (en) A kind of method and system that PC webpages are converted to mobile terminal webpage
CN111880790A (en) Page rendering method, page rendering system, and computer-readable storage medium
CN111880788A (en) Page rendering method, device, client and computer readable storage medium
CN111737614B (en) Page display method, page display device, electronic equipment and storage medium
JP5604016B1 (en) Script caching method and information processing apparatus using the same
CN114297544A (en) Remote browsing method, device, equipment and storage medium
CN113094612A (en) Method and device for loading webpage at client, electronic equipment and medium
CN111880789A (en) Page rendering method, device, server and computer-readable storage medium
CN110738024A (en) Method for converting WebAPP into API service interface
CN115878226A (en) H5 offline package loading method and device
CN112948737A (en) HTML page screenshot method and system
CN111338928A (en) Chrome-based browser testing method and device
US8793342B2 (en) Interpreting web application content
CN113626392A (en) Method and device for updating document data, electronic equipment and storage medium
CN112287261A (en) Resource loading method and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination