Web Page Screenshot Method, Device, Equipment and Computer Readable Storage Medium

By obtaining page identification information and calculating the actual size, and rendering the page according to the scaling ratio set by the user, the problem that screenshot images in the prior art do not meet user needs is solved, and flexible screenshot images are generated.

CN110704784BActive Publication Date: 2025-07-11WEBANK (CHINA)
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN201910959926.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-10-10
Publication Date
2025-07-11
Estimated Expiration
2039-10-10

AI Technical Summary

Technical Problem

In the prior art, the web page screenshot operation cannot adjust the size of the screenshot image according to user needs, resulting in the screenshot image not meeting the actual needs of users.

Method used

By obtaining the page information corresponding to the page identification, calculating the actual size, and rendering the page according to the scaling ratio set by the user, generating a screenshot image that meets the user's needs.

Benefits of technology

It realizes the generation of screenshot images that meet the actual size according to user needs, improving the flexibility and user experience of screenshot operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110704784B_ABST
    Figure CN110704784B_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of financial technology (Fintech). The present invention discloses a method for taking a screenshot of a web page. The method includes: when receiving a screenshot request for a web page, obtaining a page identifier corresponding to the screenshot request for the web page and loading page information corresponding to the page identifier; when the page information corresponding to the page identifier is loaded, calculating an actual size of the web page corresponding to the page identifier according to the page information; and performing page rendering according to the actual size and a scaling ratio corresponding to the screenshot request for the web page to generate a screenshot image. The present invention also discloses a device, a device and a computer-readable storage medium for taking a screenshot of a web page. The present invention generates a screenshot image according to the scaling ratio corresponding to the screenshot request, so that the screenshot image meets the needs of users.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of financial technology (Fintech), and particularly to a method, apparatus, device, and computer-readable storage medium for web page screenshotting. Background Art

[0002] With the rapid development of Internet technology, especially Internet financial technology (Fintech), more and more technologies (big data, distributed, blockchain, artificial intelligence, etc.) are applied in the financial field.

[0003] The financial web page information has grown explosively. When users view the web page corresponding to finance, they usually perform a screenshot operation on the web page. The current screenshot operation of the web page is taken according to the screen size. For example, if the screen size is 1920*3000, the user can only capture a maximum of 1920*3000 of the screen. If the page size of the web page is larger than 1920*3000, only a part can be captured; if the user needs to capture a partial area smaller than 1920*3000 in the web page to be captured, prominent screenshot display cannot be performed either. That is to say, the current screenshot image of the web page does not meet the user's needs. Summary of the Invention

[0004] The main purpose of the present invention is to propose a method, apparatus, device, and computer-readable storage medium for web page screenshotting, aiming to solve the technical problem that the current web page screenshot image does not meet the user's needs.

[0005] To achieve the above object, the present invention provides a method for web page screenshotting, and the method for web page screenshotting includes the following steps:

[0006] When receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request, and load the page information corresponding to the page identifier;

[0007] When the page information corresponding to the page identifier is loaded, calculate the actual size of the web page corresponding to the page identifier according to the page information;

[0008] Render the page according to the actual size and the zoom ratio corresponding to the web page screenshot request to generate a screenshot image.

[0009] In one embodiment, the step of when receiving a web page screenshot request, obtaining the page identifier corresponding to the web page screenshot request, and loading the page information corresponding to the page identifier includes:

[0010] When receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request, and determine the page code corresponding to the page identifier;

[0011] Add an html element with a preset element identifier to the page code, and save the page code and the html element as associated page information;

[0012] When receiving a page loading request, load the page information corresponding to the page identifier, and determine whether there is an html element with a preset element identifier in the loaded page information;

[0013] If there is no html element with a preset element identifier in the loaded page information, it is determined that the page information corresponding to the page identifier has not been loaded completely;

[0014] If there is an html element with a preset element identifier in the loaded page information, it is determined that the page information corresponding to the page identifier has been loaded completely.

[0015] In one embodiment, the step of calculating the actual size of the web page corresponding to the page identifier according to the page information when the page information corresponding to the page identifier is loaded completely includes:

[0016] When the page information corresponding to the page identifier is loaded completely, obtain the html element with a preset element identifier in the page information;

[0017] Starting from the html element, calculate the total size of the sibling elements adjacent to the html element, and use the total size of the elements as the actual size of the web page corresponding to the page identifier.

[0018] In one embodiment, before the step of rendering the page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image, it includes:

[0019] Output a ratio setting prompt for the user to set the scaling ratio of the screenshot image based on the ratio setting prompt;

[0020] Obtain the scaling ratio input based on the ratio setting prompt, and use the scaling ratio as the scaling ratio corresponding to the web page screenshot request;

[0021] The step of rendering the page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image includes:

[0022] Calculate the product of the actual size and the scaling ratio, use the product as the display size, and render the page according to the display size to generate a screenshot image.

