WO2021068765A1 - web页面截屏方法、装置、设备及计算机可读存储介质 - Google Patents
web页面截屏方法、装置、设备及计算机可读存储介质 Download PDFInfo
- Publication number
- WO2021068765A1 WO2021068765A1 PCT/CN2020/117821 CN2020117821W WO2021068765A1 WO 2021068765 A1 WO2021068765 A1 WO 2021068765A1 CN 2020117821 W CN2020117821 W CN 2020117821W WO 2021068765 A1 WO2021068765 A1 WO 2021068765A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- page
- screenshot
- web page
- identifier
- request
- Prior art date
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/451—Execution arrangements for user interfaces
Definitions
- This application relates to the field of financial technology (Fintech) technology, in particular to a method, device, device, and computer-readable storage medium for taking screenshots of web pages.
- Financial technology Fetech
- Financial webpage information has exploded.
- users view financial web pages they usually take screenshots of web pages.
- the current screenshots of web pages are taken according to the screen size.
- the screen size is 1920*3000, and the user can only take screenshots. Capture a 1920*3000 screen. If the web page size is greater than 1920*3000, only part of it can be captured; if the user needs to capture a part of the web page that is smaller than 1920*3000, it cannot be displayed prominently. That is to say, the screenshot image of the current web page cannot be in accordance with the needs of the user.
- the main purpose of this application is to propose a web page screenshot method, device, device, and computer-readable storage medium, aiming to solve the technical problem that the current web page screenshot image does not meet the needs of users.
- the web page screenshot method includes the following steps:
- the step of obtaining the page identifier corresponding to the web page screenshot request when receiving the web page screenshot request, and loading the page information corresponding to the page identifier includes:
- the step of calculating the actual size of the web page corresponding to the page identifier according to the page information includes:
- the method before the step of performing page rendering according to the actual size and the zoom ratio corresponding to the web page screenshot request, and generating a screenshot image, the method includes:
- Output ratio setting prompt for the user to set the zoom ratio of the screenshot image based on the ratio setting prompt
- the step of performing page rendering according to the actual size and the zoom ratio corresponding to the web page screenshot request to generate a screenshot image includes:
- the method includes:
- the screenshot image is saved to a target path, link information corresponding to the target path is generated, and the link information is sent to the client corresponding to the user identification.
- the method includes:
- the method before the step of obtaining the page identifier corresponding to the web page screenshot request when receiving the web page screenshot request, and loading the page information corresponding to the page identifier, the method includes:
- the method After 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, the method includes:
- the screenshot image is added to the mail interface, and an email containing the screenshot image is generated and sent.
- the present application also provides a web page screenshot device, the web page screenshot device includes:
- the request receiving module is configured to, when receiving the 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 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;
- the image generation module is configured to perform page rendering according to the actual size and the zoom ratio corresponding to the web page screenshot request to generate a screenshot image.
- this application also provides a web page screenshot device
- the web page screenshot device includes: a memory, a processor, and a web page screenshot stored in the memory and running on the processor A program that implements the steps of the web page screenshot method as described above when the web page screenshot program is executed by the processor.
- the present application also provides a computer-readable storage medium, the computer-readable storage medium stores a web page screenshot program, and the web page screenshot program is executed by a processor to achieve the above Steps of the web page screenshot method.
- This application provides a web page screenshot method, device, equipment, and computer-readable storage medium.
- the page identifier corresponding to the web page screenshot request is obtained, and the page information corresponding to the page identifier is loaded; 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; perform page rendering according to the actual size and the zoom ratio corresponding to the web page screenshot request, and generate a screenshot image.
- the web page screenshot device in this embodiment of the application The screenshot image is generated according to the zoom ratio corresponding to the screenshot request, so that the screenshot image meets the needs of the user.
- FIG. 1 is a schematic diagram of a device structure of a hardware operating environment involved in a solution of an embodiment of the present application
- FIG. 2 is a schematic flowchart of a first embodiment of a method for taking a screenshot of a web page of this application
- FIG. 3 is a schematic diagram of a specific scenario of the first embodiment of the method for taking a screenshot of a web page of this application;
- FIG. 4 is a schematic flowchart of a second embodiment of a method for taking a screenshot of a web page of this application
- FIG. 5 is a schematic diagram of functional modules of an embodiment of an apparatus for taking a screenshot of a web page according to the present application.
- FIG. 1 is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application.
- the web page screenshot device in the embodiment of the present application may be a PC or a server.
- 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.
- the communication bus 1002 is used to implement 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), and the optional user interface 1003 may also 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 magnetic disk memory.
- the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
- FIG. 1 does not constitute a limitation on the device, and may include more or fewer components than those shown in the figure, or a combination of certain components, or different component arrangements.
- 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.
- the network interface 1004 is mainly used to connect to the back-end server and communicate with the back-end server; the user interface 1003 is mainly used to connect to the client (user side) to communicate with the client; and the processor 1001 can be used to call a web page screenshot program stored in the memory 1005, and perform 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 this application The various embodiments of the web page screenshot method are not repeated here.
- FIG. 2 is a schematic flowchart of a first embodiment of a method for taking a screenshot of a web page according to this application.
- the method for taking a screenshot of a web page includes:
- Step S10 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.
- the web page screenshot method in this embodiment is applied to a web page screenshot device.
- the web page screenshot device receives a web page screenshot request.
- the triggering method of the web page screenshot request is not specifically limited, that is, the web page screenshot request can be 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 (page identifier refers to the identification information that identifies the web page, for example, the page identifier is page address information), and The web page screenshot request is triggered based on the page identifier; in addition, the web page screenshot request can also be automatically triggered by the web page screenshot device.
- the web page screenshot condition is preset in the web page screenshot device: web page screenshots are automatically taken every morning, web When the page screenshot device arrives in the early morning, it automatically triggers a web page screenshot request.
- the web page screenshot device When the web page screenshot device receives the 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, the page identifier is page address information, web page
- the screen capture device queries a preset page code library to obtain page information corresponding to the page address information, so as to complete the loading of the page information corresponding to the page identifier.
- Step S20 When the page information corresponding to the page identifier is loaded, the actual size of the web page corresponding to the page identifier is calculated according to the page information.
- 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. In this embodiment, the web page screenshot device determines whether the page information corresponding to the page identifier has been loaded. Way to achieve, specifically:
- Implementation method 1 The preset duration 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 on the page, for example, the preset duration is set to 10 Minutes, that is, when the web page screenshot device detects that the page information loading time reaches the preset time period, the web page screenshot device determines that the page information corresponding to the page identifier is loaded.
- Implementation method 2 The web page screenshot device adds a completion mark to the page code corresponding to the page identification, and 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 the corresponding page identification The page information has not been loaded; if the loaded page information includes a completion mark, the web page screenshot device determines that the page information corresponding to the page identifier has been loaded.
- a preset time is set to determine whether the page information is loaded. It does not require a web page screenshot device to perform the detection operation, but it takes a long time to wait for the preset time; implementation two detects the page Whether the information contains a completion mark can quickly identify whether the page information is loaded, but the web page screenshot device is required to perform a detection operation.
- the user chooses a more reasonable method according to the scene.
- the web page screenshot device When the web page screenshot device detects that the page information corresponding to the page identifier has been loaded, 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 and obtains the page information. The web page screen capture device calculates the actual size of the web page corresponding to the page identifier according to the arrangement of each image element and the size of each image element.
- 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 uses the page information, The rendering generates the screenshot image corresponding to the actual size, that is, the web page screenshot device renders the complete screenshot of the web page corresponding to the page identifier in an equal proportion.
- the web page screenshot device performs the screenshot operation according to the size information set by the user, specifically:
- Step S30 Perform page rendering according to the actual size and the zoom ratio corresponding to the web page screenshot request, and generate a screenshot image.
- the web page screenshot device obtains the zoom ratio corresponding to the web page screenshot request.
- the web page screenshot device multiplies the actual size by the zoom ratio to obtain the display size of the screenshot image.
- the web page screenshot device renders the page according to the display size and generates the screenshot image. Specifically, Before step S30, it also includes:
- Step a1 outputting a ratio setting prompt for the user to set the zoom ratio of the screenshot image based on the ratio setting prompt;
- Step a2 Obtain a zoom ratio prompted for input based on the ratio setting, and use the zoom ratio as a zoom ratio corresponding to the web page screenshot request.
- the web page screenshot device outputs a ratio setting prompt for the user to set the zoom ratio of the screenshot image based on the ratio setting prompt; it is understandable that the output time, output method and specific content of the ratio setting prompt are not limited, that is, the output of the ratio setting prompt
- the time can be: after receiving the web page screenshot request, or after the page information corresponding to the page identifier is loaded; the output mode of the proportion setting prompt: it can be a voice message or a pop-up window prompt.
- the web page screenshot device obtains the zoom ratio that is prompted for input based on the ratio setting.
- the web page screenshot device uses the zoom ratio entered by the user as the zoom ratio corresponding to the web page screenshot request, so that the web page screenshot device renders the page according to the zoom ratio to generate a screenshot image, that is
- the web page screenshot device calculates the actual size and the zoom ratio product as the display size of the screenshot image, and the web page screenshot device performs page rendering according to the display size to generate the screenshot image.
- the web page screenshot device when the user selects the "actual size" zoom method on the web page, the web page screenshot device accurately displays and generates the screenshot image according to the actual size on the web page. If the user selects the zoom ratio on the web page as 0.8 (representing the scaling to 0.8 times the size of the original component), the web page screenshot device accurately displays and generates the screenshot image according to the actual size on the web page * zoom ratio.
- the web page screenshot device by setting the zoom ratio of the screenshot image, the web page screenshot device The screenshot image is generated according to the zoom ratio corresponding to the screenshot request, so that the screenshot image meets the needs of the user, and it is also convenient for the user to adjust the layout of the web page, so that the content can adapt to the overall size.
- 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 renders the page according to the display size and generates the screenshot image.
- a second embodiment of the method for taking a screenshot of a web page of the present application is proposed.
- This embodiment is a detailed step of step S10 in the first embodiment.
- a specific implementation method for judging whether the page information has been loaded is given, including:
- Step S11 When a web page screenshot request is received, a page identifier corresponding to the web page screenshot request is obtained, and a page code corresponding to the page identifier is determined.
- the web page screenshot device When the web page screenshot device receives the 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.
- Step S12 Add an html element with a preset element identifier to the page code, and store the page code and the html element as page information in association.
- the web page screenshot device adds the html element with the preset element identification to the page code, the web page screenshot device uses the page code and the added html element as page information, the web page screenshot device establishes the relationship between the page code and the added html element, and the web page The screen capture device uses the associated page code and html elements as page information and saves it to the code database.
- Step S13 When a page loading request is received, the page information corresponding to the page identifier is loaded, and it is determined whether there is an html element with a preset element identifier in the loaded page information.
- the web page screenshot device When the web page screenshot device receives a page load request, the web page screenshot device loads the page information corresponding to the page identifier from the code database, and the web page screenshot device determines in real time whether there is an html element with a preset element identifier in the loaded page information , Where the preset element identifier refers to a preset element identifier, for example, the preset element identifier is phantomRenderSign.
- 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.
- the web page screenshot device determines that the page information corresponding to the page identifier has not been loaded, and the web page screenshot device continues to load.
- 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.
- the web page screenshot device determines that the page information corresponding to the page identifier has been loaded, so that the web page screenshot device calculates the web page corresponding to the page identifier according to the loaded page information Actual size.
- the web page screenshot device adds the html element identified by the preset element to the page code.
- this html element is generated.
- the web page screenshot device detects the html element and can determine the page information The loading has been completed, so that with this judgment, the web page screenshot device does not need to wait a long time when the page information is loaded, which shortens the loading time of the page information, and in one embodiment improves the screenshot of the web page screenshot device effectiveness.
- the current web page information loading has no way to determine when the data is loaded, so it is necessary to set a time to wait for the data to be loaded. After many tests, this time is about 10 minutes as a safe time, and the 10 minutes of data must have been loaded. , But this means that you need to wait 10 minutes to perform the next screenshot operation when you take a screenshot of the web page. This time can also be set shorter, but this will be risky. It may appear that the data is not yet available when the preview is generated. A situation where the page is empty after loading is complete.
- the method of adding a html element with a preset element identifier to the page code is used. This html element will be generated when the data is loaded. As long as this element is detected, it can be determined that the data has been loaded. In this way, with this judgment basis, you can start to generate preview images immediately after this element is available, without waiting for another 10 minutes, which greatly improves efficiency.
- a third embodiment of the web page screenshot method of the present application is proposed.
- This embodiment is a refinement of step S20 in the first embodiment.
- a specific implementation method for calculating the actual size of a web page including:
- the web page screenshot device acquires the html element identified by the preset element in the page information; the web page screenshot device uses the html element identified by the preset element as the starting point, and the web page screenshot device acquires the The sibling element adjacent to the html element and the element size of each sibling element, the web page screenshot device accumulates the size 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.
- the web page screenshot device uses the html element as the starting point to calculate the maximum width and height of the sibling element adjacent to the html element to obtain the actual size of the web page. It is understandable that if the phantomRenderSign element is not included in the page information, web The page screenshot device can only perform screenshot operations with the default screen size.
- the disadvantage of this screenshot method is that there are more free parts in the web page, and the size of the information with substantial content may be much smaller than the screen size. Then after the screenshot image is generated, There will be large blanks, which will affect 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 displayed completely.
- the web page screenshot device quickly calculates the actual size of the web page according to the html element identified by the preset element in the page information, so that the web page screenshot device can perform the screenshot operation according to the calculated actual size.
- a fourth embodiment of the web page screenshot method of the present application is proposed.
- This embodiment is a step after step S30 in the first embodiment.
- the difference between this embodiment and the foregoing embodiment lies in:
- the screenshot image is saved to a target path, link information corresponding to the target path is generated, and the link information is sent to the client corresponding to the user identification.
- the web page screenshot device receives the screenshot sharing instruction.
- the triggering method of the screenshot sharing instruction is not specifically limited.
- the web page screenshot device obtains the user ID corresponding to the screenshot image sharing instruction.
- the user ID refers to User identification information, for example, user account in instant messaging software.
- the web page screenshot device calls the preset data storage interface, and saves the screenshot image to the target path through the preset data storage interface.
- the web page screenshot device generates the link information corresponding to the target path, and the web page screenshot device sends the link information to the user The corresponding client is identified, so that the user can determine the target path through the link information to view the screenshot image.
- the web page screenshot device saves the screenshot image to the target path through a preset data storage interface, and generates link information of the target path, so that the user accesses the target path through the link information and obtains the screenshot image, which facilitates user operations. It is understandable that the web page screenshot device can also directly send the screenshot image to the client corresponding to the user identification, so that the user can view the screenshot image.
- This embodiment is a step after step S30 in the first embodiment.
- the difference between this embodiment and the foregoing embodiment lies in:
- the web page screenshot device when the web page screenshot device receives an email sending request triggered based on the screenshot image, the web page screenshot device obtains the recipient ID corresponding to the email sending request (the recipient ID refers to the recipient’s email account information); The screenshot device adds the screenshot image to the mail interface corresponding to the email sending request, and generates an email containing the screenshot image. The web page screenshot device sends the email containing the screenshot image to the client corresponding to the recipient ID so that the recipient can view it.
- the recipient ID refers to the recipient’s email account information
- the screenshot device adds the screenshot image to the mail interface corresponding to the email sending request, and generates an email containing the screenshot image.
- the web page screenshot device sends the email containing the screenshot image to the client corresponding to the recipient ID so that the recipient can view it.
- the web page screenshot device uses the screenshot image obtained by the screenshot as the mail content sending client, so that the recipient can view the screenshot image.
- this embodiment can also be combined with the fourth embodiment of this application.
- the web page screenshot device receives an email sending request triggered based on the screenshot image
- the web page screenshot device saves the screenshot image to the target path and generates the target The link information corresponding to the path
- the web page screenshot device sends the link information as an email to the client corresponding to the recipient ID.
- This embodiment mainly focuses on sending screenshots by mail.
- the fifth embodiment is that 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 screenshots
- the device sends the obtained screenshot image as the content of the mail; in this embodiment, the user triggers a screenshot request on the mail interface, and the web page screenshot device performs the screenshot operation according to the mail interface information. Specifically, it includes:
- the user opens the mailbox application on the web page screen capture device.
- the type of mailbox application is not limited, that is, the mailbox application can be Outlook, foxmail, common versions of ios/Android clients, enterprise WeChat, web pages, etc., web page screenshots
- the email interface is displayed on the display interface of the device.
- the user triggers an image addition request in the email interface.
- the trigger method is not specifically limited; when the web page screenshot device receives an image addition request triggered by the email interface, the web page screenshot device obtains the corresponding image addition request The page ID.
- the web page screenshot device 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.
- the page identifier corresponding to the web page screenshot request is acquired, and the page information corresponding to the page identifier is loaded.
- the web page screenshot device When the web page screenshot device receives a web page screenshot request based on the page identifier, the web page screenshot device loads the page information corresponding to the page identifier; for example, the page identifier is page address information, and the web page screenshot device queries the preset page code library to obtain the page address The page information corresponding to the information to complete the loading of the page information corresponding to the page identifier.
- the screenshot image is added to the mail interface, and an email containing the screenshot image is generated and sent.
- the web page screenshot device when the web page screenshot device loads the page information corresponding to the page identifier, 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 interface size and The ratio of the actual size.
- the web page screenshot device uses the ratio as the zoom ratio corresponding to the web page screenshot request.
- the web page screenshot device renders the page according to the actual size and the zoom ratio corresponding to the web page screenshot request; the screenshot image is added to the email interface to generate Mail with screenshots and send.
- the current mail system usually can only add pre-saved screenshot images, but in this embodiment, you can jump to the web page from the mail interface in real time, and intercept the screenshot images adapted to the mail interface from the web page.
- This operation mode makes The user's operation is more convenient, and the screenshot image can be displayed well on the mail interface.
- the ratio between the interface size and the actual size may not be calculated to determine the zoom ratio, and the screenshot image is rendered directly according to the interface size of the mail interface, specifically:
- the interface size of the mail interface is acquired.
- the web page screen capture device detects the loading status of the page identification page information in real time to determine whether the page information corresponding to the page identification has been loaded. When the web page screen capture device detects that the page information corresponding to the page identification is loaded, the web page screen capture device obtains The interface size of the mail interface.
- Perform page rendering according to the interface size generate a screenshot image, add the screenshot image to the mail interface, generate and send an email containing the screenshot image.
- the web page screenshot device renders the page according to the interface size, and generates a screenshot image.
- the web page screenshot device adds the screenshot image to the email interface, generates and sends an email containing the screenshot image; specifically:
- the web page screenshot device uses the html mail format, and the table tag is used to control the content layout of the mail (because if the table tag is not used, there will be a problem that the content cannot be displayed continuously in some mobile clients), for different screenshot images
- the height and width are also processed by the web page screenshot device. 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 of the interface size the current actual size is (rounded up), and then web The page screenshot device divides the screenshot image into equal parts.
- the screenshot image will be directly cut, and the excess part will not be displayed.
- web page screenshots are taken according to the interface size of the mail, so that the screenshot image is adapted to multiple mail systems, and it is ensured that the mail corresponding to the screenshot image can be displayed well on multiple mail systems.
- an embodiment of the present application further provides a web page screenshot device
- the web page screenshot device includes:
- the request receiving module 10 is configured to, when receiving a web page screenshot request, obtain a page identifier corresponding to the web page screenshot request, and load the page information corresponding to the page identifier;
- the size calculation module 20 is 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;
- the image generation module 30 is configured to perform page rendering according to the actual size and the zoom ratio corresponding to the web page screenshot request to generate a screenshot image.
- the request receiving module 10 includes:
- the code obtaining unit is configured to obtain the page identifier corresponding to the web page screenshot request when receiving the web page screenshot request, and determine the page code corresponding to the page identifier;
- An element adding unit configured to add an html element with a preset element identifier to the page code, and store the page code and the html element as page information in association;
- the loading judgment unit is configured to load the page information corresponding to the page identifier when a page load request is received, and determine whether there is an html element with a preset element identifier in the loaded page information;
- the first determining unit is configured to determine that the page information corresponding to the page identifier has not been loaded if the html element with the preset element identifier does not exist in the loaded page information;
- the second determining unit is configured to determine that the page information corresponding to the page identifier has been loaded if there is an html element with a preset element identifier in the loaded page information.
- the size calculation module 20 includes:
- An element acquiring unit configured to acquire the html element of the preset element identifier in the page information when the page information corresponding to the page identifier is loaded;
- the size calculation unit is configured to use the html element as a starting point to 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.
- the web page screenshot device includes:
- the window output module is used to output a ratio setting prompt for the user to set the zoom ratio of the screenshot image based on the ratio setting prompt;
- a ratio acquisition module configured to acquire a zoom ratio prompted for input based on the ratio setting, and use the zoom ratio as the zoom ratio corresponding to the web page screenshot request;
- the image generation module 30 is further configured to calculate the product of the actual size and the zoom ratio, use the product as the display size, and perform page rendering according to the display size to generate a screenshot image.
- the web page screenshot device includes:
- the instruction receiving module is configured to obtain the user ID corresponding to the screenshot image sharing instruction when the screenshot image sharing instruction is received;
- the link generation module is configured to 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 identification.
- the web page screenshot device includes:
- An identifier obtaining module configured to obtain a recipient identifier corresponding to the email sending request when the email sending request triggered based on the screenshot image is received;
- the mail sending module is configured to add the screenshot image to the mail interface corresponding to the mail sending request, generate an email containing the screenshot image, and send the client corresponding to the recipient ID.
- the web page screenshot device includes:
- the image adding module is configured to, when an image adding request triggered based on the email interface is received, obtain the page identifier corresponding to the image adding request, and trigger a web page screenshot request based on the page identifier;
- An obtaining calculation module configured to 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 zoom ratio corresponding to the web page screenshot request;
- An image generation module configured to perform page rendering according to the actual size and the zoom ratio corresponding to the web page screenshot request
- the image sending module is used to add the screenshot image to the mail interface, generate and send an email containing the screenshot image.
- the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above. , Magnetic disk, optical disk), including several instructions to make a server device (can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the method described in each embodiment of the present application.
- a server device can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Human Computer Interaction (AREA)
- Data Mining & Analysis (AREA)
- Information Transfer Between Computers (AREA)
Abstract
一种web页面截屏方法、装置、设备及计算机可读存储介质,该方法包括:在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息(S10);在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸(S20);根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像(S30)。
Description
相关申请的交叉引用
本申请要求于2019年10月10日提交中国专利局、申请号为201910959926.6、申请名称为“web页面截屏方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其专利申请的全部内容通过引用结合在本申请中。
本申请涉及金融科技(Fintech)技术领域,尤其涉及web页面截屏方法、装置、设备及计算机可读存储介质。
随着互联网技术,尤其是互联网金融科技(Fintech)的飞速发展,越来越多的技术(大数据、分布式、区块链Blockchain、人工智能等)应用在金融领域。
金融网页信息呈爆炸式增长,用户查看金融对应的web页面时通常会对web页面进行截屏操作,当前web页面的截屏操作是按照屏幕尺寸截取,例如,屏幕尺寸为1920*3000,用户最大只能截取1920*3000的屏幕,若web页面的页面尺寸大于1920*3000,则只能部分截取;若用户需要截取的web页面中小于1920*3000的部分区域时,也不可以进行突出的截屏显示,也就是说当前web页面的截屏图像并不可以按照用户的需求。
本申请的主要目的在于提出一种web页面截屏方法、装置、设备及计算机可读存储介质,旨在解决当前web页面截屏图像不符合用户需求的技术问题。
为实现上述目的,本申请提供一种web页面截屏方法,所述web页面截屏方法包括如下步骤:
在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息;
在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸;以及
根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像。
在一实施例中,所述在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息的步骤,包括:
在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,确定所述页面标识对应的页面代码;
在所述页面代码中添加预设元素标识的html元素,将所述页面代码和所述html元素作为页面信息关联保存;
在接收到页面加载请求时,加载所述页面标识对应的页面信息,判断已加载的页面信息中是否存在预设元素标识的html元素;
若已加载的页面信息中不存在预设元素标识的html元素,则判定所述页面标识对应的页面信息未加载完成;以及
若已加载的页面信息中存在预设元素标识的html元素,则判定所述页面标识对应的页面信息已加载完成。
在一实施例中,所述在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸的步骤,包括:
在所述页面标识对应的页面信息加载完成时,获取所述页面信息中预设元素标识的html元素;以及
以所述html元素为起点,计算与所述html元素相邻的sibling元素的元素总尺寸,将所述元素总尺寸作为所述页面标识对应web页面的实际尺寸。
在一实施例中,所述根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像的步骤之前,包括:
输出比例设置提示,以供用户基于所述比例设置提示设置截屏图像的缩放比例;
获取基于所述比例设置提示输入的缩放比例,将所述缩放比例作为所述web页面截屏请求对应的缩放比例;
所述根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像的步骤,包括:
计算所述实际尺寸和所述缩放比例的乘积,将所述乘积作为显示尺寸,根据所述显示尺寸进行页面渲染,生成截屏图像。
在一实施例中,所述根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像的步骤之后,包括:
在接收到截屏图像分享指令时,获取所述截屏图像分享指令对应的用户标识;以及
将所述截屏图像并保存到目标路径,生成所述目标路径对应的链接信息,并将所述链接信息发送至所述用户标识对应的客户端。
在一实施例中,所述根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像的步骤之后,包括:
在接收到基于所述截屏图像触发的邮件发送请求时,获取所述邮件发送请求对应的收件人标识;以及
将所述截屏图像添加到所述邮件发送请求对应的邮件界面,生成包含所述截屏图像的邮件并发送所述收件人标识对应的客户端。
在一实施例中,所述在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息的步骤之前,包括:
在接收到基于邮件界面触发的图像添加请求时,获取所述图像添加请求对应的页面标识,并基于所述页面标识触发web页面截屏请求;
所述在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸的步骤之后,包括:
获取所述邮件界面的界面尺寸,计算所述界面尺寸与所述实际尺寸的比值,将所述比值作为所述web页面截屏请求对应的缩放比例;
根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染;以及
将所述截屏图像添加到所述邮件界面,生成包含所述截屏图像的邮件并发送。
此外,为实现上述目的,本申请还提供一种web页面截屏装置,所述web页面截屏装置包括:
请求接收模块,用于在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息;
尺寸计算模块,用于在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸;
图像生成模块,用于根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像。
此外,为实现上述目的,本申请还提供一种web页面截屏设备,所述web页面截屏设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的web页面截屏程序,所述web页面截屏程序被所述处理器执行时实现如上所述的web页面截屏方法的步骤。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有web页面截屏程序,所述web页面截屏程序被处理器执行时实现如上所述的web页面截屏方法的步骤。
本申请提供一种web页面截屏方法、装置、设备及计算机可读存储介质。本申请实施例中在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息;在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸;根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像,本申请实施例中web页面截屏设备根据截屏请求对应的缩放比例生成截屏图像,使得截屏图像符合用户的需求。
图1是本申请实施例方案涉及的硬件运行环境的设备结构示意图;
图2为本申请web页面截屏方法第一实施例的流程示意图;
图3为本申请web页面截屏方法第一实施例的具体场景示意图;
图4为本申请web页面截屏方法第二实施例的流程示意图;
图5为本申请web页面截屏装置一实施例的功能模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
如图1所示,图1是本申请实施例方案涉及的硬件运行环境的设备结构示意图。
本申请实施例web页面截屏设备可以是PC机或服务器。
如图1所示,该web页面截屏设备可以包括:处理器1001,例如CPU,网络接口1004,用户接口1003,存储器1005,通信总线1002。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。
本领域技术人员可以理解,图1中示出的设备结构并不构成对设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及web页面截屏程序。
在图1所示的设备中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001可以用于调用存储器1005中存储的web页面截屏程序,并执行下述web页面截屏方法中的操作,在所述处理器上运行的web页面截屏程序被执行时所实现的方法可参照本申请web页面截屏方法各个实施例,此处不再赘述。
基于上述硬件结构,提出本申请web页面截屏方法实施例。
参照图2,图2为本申请web页面截屏方法第一实施例的流程示意图,所述web页面截屏方法包括:
步骤S10,在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息。
本实施例中web页面截屏方法应用于web页面截屏设备,web页面截屏设备接收web页面截屏请求,web页面截屏请求的触发方式不作具体限定,即,web页面截屏请求可以用户主动触发的,例如,用户在web页面截屏设备对应的显示界面上点击截屏图标,web页面截屏设备获取当前显示界面对应的页面标识(页面标识是指识别web页面的标识信息,例如,页面标识为页面地址信息),并基于该页面标识触发web页面截屏请求;此外,web页面截屏请求还可以是web页面截屏设备自动触发的,例如,web页面截屏设备中预设web页面截屏条件:每天凌晨自动进行web页面截屏,web页面截屏设备在到达凌晨时,自动触发web页面截屏请求。
web页面截屏设备在接收到web页面截屏请求时,web页面截屏设备获取web页面截屏请求对应的页面标识,web页面截屏设备加载页面标识对应的页面信息,例如,页面标识为页面地址信息,web页面截屏设备查询预设的页面代码库获取页面地址信息对应的页面信息,以完成页面标识对应页面信息的加载。
步骤S20,在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸。
web页面截屏设备检测页面标识对应的页面信息的加载状态,判断页面标识对应的页面信息是否已加载完成,本实施例中web页面截屏设备判断页面标识对应的页面信息是否已加载完成可以通过不同的方式实现,具体地:
实现方式一:web页面截屏设备中预设时长,预设时长可以根据web页面截屏设备所处的网络环境设置,预设时长还可以根据页面信息的信息量设置,例如,预设时长设置为10分钟,即,web页面截屏设备在检测到页面信息加载时长到达预设时长,web页面截屏设备判定页面标识对应的页面信息加载完成。
实现方式二:web页面截屏设备在页面标识对应页面代码中添加完成标记,web页面截屏设备获取已加载的页面信息,若已加载页面信息中不包含完成标记,web页面截屏设备判定页面标识对应的页面信息未加载完成;若已加载页面信息中包含完成标记,web页面截屏设备判定页面标识对应的页面信息加载完成,
本实施例的上述实现方式中,实现方式一中设置预设时长判断页面信息是否加载完成,不需要web页面截屏设备进行检测操作,但是等待预设时间需要的时间较长;实现方式二检测页面信息中是否包含完成标记,可以快速地识别页面信息是否加载完成,但是需要web页面截屏设备进行检测操作,在实际页面信息加载判断时,用户根据场景选择较为合理的方式。
web页面截屏设备检测到页面标识对应的页面信息加载完成时,web页面截屏设备根据加载的页面信息计算页面标识对应web页面的实际尺寸,即,web页面截屏设备解析页面信息,获取页面信息中包含的图像元素,及各图像元素的排列方式,web页面截屏设备按照各个图像元素的排列方式和各个图像元素的尺寸,计算页面标识对应web页面的实际尺寸。
例如,web页面中包含4个图像元素,图像元素1(长10cm高5cm)、图像元素2(长6cm高3cm)、图像元素3(长12cm高9cm)和图像元素4(长15cm高10cm),图像元素1和图像元素2横向并列排列、图像元素3在图像元素1和图像元素2的下方、图像元素4在图像元素3的下方,因此web页面的实际尺寸为:长16cm(16(10+6)、12和15中取最大值)、高24cm(24=5(3)+9+10)。
本实施例中web页面截屏设备在页面信息加载完成时,web页面截屏设备根据页面信息计算web页面的实际尺寸,此时,若用户没有设置截屏图像的尺寸信息,web页面截屏设备根据页面信息,渲染生成实际尺寸对应的截屏图像,即web页面截屏设备将页面标识对应的web页面进行等比例渲染完整截屏。
此外,若用户设置截屏图像的尺寸信息,则web页面截屏设备按照用户设的尺寸信息进行截屏操作,具体地:
步骤S30,根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像。
web页面截屏设备获取web页面截屏请求对应的缩放比例,web页面截屏设备用实际尺寸乘以缩放比例得到截屏图像的显示尺寸,web页面截屏设备按照显示尺寸进行页面渲染,生成截屏图像,具体地,步骤S30之前还包括:
步骤a1,输出比例设置提示,以供用户基于所述比例设置提示设置截屏图像的缩放比例;
步骤a2,获取基于所述比例设置提示输入的缩放比例,将所述缩放比例作为所述web页面截屏请求对应的缩放比例。
web页面截屏设备输出比例设置提示,以供用户基于比例设置提示设置截屏图像的缩放比例;可以理解的是,比例设置提示的输出时间、输出方式和具体内容不作限定,即,比例设置提示的输出时间可以是:接收到web页面截屏请求之后,还可以是页面标识对应的页面信息加载之后;比例设置提示的输出方式:可以是语音信息,还可以是弹出窗口提示。
web页面截屏设备获取基于比例设置提示输入的缩放比例,web页面截屏设备将用户输入的缩放比例作为web页面截屏请求对应的缩放比例,使得web页面截屏设备按照缩放比例进行页面渲染生成截屏图像,即,web页面截屏设备计算实际尺寸和缩放比例乘积作为截屏图像的显示尺寸,web页面截屏设备根据显示尺寸进行页面渲染,生成截屏图像。
例如,参照图3,当用户在web页面上选择缩放方式为“实际尺寸”时,web页面截屏设备根据web页面上的实际尺寸准确地显示生成截屏图像,若用户在web页面上选择缩放比例为0.8(表示缩放为原始组件大小的0.8倍),web页面截屏设备根据web页面上的实际尺寸*缩放比例准确地显示生成截屏图像,本实施例中通过设置截屏图像的缩放比例,web页面截屏设备根据截屏请求对应的缩放比例生成截屏图像,使得截屏图像符合用户的需求,也方便用户调整web页面的排版,使内容能够适应总体大小。
可以理解的是,web页面截屏设备中还支持用户直接设置截屏图像的显示尺寸,以使web页面截屏设备按照显示尺寸进行页面渲染,生成截屏图像。
在一实施例中,参照图4,基于本申请web页面截屏方法第一实施例,提出本申请web页面截屏方法第二实施例。
本实施例是第一实施例中步骤S10的细化步骤,本实施例中给出了一种判断页面信息是否加载完成的具体实现方式,包括:
步骤S11,在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,确定所述页面标识对应的页面代码。
web页面截屏设备在接收到web页面截屏请求时,web页面截屏设备获取web页面截屏请求对应的页面标识,web页面截屏设备查询代码数据库,确定代码数据库中页面标识对应的页面代码。
步骤S12,在所述页面代码中添加预设元素标识的html元素,将所述页面代码和所述html元素作为页面信息关联保存。
web页面截屏设备在页面代码中添加预设元素标识的html元素,web页面截屏设备将页面代码和添加的html元素作为页面信息,web页面截屏设备建立页面代码和添加的html元素关联关系,web页面截屏设备将相互关联的页面代码和html元素作为页面信息,并保存至代码数据库。
步骤S13,在接收到页面加载请求时,加载所述页面标识对应的页面信息,判断已加载的页面信息中是否存在预设元素标识的html元素。
web页面截屏设备在接收到页面加载请求时,web页面截屏设备从代码数据库中加载页面标识对应的页面信息,web页面截屏设备实时地判断已加载的页面信息中是否存在预设元素标识的html元素,其中,预设元素标识是指预先设置的元素标识,例如预设元素标识为phantomRenderSign。
步骤S14,若已加载的页面信息中不存在预设元素标识的html元素,则判定所述页面标识对应的页面信息未加载完成。
若已加载的页面信息中不存在预设元素标识的html元素,web页面截屏设备判定页面标识对应的页面信息未加载完成,web页面截屏设备继续进行加载。
步骤S15,若已加载的页面信息中存在预设元素标识的html元素,则判定所述页面标识对应的页面信息已加载完成。
若已加载的页面信息中存在预设元素标识的html元素,web页面截屏设备判定页面标识对应的页面信息已加载完成,使得web页面截屏设备按照加载完成的页面信息计算页面标识对应的web页面的实际尺寸。
本实施例中web页面截屏设备在页面代码中添加预设元素标识的html元素,在页面信息加载完成时,会生成这个html元素,web页面截屏设备检测到有这个html元素,就能确定页面信息已经加载完成,这样有了这个判断依据web页面截屏设备在进行页面信息加载时,就不需要等待较长的时间,缩短了页面信息的加载时间,在一实施例中提高了web页面截屏设备截屏效率。
即,当前web页面信息加载没有办法判断数据什么时候加载完了,所以必须要设定一个等待数据加载的时间,这个时间经过多次试验,大概10分钟是一个安全时间,10分钟数据肯定已经加载完了,但是这就意味着要在web页面截图时需要等待10分钟才能进行接下来的截图操作,这个时间也可以设置得短一点,但这就会有风险,可能会出现生成预览图时数据还没加载完成导致页面为空的情况。本实施例中使用了在页面代码中添加预设元素标识的html元素的这个方法,在数据加载完成时会生成这个html元素,只要检测到有这个元素了,就能确定数据已经加载完成了,这样有了这个判断依据,可以在有这个元素之后就可以立即可以开始生成预览图,不需要再等待10分钟了,大大地提升了效率。
在一实施例中,基于本申请web页面截屏方法第二实施例,提出本申请web页面截屏方法第三实施例。
本实施例是第一实施例中步骤S20的细化,本实施例中给出了一种计算web页面实际尺寸的具体实现方式,包括:
在所述页面标识对应的页面信息加载完成时,获取所述页面信息中预设元素标识的html元素;
以所述html元素为起点,计算与所述html元素相邻的sibling元素的元素总尺寸,将所述元素总尺寸作为所述页面标识对应web页面的实际尺寸。
即,web页面截屏设备在页面信息加载完成时,web页面截屏设备获取页面信息中预设元素标识的html元素;web页面截屏设备以预设元素标识的html元素为起点,web页面截屏设备获取与html元素相邻的sibling元素,和各sibling元素的元素尺寸,web页面截屏设备将各个元素尺寸累加得到元素总尺寸,web页面截屏设备将元素总尺寸作为页面标识对应web页面的实际尺寸。
例如,web页面截屏设备以html元素为起始点,去计算与html元素相邻的sibling元素的最大宽高,得到web页面的实际尺寸,可以理解的是,若页面信息中没有这个phantomRenderSign元素,web页面截屏设备只能默认的屏幕尺寸进行截屏操作,这种截屏方式不足之处在于:web页面中空余部分较多,有实质内容的信息尺寸可能远远比屏幕尺寸小,那么生成截屏图像后,会出现大片空白,影响展示效果;或者web页面的实际尺寸大于web页面截屏设备的屏幕尺寸时,那么多出来的内容就没有办法完整的显示。
本实施例中web页面截屏设备根据页面信息中预设元素标识的html元素,快速地计算web页面的实际尺寸,使得web页面截屏设备可以根据计算得到的实际尺寸进行截屏操作。
在一实施例中,基于本申请web页面截屏方法上述实施例,提出本申请web页面截屏方法第四实施例。
本实施例是第一实施例中步骤S30之后的步骤,本实施例与上述实施例的区别在于:
在接收到截屏图像分享指令时,获取所述截屏图像分享指令对应的用户标识;
将所述截屏图像并保存到目标路径,生成所述目标路径对应的链接信息,并将所述链接信息发送至所述用户标识对应的客户端。
web页面截屏设备接收截屏分享指令,截屏分享指令的触发方式不作具体限定,web页面截屏设备在接收到截屏图像分享指令时,web页面截屏设备获取截屏图像分享指令对应的用户标识,用户标识是指用户的标识信息,例如,即时通讯软件中的用户账户。
web页面截屏设备调用预设的数据存放接口,通过预设的数据存放接口将截屏图像并保存到目标路径,web页面截屏设备生成目标路径对应的链接信息,web页面截屏设备将链接信息发送至用户标识对应的客户端,使得用户通过链接信息确定目标途径,以查看截屏图像。
本实施例中web页面截屏设备通过预设的数据存放接口将截屏图像保存目标路径,并生成目标路径的链接信息,使得用户通过链接信息访问目标路径,获取到截屏图像,方便了用户操作。可以理解的是,web页面截屏设备还可以直接将截屏图像发送至用户标识对应的客户端,使得用户查看截屏图像。
在一实施例中,基于本申请web页面截屏方法上述实施例,提出本申请web页面截屏方法第五实施例。
本实施例是第一实施例中步骤S30之后的步骤,本实施例与上述实施例的区别在于:
在接收到基于所述截屏图像触发的邮件发送请求时,获取所述邮件发送请求对应的收件人标识;
将所述截屏图像添加到所述邮件发送请求对应的邮件界面,生成包含所述截屏图像的邮件并发送所述收件人标识对应的客户端。
即,web页面截屏设备在接收到基于截屏图像触发的邮件发送请求时,web页面截屏设备获取邮件发送请求对应的收件人标识(收件人标识是指收件人邮箱账户信息);web页面截屏设备将截屏图像添加到邮件发送请求对应的邮件界面,生成包含截屏图像的邮件,web页面截屏设备将包含截屏图像的邮件发送收件人标识对应的客户端,以使收件人进行查看。
本实施例中在截屏完成之后,web页面截屏设备将截屏得到的截屏图像作为邮件内容发送客户端,方便收件人查看截屏图像。
此外,本实施例还可以与本申请第四实施例进行结合,web页面截屏设备在接收到基于截屏图像触发的邮件发送请求时,web页面截屏设备将截屏图像并保存到目标路径,并生成目标路径对应的链接信息,web页面截屏设备将链接信息作为邮件,发送至收件人标识对应的客户端。
在一实施例中,基于本申请web页面截屏方法上述实施例,提出本申请web页面截屏方法第六实施例。
本实施例中主要针对邮件发送截屏图像,本实施例与第五实施例的区别在于,第五实施例是用户在web页面上进行截屏得到截屏图像,用户基于截屏图像触发邮件操作,web页面截屏设备将得到的截屏图像作为邮件内容进行发送;而本实施例中则是用户在邮件界面上触发截屏请求,web页面截屏设备根据邮件界面信息进行截屏操作。具体地,包括:
在接收到基于邮件界面触发的图像添加请求时,获取所述图像添加请求对应的页面标识,并基于所述页面标识触发web页面截屏请求。
用户在web页面截屏设备开启邮箱应用程序,邮箱应用程序的种类不作限定,即,邮箱应用程序可以是Outlook、foxmail、常见版本型号的ios/Android客户端、企业微信、网页端等,web页面截屏设备的显示界面中显示邮件界面,用户在邮件界面触发图像添加请求,触发方式不作具体限定;web页面截屏设备在接收到基于邮件界面触发的图像添加请求时,web页面截屏设备获取图像添加请求对应的页面标识。
web页面截屏设备获取到页面标识之后,基于页面标识触发web页面截屏请求,即,web页面截屏设备查询页面标识对应的web页面,并跳转至web页面上触发web页面截屏请求。
在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息。
web页面截屏设备接收基于页面标识触发web页面截屏请求时,web页面截屏设备加载页面标识对应的页面信息;例如,页面标识为页面地址信息,web页面截屏设备查询预设的页面代码库获取页面地址信息对应的页面信息,以完成页面标识对应页面信息的加载。
在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸;
获取所述邮件界面的界面尺寸,计算所述界面尺寸与所述实际尺寸的比值,将所述比值作为所述web页面截屏请求对应的缩放比例;
根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染;
将所述截屏图像添加到所述邮件界面,生成包含所述截屏图像的邮件并发送。
即,web页面截屏设备在页面标识对应的页面信息加载完成时,web页面截屏设备根据页面信息计算页面标识对应web页面的实际尺寸;web页面截屏设备获取邮件界面的界面尺寸,并计算界面尺寸与实际尺寸的比值,web页面截屏设备将比值作为web页面截屏请求对应的缩放比例,web页面截屏设备根据实际尺寸和web页面截屏请求对应的缩放比例进行页面渲染;将截屏图像添加到邮件界面,生成包含截屏图像的邮件并发送。
当前邮件系统通常只能添加预先保存的截屏图像,而本实施例中可以从邮件界面实时地跳转至web页面,并从web页面中截取与邮件界面适配的截屏图像,这样的操作方式使得用户的操作更加便捷,同时截屏图像可以在邮件界面上良好的显示。
此外,可以理解的是,本实施例中在页面信息加载完成时,可以不计算界面尺寸与实际尺寸之间的比值确定缩放比例,直接按照邮件界面的界面尺寸进行截屏图像渲染,具体地:
在所述页面标识对应的页面信息加载完成时,获取所述邮件界面的界面尺寸。
web页面截屏设备实时地检测页面标识页面信息的加载状态,以判断页面标识对应的页面信息是否已加载完成,web页面截屏设备在检测到页面标识对应的页面信息加载完成时,web页面截屏设备获取邮件界面的界面尺寸。
根据所述界面尺寸进行页面渲染,生成截屏图像,将所述截屏图像添加到所述邮件界面,生成包含所述截屏图像的邮件并发送。
web页面截屏设备根据界面尺寸进行页面渲染,生成截屏图像,web页面截屏设备将所截屏图像添加到所述邮件界面,生成包含所述截屏图像的邮件并发送;具体地:
web页面截屏设备使用html邮件格式,用table标签来控制邮件的内容排版(因为如果不使用table标签的话,会出现在某些手机客户端会无法连续显示内容的问题),对于不同的截屏图像的高度和宽度,web页面截屏设备也是做了处理,如当截屏图像的实际尺寸大于界面尺寸时,web页面截屏设备计算出当前实际尺寸是界面尺寸的多少个整数倍(向上取整),然后web页面截屏设备将截屏图像等分切割成多少块。这样可以适配实际尺寸大于界面尺寸的截屏尺寸,使得截屏图像在邮件中能有友好的展示,避免由于截图图像过大导致的被截断或者错位问题;还有避免出现比如在outlook邮箱中,当截屏图像的实际尺寸大于界面尺寸时,会直接截断截屏图像,不对超出部分进行显示的问题。本实施例中根据邮件的界面尺寸,进行web页面截屏,使得截屏图像适配了多个邮件系统,确保了截屏图像对应的邮件能在多个邮件系统上良好的显示。
参考图5,本申请实施例还提供一种web页面截屏装置,所述web页面截屏装置包括:
请求接收模块10,用于在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息;
尺寸计算模块20,用于在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸;
图像生成模块30,用于根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像。
在一实施例中,所述请求接收模块10,包括:
代码获取单元,用于在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,确定所述页面标识对应的页面代码;
元素添加单元,用于在所述页面代码中添加预设元素标识的html元素,将所述页面代码和所述html元素作为页面信息关联保存;
加载判断单元,用于在接收到页面加载请求时,加载所述页面标识对应的页面信息,判断已加载的页面信息中是否存在预设元素标识的html元素;
第一判定单元,用于若已加载的页面信息中不存在预设元素标识的html元素,则判定所述页面标识对应的页面信息未加载完成;
第二判定单元,用于若已加载的页面信息中存在预设元素标识的html元素,则判定所述页面标识对应的页面信息已加载完成。
在一实施例中,所述尺寸计算模块20,包括:
元素获取单元,用于在所述页面标识对应的页面信息加载完成时,获取所述页面信息中预设元素标识的html元素;
尺寸计算单元,用于以所述html元素为起点,计算与所述html元素相邻的sibling元素的元素总尺寸,将所述元素总尺寸作为所述页面标识对应web页面的实际尺寸。
在一实施例中,所述的web页面截屏装置,包括:
窗口输出模块,用于输出比例设置提示,以供用户基于所述比例设置提示设置截屏图像的缩放比例;
比例获取模块,用于获取基于所述比例设置提示输入的缩放比例,将所述缩放比例作为所述web页面截屏请求对应的缩放比例;
所述图像生成模块30,还用于计算所述实际尺寸和所述缩放比例的乘积,将所述乘积作为显示尺寸,根据所述显示尺寸进行页面渲染,生成截屏图像。
在一实施例中,所述的web页面截屏装置,包括:
指令接收模块,用于在接收到截屏图像分享指令时,获取所述截屏图像分享指令对应的用户标识;
链接生成模块,用于将所述截屏图像并保存到目标路径,生成所述目标路径对应的链接信息,并将所述链接信息发送至所述用户标识对应的客户端。
在一实施例中,所述的web页面截屏装置,包括:
标识获取模块,用于在接收到基于所述截屏图像触发的邮件发送请求时,获取所述邮件发送请求对应的收件人标识;
邮件发送模块,用于将所述截屏图像添加到所述邮件发送请求对应的邮件界面,生成包含所述截屏图像的邮件并发送所述收件人标识对应的客户端。
在一实施例中,所述的web页面截屏装置,包括:
图像添加模块,用于在接收到基于邮件界面触发的图像添加请求时,获取所述图像添加请求对应的页面标识,并基于所述页面标识触发web页面截屏请求;
获取计算模块,用于获取所述邮件界面的界面尺寸,计算所述界面尺寸与所述实际尺寸的比值,将所述比值作为所述web页面截屏请求对应的缩放比例;
图像生成模块,用于根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染;
图像发送模块,用于将所述截屏图像添加到所述邮件界面,生成包含所述截屏图像的邮件并发送。
上述各程序模块所执行的方法可参照本申请web页面截屏方法各个实施例,此处不再赘述。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台服务器设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。
Claims (10)
- 一种web页面截屏方法,其中,所述web页面截屏方法包括如下步骤:在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息;在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸;以及根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像。
- 如权利要求1所述的web页面截屏方法,其中,所述在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息的步骤,包括:在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,确定所述页面标识对应的页面代码;在所述页面代码中添加预设元素标识的html元素,将所述页面代码和所述html元素作为页面信息关联保存;在接收到页面加载请求时,加载所述页面标识对应的页面信息,判断已加载的页面信息中是否存在预设元素标识的html元素;若已加载的页面信息中不存在预设元素标识的html元素,则判定所述页面标识对应的页面信息未加载完成;以及若已加载的页面信息中存在预设元素标识的html元素,则判定所述页面标识对应的页面信息已加载完成。
- 如权利要求1所述的web页面截屏方法,其中,所述在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸的步骤,包括:在所述页面标识对应的页面信息加载完成时,获取所述页面信息中预设元素标识的html元素;以及以所述html元素为起点,计算与所述html元素相邻的sibling元素的元素总尺寸,将所述元素总尺寸作为所述页面标识对应web页面的实际尺寸。
- 权利要求1所述的web页面截屏方法,其中,所述根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像的步骤之前,包括:输出比例设置提示,以供用户基于所述比例设置提示设置截屏图像的缩放比例;获取基于所述比例设置提示输入的缩放比例,将所述缩放比例作为所述web页面截屏请求对应的缩放比例;所述根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像的步骤,包括:计算所述实际尺寸和所述缩放比例的乘积,将所述乘积作为显示尺寸,根据所述显示尺寸进行页面渲染,生成截屏图像。
- 如权利要求1至4任意一项所述的web页面截屏方法,其中,所述根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像的步骤之后,包括:在接收到截屏图像分享指令时,获取所述截屏图像分享指令对应的用户标识;以及将所述截屏图像并保存到目标路径,生成所述目标路径对应的链接信息,并将所述链接信息发送至所述用户标识对应的客户端。
- 如权利要求1至4任意一项所述的web页面截屏方法,其中,所述根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像的步骤之后,包括:在接收到基于所述截屏图像触发的邮件发送请求时,获取所述邮件发送请求对应的收件人标识;以及将所述截屏图像添加到所述邮件发送请求对应的邮件界面,生成包含所述截屏图像的邮件并发送所述收件人标识对应的客户端。
- 如权利要求1所述的web页面截屏方法,其中,所述在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息的步骤之前,包括:在接收到基于邮件界面触发的图像添加请求时,获取所述图像添加请求对应的页面标识,并基于所述页面标识触发web页面截屏请求;所述在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸的步骤之后,包括:获取所述邮件界面的界面尺寸,计算所述界面尺寸与所述实际尺寸的比值,将所述比值作为所述web页面截屏请求对应的缩放比例;根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染;以及将所述截屏图像添加到所述邮件界面,生成包含所述截屏图像的邮件并发送。
- 一种web页面截屏装置,其中,所述web页面截屏装置包括:请求接收模块,用于在接收到web页面截屏请求时,获取所述web页面截屏请求对应的页面标识,并加载所述页面标识对应的页面信息;尺寸计算模块,用于在所述页面标识对应的页面信息加载完成时,根据所述页面信息计算所述页面标识对应web页面的实际尺寸;以及图像生成模块,用于根据所述实际尺寸和所述web页面截屏请求对应的缩放比例进行页面渲染,生成截屏图像。
- 一种web页面截屏设备,其中,所述web页面截屏设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的web页面截屏程序,所述web页面截屏程序被所述处理器执行时实现如权利要求1至7中任一项所述的web页面截屏方法的步骤。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有web页面截屏程序,所述web页面截屏程序被处理器执行时实现如权利要求1至7中任一项所述的web页面截屏方法的步骤。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910959926.6A CN110704784A (zh) | 2019-10-10 | 2019-10-10 | web页面截屏方法、装置、设备及计算机可读存储介质 |
CN201910959926.6 | 2019-10-10 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021068765A1 true WO2021068765A1 (zh) | 2021-04-15 |
Family
ID=69200127
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/117821 WO2021068765A1 (zh) | 2019-10-10 | 2020-09-25 | web页面截屏方法、装置、设备及计算机可读存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110704784A (zh) |
WO (1) | WO2021068765A1 (zh) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110704784A (zh) * | 2019-10-10 | 2020-01-17 | 深圳前海微众银行股份有限公司 | web页面截屏方法、装置、设备及计算机可读存储介质 |
CN111324263B (zh) * | 2020-01-21 | 2021-09-03 | 维沃移动通信有限公司 | 一种截屏方法、电子设备以及计算机可读存储介质 |
CN111428162A (zh) * | 2020-03-20 | 2020-07-17 | 支付宝(杭州)信息技术有限公司 | 一种页面截图方法及装置 |
CN112035205A (zh) * | 2020-08-31 | 2020-12-04 | 深圳前海微众银行股份有限公司 | 数据处理方法、装置、设备和存储介质 |
CN114968423B (zh) * | 2021-02-19 | 2024-05-14 | 华为技术有限公司 | 一种长页面截屏方法及电子设备 |
CN112948737A (zh) * | 2021-03-15 | 2021-06-11 | 亿海蓝(北京)数据技术股份公司 | Html页面截图方法及系统 |
CN113382083B (zh) * | 2021-06-30 | 2022-12-23 | 建信金融科技有限责任公司 | 一种网页截图方法和装置 |
CN113590564B (zh) * | 2021-07-29 | 2024-03-01 | 挂号网(杭州)科技有限公司 | 数据存储方法、装置、电子设备及存储介质 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050235222A1 (en) * | 2002-03-04 | 2005-10-20 | Microsoft Corporation | Legibility of selected content |
CN102708540A (zh) * | 2012-04-21 | 2012-10-03 | 上海量明科技发展有限公司 | 一种针对截屏区域进行缩放的方法及客户端 |
CN107748644A (zh) * | 2017-11-20 | 2018-03-02 | 珠海市魅族科技有限公司 | 一种截图显示方法和设备、终端及可读存储介质 |
CN110704784A (zh) * | 2019-10-10 | 2020-01-17 | 深圳前海微众银行股份有限公司 | web页面截屏方法、装置、设备及计算机可读存储介质 |
-
2019
- 2019-10-10 CN CN201910959926.6A patent/CN110704784A/zh active Pending
-
2020
- 2020-09-25 WO PCT/CN2020/117821 patent/WO2021068765A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20050235222A1 (en) * | 2002-03-04 | 2005-10-20 | Microsoft Corporation | Legibility of selected content |
CN102708540A (zh) * | 2012-04-21 | 2012-10-03 | 上海量明科技发展有限公司 | 一种针对截屏区域进行缩放的方法及客户端 |
CN107748644A (zh) * | 2017-11-20 | 2018-03-02 | 珠海市魅族科技有限公司 | 一种截图显示方法和设备、终端及可读存储介质 |
CN110704784A (zh) * | 2019-10-10 | 2020-01-17 | 深圳前海微众银行股份有限公司 | web页面截屏方法、装置、设备及计算机可读存储介质 |
Non-Patent Citations (2)
Title |
---|
MHYOURH: "Python implements web page screenshots, searches the database, and sends regular emails to you every week", BLOG CSDN, 18 November 2018 (2018-11-18), pages 1 - 4, XP009527469, Retrieved from the Internet <URL:https://blog.csdn.net/sinat_38682860/article/details/84205805> * |
QQ415581343: "Know the DOM and DOM loading procedures and how to make the JS script file after DOM loading", BLOG CSDN, 7 May 2014 (2014-05-07), XP009527479 * |
Also Published As
Publication number | Publication date |
---|---|
CN110704784A (zh) | 2020-01-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021068765A1 (zh) | web页面截屏方法、装置、设备及计算机可读存储介质 | |
US9973506B2 (en) | Method and apparatus for clearing notification icon, and storage medium | |
US20180324124A1 (en) | Systems and methods for image sharing | |
KR102450303B1 (ko) | 엔트리들을 위한 옵트-인 영속성을 갖는 메시지 스레드를 유지하는 장치 및 방법 | |
CN110941500B (zh) | 一种界面展示方法及装置 | |
US20140108966A1 (en) | Method, sharing platform, and system for sharing image-editing action | |
US20160277460A1 (en) | Method and apparatus for initiating network conference | |
CN107679214B (zh) | 链接定位方法、装置、终端与计算机可读存储介质 | |
CN107463563B (zh) | 一种浏览器的信息服务处理方法及装置 | |
CA3061623C (en) | File sending in instant messaging applications | |
US20230017725A1 (en) | Device state identification method and apparatus, and intelligent terminal | |
CN113923175B (zh) | 通讯会话的管理方法及装置 | |
WO2021093673A1 (zh) | 邮件发送方法、装置、设备及计算机可读存储介质 | |
WO2024011899A1 (zh) | 微件的加载方法、装置、设备以及存储介质 | |
CN111026669B (zh) | 测试日志管理方法、测试日志管理装置及存储介质 | |
CN113312885B (zh) | 协同操作处理方法、装置、设备以及介质 | |
US20120239783A1 (en) | Remote operation system and remote operation method for terminal | |
CN116112457A (zh) | 消息通知的方法、装置、计算机设备及存储介质 | |
US9467413B2 (en) | Method and system for replying to website update event | |
CN109391537B (zh) | 一种信息处理方法、装置和计算机存储介质 | |
CN114063958B (zh) | 页面分屏显示方法及装置 | |
CN114090118B (zh) | 启动小程序的方法、装置、设备以及存储介质 | |
CN112231011B (zh) | 基于activiti的流程图调整方法、装置、电子设备和存储介质 | |
CN116582639B (zh) | 会议的控制方法、终端设备和存储介质 | |
CN111580808B (zh) | 页面生成方法、装置、计算机设备及存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20874408 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20874408 Country of ref document: EP Kind code of ref document: A1 |