[0023] In one embodiment, after the step of rendering a page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image, the following steps are included:

[0024] When receiving a screenshot image sharing instruction, obtain the user identifier corresponding to the screenshot image sharing instruction;

[0025] Save the screenshot image to a target path, generate link information corresponding to the target path, and send the link information to the client corresponding to the user identifier.

[0026] In one embodiment, after the step of rendering a page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image, the following steps are included:

[0027] When receiving an email sending request triggered by the screenshot image, obtain the recipient identifier corresponding to the email sending request;

[0028] Add the screenshot image to the email interface corresponding to the email sending request, generate an email containing the screenshot image, and send it to the client corresponding to the recipient identifier.

[0029] In one embodiment, before the step of, when receiving a web page screenshot request, obtaining the page identifier corresponding to the web page screenshot request and loading the page information corresponding to the page identifier, the following steps are included:

[0030] When receiving an image adding request triggered by the email interface, obtain the page identifier corresponding to the image adding request, and trigger a web page screenshot request based on the page identifier;

[0031] After the step of, when the page information corresponding to the page identifier is loaded, calculating the actual size of the web page corresponding to the page identifier according to the page information, the following steps are included:

[0032] Obtain the interface size of the email interface, calculate the ratio of the interface size to the actual size, and use the ratio as the scaling ratio corresponding to the web page screenshot request;

[0033] Render the page according to the actual size and the scaling ratio corresponding to the web page screenshot request;

[0034] Add the screenshot image to the email interface, generate an email containing the screenshot image, and send it.

[0035] In addition, to achieve the above object, the present invention further provides a web page screenshot device, and the web page screenshot device includes:

[0036] A request receiving module, configured to obtain a page identifier corresponding to the web page screenshot request and load page information corresponding to the page identifier when receiving a web page screenshot request;

[0037] A size calculation module, configured to calculate an actual size of the web page corresponding to the page identifier according to the page information when the page information corresponding to the page identifier is loaded;

[0038] An image generation module, configured to perform page rendering according to the actual size and a scaling ratio corresponding to the web page screenshot request to generate a screenshot image.

[0039] In addition, to achieve the above object, the present invention further provides a web page screenshot device, where the web page screenshot device includes: a memory, a processor, and a web page screenshot program stored on the memory and executable on the processor, and when the web page screenshot program is executed by the processor, the steps of the above web page screenshot method are implemented.

[0040] In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, where a web page screenshot program is stored on the computer-readable storage medium, and when the web page screenshot program is executed by a processor, the steps of the above web page screenshot method are implemented.

[0041] The present invention provides a web page screenshot method, device, device, and computer-readable storage medium. In an embodiment of the present invention, when a web page screenshot request is received, a page identifier corresponding to the web page screenshot request is obtained, and page information corresponding to the page identifier is loaded; when the page information corresponding to the page identifier is loaded, an actual size of the web page corresponding to the page identifier is calculated according to the page information; page rendering is performed according to the actual size and a scaling ratio corresponding to the web page screenshot request to generate a screenshot image. In the embodiment of the present invention, the web page screenshot device generates a screenshot image according to the scaling ratio corresponding to the screenshot request, so that the screenshot image meets the user's requirements. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present invention;

[0043] Figure 2 is a schematic flowchart of the first embodiment of the web page screenshot method of the present invention;

[0044] Figure 3 is a schematic diagram of a specific scenario of the first embodiment of the web page screenshot method of the present invention;

[0045] Figure 4 It is a schematic flowchart of the second embodiment of the web page screenshot method of the present invention;

[0046] Figure 5 It is a schematic diagram of functional modules of an embodiment of the web page screenshot device of the present invention.

[0047] The implementation, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Specific Embodiments

[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0049] As shown in Figure 1 shown, Figure 1 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment solution of the present invention.

[0050] The web page screenshot device in the embodiment of the present invention may be a PC or a server.

[0051] As shown in Figure 1 shown, the web page screenshot device may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0052] Those skilled in the art can understand that Figure 1 the device structure shown in

[0053] does not constitute a limitation on the device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange different components. Figure 1 shown, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a web page screenshot program.

[0054] In Figure 1In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user side) and communicate data with the client; and the processor 1001 can be used to call the web page screenshot program stored in the memory 1005 and execute the operations in the following web page screenshot method. The method implemented when the web page screenshot program running on the processor is executed can refer to the various embodiments of the web page screenshot method of the present invention, which will not be elaborated here.

[0055] Based on the above hardware structure, an embodiment of the web page screenshot method of the present invention is proposed.

[0056] Referring to Figure 2 , Figure 2 is a schematic flowchart of the first embodiment of the web page screenshot method of the present invention. The web page screenshot method includes:

[0057] Step S10, when receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request and load the page information corresponding to the page identifier.

[0058] In this embodiment, the web page screenshot method is applied to a web page screenshot device. The web page screenshot device receives a web page screenshot request, and the triggering method of the web page screenshot request is not specifically limited. That is, the web page screenshot request can be actively triggered by the user. For example, the user clicks the screenshot icon on the display interface corresponding to the web page screenshot device, and the web page screenshot device obtains the page identifier corresponding to the current display interface (the page identifier refers to the identification information for identifying the web page. For example, the page identifier is the page address information), and triggers the web page screenshot request based on this page identifier; in addition, the web page screenshot request can also be automatically triggered by the web page screenshot device. For example, a web page screenshot condition is preset in the web page screenshot device: automatically perform web page screenshot every day at midnight. When the web page screenshot device reaches midnight, it automatically triggers the web page screenshot request.

[0059] When the web page screenshot device receives a web page screenshot request, the web page screenshot device obtains the page identifier corresponding to the web page screenshot request, and the web page screenshot device loads the page information corresponding to the page identifier. For example, if the page identifier is the page address information, the web page screenshot device queries the preset page code library to obtain the page information corresponding to the page address information to complete the loading of the page information corresponding to the page identifier.

[0060] Step S20, when the page information corresponding to the page identifier is loaded, calculate the actual size of the web page corresponding to the page identifier according to the page information.

[0061] The web page screenshot device detects the loading status of the page information corresponding to the page identifier, and determines whether the page information corresponding to the page identifier has been loaded completely. In this embodiment, the web page screenshot device can determine whether the page information corresponding to the page identifier has been loaded completely in different ways. Specifically:

[0062] Implementation method 1: A preset duration is set in the web page screenshot device. The preset duration can be set according to the network environment where the web page screenshot device is located, and the preset duration can also be set according to the amount of information of the page information. For example, the preset duration is set to 10 minutes. That is, when the web page screenshot device detects that the loading duration of the page information reaches the preset duration, the web page screenshot device determines that the page information corresponding to the page identifier has been loaded completely.

[0063] Implementation method 2: The web page screenshot device adds a completion mark to the page code corresponding to the page identifier. The web page screenshot device obtains the loaded page information. If the loaded page information does not contain the completion mark, the web page screenshot device determines that the page information corresponding to the page identifier has not been loaded completely; if the loaded page information contains the completion mark, the web page screenshot device determines that the page information corresponding to the page identifier has been loaded completely.

[0064] In the above implementation methods of this embodiment, in implementation method 1, setting a preset duration to determine whether the page information has been loaded completely does not require the web page screenshot device to perform detection operations, but the waiting time for the preset time is relatively long; in implementation method 2, detecting whether the completion mark is included in the page information can quickly identify whether the page information has been loaded completely, but the web page screenshot device needs to perform detection operations. When actually judging the loading of page information, the user selects a more reasonable method according to the scenario.

[0065] When the web page screenshot device detects that the page information corresponding to the page identifier has been loaded completely, the web page screenshot device calculates the actual size of the web page corresponding to the page identifier according to the loaded page information. That is, the web page screenshot device parses the page information, obtains the image elements included in the page information, and the arrangement manner of each image element. The web page screenshot device calculates the actual size of the web page corresponding to the page identifier according to the arrangement manner of each image element and the size of each image element.

[0066] For example, a web page contains 4 image elements, namely image element 1 (10 cm in length and 5 cm in height), image element 2 (6 cm in length and 3 cm in height), image element 3 (12 cm in length and 9 cm in height), and image element 4 (15 cm in length and 10 cm in height). Image element 1 and image element 2 are arranged side by side horizontally, image element 3 is below image element 1 and image element 2, and image element 4 is below image element 3. Therefore, the actual size of the web page is: 16 cm in length (the maximum value among 16 (10 + 6), 12, and 15), and 24 cm in height (24 = 5 (3) + 9 + 10).

[0067] In this embodiment, when the web page screenshot device finishes loading the page information, the web page screenshot device calculates the actual size of the web page according to the page information. At this time, if the user does not set the size information of the screenshot image, the web page screenshot device renders and generates a screenshot image corresponding to the actual size according to the page information, that is, the web page screenshot device renders a complete screenshot of the web page corresponding to the page identifier in proportion.

[0068] In addition, if the user sets the size information of the screenshot image, the web page screenshot device performs a screenshot operation according to the size information set by the user. Specifically:

[0069] Step S30, perform page rendering according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image.

[0070] The web page screenshot device obtains the scaling ratio corresponding to the web page screenshot request. The web page screenshot device multiplies the actual size by the scaling ratio to obtain the display size of the screenshot image. The web page screenshot device performs page rendering according to the display size to generate a screenshot image. Specifically, before step S30, it further includes:

[0071] Step a1, output a ratio setting prompt for the user to set the scaling ratio of the screenshot image based on the ratio setting prompt;

[0072] Step a2, obtain the scaling ratio input based on the ratio setting prompt, and use the scaling ratio as the scaling ratio corresponding to the web page screenshot request.

[0073] The web page screenshot device outputs a ratio setting prompt for the user to set the scaling ratio of the screenshot image based on the ratio setting prompt. It can be understood that the output time, output method, and specific content of the ratio setting prompt are not limited. That is, the output time of the ratio setting prompt can be: after receiving the web page screenshot request, or after the page information corresponding to the page identifier is loaded; the output method of the ratio setting prompt: it can be voice information, or a pop-up window prompt.

[0074] The web page screenshot device obtains the scaling ratio set for prompt input based on the ratio. The web page screenshot device uses the scaling ratio input by the user as the scaling ratio corresponding to the web page screenshot request, so that the web page screenshot device renders the page according to the scaling ratio to generate a screenshot image. That is, the web page screenshot device calculates the product of the actual size and the scaling ratio as the display size of the screenshot image, and the web page screenshot device performs page rendering according to the display size to generate a screenshot image.

[0075] For example, referring to Figure 3 , when the user selects the scaling method as "actual size" on the web page, the web page screenshot device accurately displays and generates a screenshot image according to the actual size on the web page. If the user selects a scaling ratio of 0.8 (indicating scaling to 0.8 times the size of the original component) on the web page, the web page screenshot device accurately displays and generates a screenshot image according to the actual size * scaling ratio on the web page. In this embodiment, by setting the scaling ratio of the screenshot image, the web page screenshot device generates a screenshot image according to the scaling ratio corresponding to the screenshot request, making the screenshot image meet the user's needs and facilitating the user to adjust the layout of the web page so that the content can adapt to the overall size.

[0076] It can be understood that the web page screenshot device also supports the user to directly set the display size of the screenshot image, so that the web page screenshot device performs page rendering according to the display size to generate a screenshot image.

[0077] Further, referring to Figure 4 , based on the first embodiment of the web page screenshot method of the present invention, a second embodiment of the web page screenshot method of the present invention is proposed.

[0078] This embodiment is a refinement step of step S10 in the first embodiment. In this embodiment, a specific implementation method for determining whether the page information is loaded is given, including:

[0079] Step S11, when receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request, and determine the page code corresponding to the page identifier.

[0080] When the web page screenshot device receives a web page screenshot request, the web page screenshot device obtains the page identifier corresponding to the web page screenshot request, and the web page screenshot device queries the code database to determine the page code corresponding to the page identifier in the code database.

[0081] Step S12, add an html element with a preset element identifier to the page code, and save the page code and the html element as associated page information.

[0082] The web page screenshot device adds an HTML element with a preset element identifier to the page code. The web page screenshot device takes the page code and the added HTML element as page information. The web page screenshot device establishes an association relationship between the page code and the added HTML element. The web page screenshot device takes the mutually associated page code and HTML element as page information and saves it to the code database.

[0083] Step S13, when receiving a page loading request, load the page information corresponding to the page identifier, and determine whether there is an HTML element with a preset element identifier in the loaded page information.

[0084] When the web page screenshot device receives a page loading request, the web page screenshot device loads the page information corresponding to the page identifier from the code database. The web page screenshot device real-time determines whether there is an HTML element with a preset element identifier in the loaded page information, where the preset element identifier refers to a pre-set element identifier, for example, the preset element identifier is phantomRenderSign.

[0085] Step S14, if there is no HTML element with a preset element identifier in the loaded page information, it is determined that the page information corresponding to the page identifier has not been loaded completely.

[0086] If there is no HTML element with a preset element identifier in the loaded page information, the web page screenshot device determines that the page information corresponding to the page identifier has not been loaded completely, and the web page screenshot device continues to load.

[0087] Step S15, if there is an HTML element with a preset element identifier in the loaded page information, it is determined that the page information corresponding to the page identifier has been loaded completely.

[0088] If there is an HTML element with a preset element identifier in the loaded page information, the web page screenshot device determines that the page information corresponding to the page identifier has been loaded completely, so that the web page screenshot device calculates the actual size of the web page corresponding to the page identifier according to the loaded page information.

[0089] In this embodiment, the web page screenshot device adds an HTML element with a preset element identifier to the page code. When the page information is loaded completely, this HTML element will be generated. When the web page screenshot device detects this HTML element, it can determine that the page information has been loaded completely. With this judgment basis, when the web page screenshot device loads the page information, it does not need to wait for a long time, shortening the loading time of the page information, and further improving the screenshot efficiency of the web page screenshot device.

[0090] That is, there is no way to determine when the data has finished loading during the current web page information loading. Therefore, it is necessary to set a waiting time for data loading. After multiple tests, about 10 minutes is a safe time. The data will definitely have finished loading in 10 minutes. However, this means that when taking a screenshot of the web page, it is necessary to wait for 10 minutes before proceeding with the next screenshot operation. This time can also be set shorter, but there will be risks. There may be a situation where the data has not finished loading when generating the preview image, resulting in an empty page. In this embodiment, the method of adding an html element with a preset element identifier to the page code is used. This html element will be generated when the data has finished loading. As long as this element is detected, it can be determined that the data has finished loading. With this basis for judgment, the preview image can be generated immediately after this element appears, without the need to wait for 10 minutes anymore, greatly improving the efficiency.

[0091] Furthermore, based on the second embodiment of the web page screenshot method of the present invention, a third embodiment of the web page screenshot method of the present invention is proposed.

[0092] This embodiment is a refinement of step S20 in the first embodiment. In this embodiment, a specific implementation method for calculating the actual size of the web page is given, including:

[0093] When the page information corresponding to the page identifier has finished loading, obtain the html element with the preset element identifier in the page information;

[0094] Starting from the html element, calculate the total element size of the sibling elements adjacent to the html element, and use the total element size as the actual size of the web page corresponding to the page identifier.

[0095] That is, when the page information has finished loading, the web page screenshot device obtains the html element with the preset element identifier in the page information; the web page screenshot device starts from the html element with the preset element identifier, the web page screenshot device obtains the sibling elements adjacent to the html element and the element sizes of each sibling element, the web page screenshot device accumulates the element sizes of each element to obtain the total element size, and the web page screenshot device uses the total element size as the actual size of the web page corresponding to the page identifier.

[0096] For example, the web page screenshot device starts from the html element to calculate the maximum width and height of the sibling elements adjacent to the html element, and obtains the actual size of the web page. It can be understood that if there is no such phantomRenderSign element in the page information, the web page screenshot device can only perform the screenshot operation based on the default screen size. The disadvantage of this screenshot method is that there are many blank parts in the web page, and the size of the information with substantial content may be much smaller than the screen size. Then, after generating the screenshot image, there will be a large blank area, which affects the display effect; or when the actual size of the web page is larger than the screen size of the web page screenshot device, the extra content cannot be fully displayed.

[0097] In this embodiment, the web page screenshot device quickly calculates the actual size of the web page according to the html element with the preset element identifier in the page information, so that the web page screenshot device can perform the screenshot operation according to the calculated actual size.

[0098] Further, based on the above embodiments of the web page screenshot method of the present invention, a fourth embodiment of the web page screenshot method of the present invention is proposed.

[0099] This embodiment is the step after step S30 in the first embodiment. The difference between this embodiment and the above embodiments is that:

[0100] When receiving the screenshot image sharing instruction, obtain the user identifier corresponding to the screenshot image sharing instruction;

[0101] Save the screenshot image to the target path, generate the link information corresponding to the target path, and send the link information to the client corresponding to the user identifier.

[0102] The web page screenshot device receives the screenshot sharing instruction. The triggering method of the screenshot sharing instruction is not specifically limited. When the web page screenshot device receives the screenshot image sharing instruction, the web page screenshot device obtains the user identifier corresponding to the screenshot image sharing instruction. The user identifier refers to the identification information of the user. For example, the user account in the instant messaging software.

[0103] The web page screenshot device calls the preset data storage interface, saves the screenshot image to the target path through the preset data storage interface, generates the link information corresponding to the target path by the web page screenshot device, and sends the link information to the client corresponding to the user identifier, so that the user can determine the target path through the link information to view the screenshot image.

[0104] In this embodiment, the web page screenshot device saves the screenshot image to a target path through a preset data storage interface and generates link information for the target path, enabling the user to access the target path through the link information to obtain the screenshot image, which facilitates user operation. It can be understood that the web page screenshot device can also directly send the screenshot image to the client corresponding to the user identifier for the user to view the screenshot image.

[0105] Further, based on the above embodiments of the web page screenshot method of the present invention, a fifth embodiment of the web page screenshot method of the present invention is proposed.

[0106] This embodiment is the step after step S30 in the first embodiment. The difference between this embodiment and the above embodiments is that:

[0107] When receiving a mail sending request triggered by the screenshot image, obtain the recipient identifier corresponding to the mail sending request;

[0108] Add the screenshot image to the mail interface corresponding to the mail sending request, generate a mail containing the screenshot image, and send it to the client corresponding to the recipient identifier.

[0109] That is, when the web page screenshot device receives a mail sending request triggered by the screenshot image, the web page screenshot device obtains the recipient identifier corresponding to the mail sending request (the recipient identifier refers to the recipient's email account information); the web page screenshot device adds the screenshot image to the mail interface corresponding to the mail sending request, generates a mail containing the screenshot image, and the web page screenshot device sends the mail containing the screenshot image to the client corresponding to the recipient identifier for the recipient to view.

[0110] In this embodiment, after the screenshot is completed, the web page screenshot device sends the screenshot image obtained by the screenshot as the mail content to the client, which is convenient for the recipient to view the screenshot image.

[0111] In addition, this embodiment can also be combined with the fourth embodiment of the present invention. When the web page screenshot device receives a mail sending request triggered by the screenshot image, the web page screenshot device saves the screenshot image to a target path and generates link information corresponding to the target path. The web page screenshot device sends the link information as a mail to the client corresponding to the recipient identifier.

[0112] Further, based on the above embodiments of the web page screenshot method of the present invention, a sixth embodiment of the web page screenshot method of the present invention is proposed.

[0113] In this embodiment, it mainly targets the screenshot image of email sending. The difference between this embodiment and the fifth embodiment is that in the fifth embodiment, the user takes a screenshot on the web page to obtain the screenshot image, and the user triggers the email operation based on the screenshot image, and the web page screenshot device sends the obtained screenshot image as the email content; while in this embodiment, the user triggers the screenshot request on the email interface, and the web page screenshot device performs the screenshot operation according to the email interface information. Specifically, it includes:

[0114] When receiving an image addition request triggered based on the email interface, obtain the page identifier corresponding to the image addition request, and trigger a web page screenshot request based on the page identifier.

[0115] The user opens the email application program on the web page screenshot device. The type of the email application program is not limited. That is, the email application program can be Outlook, foxmail, the iOS / Android clients of common version models, enterprise WeChat, the web version, etc. The email interface is displayed on the display interface of the web page screenshot device. The user triggers the image addition request on the email interface, and the triggering method is not specifically limited; when the web page screenshot device receives an image addition request triggered based on the email interface, the web page screenshot device obtains the page identifier corresponding to the image addition request.

[0116] After the web page screenshot device obtains the page identifier, it triggers a web page screenshot request based on the page identifier. That is, the web page screenshot device queries the web page corresponding to the page identifier and jumps to the web page to trigger the web page screenshot request.

[0117] When receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request, and load the page information corresponding to the page identifier.

[0118] When the web page screenshot device receives a web page screenshot request triggered based on the page identifier, the web page screenshot device loads the page information corresponding to the page identifier; for example, if the page identifier is the page address information, the web page screenshot device queries the preset page code library to obtain the page information corresponding to the page address information to complete the loading of the page information corresponding to the page identifier.

[0119] When the page information corresponding to the page identifier is loaded, calculate the actual size of the web page corresponding to the page identifier according to the page information;

[0120] Obtain the interface size of the email interface, calculate the ratio of the interface size to the actual size, and use the ratio as the scaling ratio corresponding to the web page screenshot request;

[0121] Render the page according to the actual size and the scaling ratio corresponding to the web page screenshot request;

[0122] Add the screenshot image to the mail interface, generate a mail containing the screenshot image and send it.

[0123] That is, when the page information corresponding to the page identifier is loaded on the web page screenshot device, the web page screenshot device calculates the actual size of the web page corresponding to the page identifier according to the page information; the web page screenshot device obtains the interface size of the mail interface and calculates the ratio of the interface size to the actual size. The web page screenshot device uses the ratio as the scaling ratio corresponding to the web page screenshot request. The web page screenshot device renders the page according to the actual size and the scaling ratio corresponding to the web page screenshot request; add the screenshot image to the mail interface, generate a mail containing the screenshot image and send it.

[0124] The current mail system usually can only add pre - saved screenshot images. In this embodiment, it is possible to jump from the mail interface to the web page in real time and capture a screenshot image adapted to the mail interface from the web page. Such an operation method makes the user's operation more convenient, and at the same time, the screenshot image can be displayed well on the mail interface.

[0125] In addition, it can be understood that in this embodiment, when the page information is loaded, it is not necessary to calculate the ratio between the interface size and the actual size to determine the scaling ratio, and the screenshot image can be directly rendered according to the interface size of the mail interface. Specifically:

[0126] When the page information corresponding to the page identifier is loaded, obtain the interface size of the mail interface.

[0127] The web page screenshot device detects the loading status of the page information of the page identifier in real time to determine whether the page information corresponding to the page identifier has been loaded. When the web page screenshot device detects that the page information corresponding to the page identifier has been loaded, the web page screenshot device obtains the interface size of the mail interface.

[0128] Render the page according to the interface size, generate a screenshot image, add the screenshot image to the mail interface, generate a mail containing the screenshot image and send it.

[0129] The web page screenshot device renders the page according to the interface size, generates a screenshot image. The web page screenshot device adds the captured screenshot image to the mail interface, generates a mail containing the screenshot image and sends it; specifically:

[0130] The web page screenshot device uses the HTML email format and uses the table tag to control the content layout of the email (because if the table tag is not used, there will be a problem that the content cannot be continuously displayed on some mobile clients). For the height and width of different screenshot images, the web page screenshot device also makes processing. For example, when the actual size of the screenshot image is larger than the interface size, the web page screenshot device calculates how many integer multiples (rounded up) the current actual size is of the interface size, and then the web page screenshot device equally divides the screenshot image into that many pieces. This can adapt to the screenshot size where the actual size is larger than the interface size, enabling the screenshot image to have a friendly display in the email and avoiding problems such as truncation or misalignment caused by the overly large screenshot image; also avoiding problems such as in the Outlook email, when the actual size of the screenshot image is larger than the interface size, the screenshot image will be directly truncated and the excess part will not be displayed. In this embodiment, web page screenshots are taken according to the interface size of the email, so that the screenshot images are adapted to multiple email systems, ensuring that the emails corresponding to the screenshot images can be well displayed on multiple email systems.

[0131] Reference Figure 5 , the embodiment of the present invention also provides a web page screenshot device, and the web page screenshot device includes:

[0132] A request receiving module 10, configured to obtain the page identifier corresponding to the web page screenshot request and load the page information corresponding to the page identifier when receiving the web page screenshot request;

[0133] A size calculation module 20, configured to calculate the actual size of the web page corresponding to the page identifier according to the page information when the page information corresponding to the page identifier is loaded;

[0134] An image generation module 30, configured to perform page rendering according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image.

[0135] In an embodiment, the request receiving module 10 includes:

[0136] A code acquisition unit, configured to obtain the page identifier corresponding to the web page screenshot request and determine the page code corresponding to the page identifier when receiving the web page screenshot request;

[0137] An element addition unit, configured to add an HTML element with a preset element identifier to the page code, and save the page code and the HTML element as associated page information;

[0138] A loading judgment unit, configured to load page information corresponding to the page identifier when receiving a page loading request, and judge whether there is an html element with a preset element identifier in the loaded page information;

[0139] A first determination unit, configured to determine that the page information corresponding to the page identifier has not been loaded completely if there is no html element with a preset element identifier in the loaded page information;

[0140] A second determination unit, configured to determine that the page information corresponding to the page identifier has been loaded completely if there is an html element with a preset element identifier in the loaded page information.

[0141] In one embodiment, the size calculation module 20 includes:

[0142] An element acquisition unit, configured to acquire an html element with a preset element identifier in the page information when the page information corresponding to the page identifier is loaded completely;

[0143] A size calculation unit, configured to calculate the total size of sibling elements adjacent to the html element starting from the html element, and use the total size of the elements as the actual size of the web page corresponding to the page identifier.

[0144] In one embodiment, the web page screenshot device includes:

[0145] A window output module, configured to output a ratio setting prompt for a user to set a zoom ratio of a screenshot image based on the ratio setting prompt;

[0146] A ratio acquisition module, configured to acquire the zoom ratio input based on the ratio setting prompt, and use the zoom ratio as the zoom ratio corresponding to the web page screenshot request;

[0147] The image generation module 30 is further configured to calculate a product of the actual size and the zoom ratio, use the product as a display size, and perform page rendering according to the display size to generate a screenshot image.

[0148] In one embodiment, the web page screenshot device includes:

[0149] An instruction receiving module, configured to acquire a user identifier corresponding to the screenshot image sharing instruction when receiving the screenshot image sharing instruction;

[0150] A link generation module, configured to save the screenshot image to a target path, generate link information corresponding to the target path, and send the link information to a client corresponding to the user identifier.

[0151] In one embodiment, the web page screenshot device includes:

[0152] An identification acquisition module, configured to acquire the recipient identification corresponding to the mail sending request when receiving a mail sending request triggered based on the screenshot image;

[0153] A mail sending module, configured to add the screenshot image to the mail interface corresponding to the mail sending request, generate a mail containing the screenshot image, and send it to the client corresponding to the recipient identification.

[0154] In one embodiment, the web page screenshot device includes:

[0155] An image addition module, configured to acquire the page identification corresponding to the image addition request when receiving an image addition request triggered based on the mail interface, and trigger a web page screenshot request based on the page identification;

[0156] An acquisition and calculation module, configured to acquire the interface size of the mail interface, calculate the ratio of the interface size to the actual size, and use the ratio as the scaling ratio corresponding to the web page screenshot request;

[0157] An image generation module, configured to perform page rendering according to the actual size and the scaling ratio corresponding to the web page screenshot request;

[0158] An image sending module, configured to add the screenshot image to the mail interface, generate a mail containing the screenshot image, and send it.

[0159] The methods executed by the above program modules can refer to the various embodiments of the web page screenshot method of the present invention, which will not be elaborated herein.

[0160] It should be noted that in this article, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or system including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or system including that element.

[0161] The serial numbers of the above embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.

[0162] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-described example methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium as described above (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to enable a server device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in various embodiments of the present invention.

[0163] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.

Claims

1. A method for web page screenshot, characterized in that, The web page screenshot method includes the following steps: When receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request, and load the page information corresponding to the page identifier; When the page information corresponding to the page identifier is loaded, obtain the html element of the preset element identifier in the page information; Starting from the html element, calculate the total element size of the sibling elements adjacent to the html element, and use the total element size as the actual size of the web page corresponding to the page identifier; Render the page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image; Among them, the step of when receiving a web page screenshot request, obtaining the page identifier corresponding to the web page screenshot request, and loading the page information corresponding to the page identifier includes: When receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request, and determine the page code corresponding to the page identifier; Add the html element of the preset element identifier to the page code, and save the page code and the html element as associated page information; the html element is generated when the page information is loaded; When receiving a page loading request, load the page information corresponding to the page identifier, and determine whether there is an html element of the preset element identifier in the loaded page information; If there is no html element of the preset element identifier in the loaded page information, it is determined that the page information corresponding to the page identifier has not been loaded; If there is an html element of the preset element identifier in the loaded page information, it is determined that the page information corresponding to the page identifier has been loaded.

2. The web page screenshot method according to claim 1, wherein Before the step of rendering the page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image, it includes: Output a ratio setting prompt for the user to set the scaling ratio of the screenshot image based on the ratio setting prompt; Obtain the scaling ratio input based on the ratio setting prompt, and use the scaling ratio as the scaling ratio corresponding to the web page screenshot request; The step of rendering the page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image includes: Calculate the product of the actual size and the scaling ratio, use the product as the display size, and render the page according to the display size to generate a screenshot image.

3. The web page screenshot method according to claim 1 or 2, characterized in that, After the step of rendering the page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image, it includes: When receiving a screenshot image sharing instruction, obtain the user identifier corresponding to the screenshot image sharing instruction; Save the screenshot image to the target path, generate the link information corresponding to the target path, and send the link information to the client corresponding to the user identifier.

4. The web page screenshot method according to claim 1 or 2, characterized in that, After the step of rendering the page according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image, it includes: When receiving an email sending request triggered based on the screenshot image, obtain the recipient identifier corresponding to the email sending request; Add the screenshot image to the email interface corresponding to the email sending request, generate an email containing the screenshot image, and send it to the client corresponding to the recipient identifier.

5. The web page screenshot method according to claim 1, characterized in that, Before the step of, when receiving a web page screenshot request, obtaining the page identifier corresponding to the web page screenshot request and loading the page information corresponding to the page identifier, includes: When receiving an image addition request triggered based on the email interface, obtain the page identifier corresponding to the image addition request, and trigger a web page screenshot request based on the page identifier; After the step of, when the page information corresponding to the page identifier is loaded, calculating the actual size of the web page corresponding to the page identifier according to the page information, includes: Obtain the interface size of the email interface, calculate the ratio of the interface size to the actual size, and use the ratio as the scaling ratio corresponding to the web page screenshot request; Perform page rendering according to the actual size and the scaling ratio corresponding to the web page screenshot request; Add the screenshot image to the email interface, generate an email containing the screenshot image, and send it.

6. A web page screenshot device, characterized in that, The web page screenshot device includes: A request receiving module, configured to, when receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request and load the page information corresponding to the page identifier; A size calculation module, configured to, when the page information corresponding to the page identifier is loaded, obtain the html element of the preset element identifier in the page information; starting from the html element, calculate the total element size of the sibling element adjacent to the html element, and use the total element size as the actual size of the web page corresponding to the page identifier; An image generation module, configured to perform page rendering according to the actual size and the scaling ratio corresponding to the web page screenshot request to generate a screenshot image; The request receiving module is specifically configured to, when receiving a web page screenshot request, obtain the page identifier corresponding to the web page screenshot request, determine the page code corresponding to the page identifier; add the html element of the preset element identifier to the page code, and save the page code and the html element as associated page information; the html element is generated when the page information is loaded; when receiving a page loading request, load the page information corresponding to the page identifier, and determine whether there is an html element of a preset element identifier in the loaded page information; if there is no html element of a preset element identifier in the loaded page information, it is determined that the page information corresponding to the page identifier has not been loaded completely; if there is an html element of a preset element identifier in the loaded page information, it is determined that the page information corresponding to the page identifier has been loaded completely.

7. A web page screenshot device, characterized in that, The web page screenshot device described above includes: a memory, a processor, and a web page screenshot program stored on the memory and executable on the processor. When the web page screenshot program is executed by the processor, it implements the steps of the web page screenshot method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, A web page screenshot program is stored on the computer-readable storage medium. When the web page screenshot program is executed by a processor, it implements the steps of the web page screenshot method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Page screenshot method and page screenshot device

    CN106873871A

  • Page sharing method, computing device, and computer storage medium

    CN109033466A

  • Web content capturing, packaging, distribution

    US20120010995A1