File generation method and device and storage medium
By dividing the web page into multiple pages and converting the image and document file separately, the problems of lag and export failure when converting the web page into PDF files are solved, and efficient generation and success rate of document files are achieved.
Patent Information
- Application Number
- CN202310807554.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-03
- Publication Date
- 2025-01-03
AI Technical Summary
The prior art is prone to lag and export failure when converting web pages into PDF files, especially when there are too many pages on the web page, which may lead to blank or lag.
By dividing the web page into multiple pages and converting images and document files to each page separately, avoiding one-time image conversion of the entire web page, so that the number of pages generated by the document file is not limited, reducing the occurrence of lag .
It effectively avoids the generated document file being blank, improves the efficiency of document file generation, avoids lag, and ensures the successful generation of document file.
Smart Images

Figure CN119249013A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of file generation, and in particular to a file generation method, device and storage medium. Background Art
[0002] Currently, users are increasingly downloading web page content to local computers for viewing. In the related art, web pages are exported by converting them into portable document format (PDF) files. However, problems such as freezing and export failure may occur during the export of PDF files. Summary of the invention
[0003] In order to overcome the problems existing in the related art, the present disclosure provides a file generation method, device and storage medium.
[0004] According to a first aspect of an embodiment of the present disclosure, a file generation method is provided, the method comprising: acquiring a web page; dividing the web page into pages to obtain a plurality of pages corresponding to the web page, wherein content information corresponding to the plurality of pages constitutes the content information corresponding to the web page; performing image conversion on the plurality of pages to obtain images respectively corresponding to the plurality of pages; and generating a document file corresponding to the web page based on the images respectively corresponding to the plurality of pages.
[0005] In one implementation, dividing the web page into pages includes: determining a target area in the web page, the target area including target content information; and dividing the target area into pages.
[0006] In one embodiment, dividing the web page into pages to obtain multiple pages corresponding to the web page includes: determining the height of the page based on a preconfigured limit height, the height of the page being less than or equal to the limit height; dividing the web page into pages based on the height of the page to obtain multiple pages corresponding to the web page.
[0007] In one embodiment, performing image conversion on the page to obtain the image corresponding to the page includes: establishing a first thread; in the first thread, performing image conversion on the page to obtain the images corresponding to the multiple pages respectively; generating the document file corresponding to the web page based on the images corresponding to the multiple pages respectively includes: establishing a second thread, the second thread is a child thread of the first thread, and the second thread is used to generate the document file corresponding to the web page; in the second thread, generating the document file corresponding to the web page based on the image.
[0008] In one embodiment, the method further includes: controlling the first thread to pass an instruction to the second thread, wherein the instruction is used to instruct the second thread to store the generated document file; in response to the second thread obtaining the instruction and generating the document file, controlling the second thread to store the document file.
[0009] In one embodiment, generating the document file corresponding to the web page based on the pictures corresponding to each page includes: generating sub-document files corresponding to the pictures based on the pictures corresponding to the multiple pages respectively; and combining the sub-document files to obtain the document file.
[0010] In one embodiment, before obtaining the web page, the method further includes: receiving input information, wherein the input information includes content related to a standard operating procedure (SOP); and obtaining the web page includes: rendering the input information to obtain the web page corresponding to the SOP.
[0011] According to a second aspect of an embodiment of the present disclosure, a file generating device is provided, the device comprising: an acquiring module for acquiring a web page; a processing module for dividing the web page into pages to obtain a plurality of pages corresponding to the web page, wherein content information corresponding to the plurality of pages constitutes the content information corresponding to the web page; performing image conversion on the plurality of pages to obtain images respectively corresponding to the plurality of pages; and generating a document file corresponding to the web page based on the images respectively corresponding to the plurality of pages.
[0012] In one implementation, the processing module is further used to: determine a target area in the webpage, the target area including target content information; and divide the target area into pages.
[0013] In one embodiment, the processing module divides the web page into pages in the following manner to obtain multiple pages corresponding to the web page: based on a pre-configured limit height, determining the height of the page, the height of the page is less than or equal to the limit height; based on the height of the page, dividing the web page into pages to obtain multiple pages corresponding to the web page.
[0014] In one embodiment, the processing module performs image conversion on the page to obtain the image corresponding to the page in the following manner: establish a first thread; in the first thread, perform image conversion on the page to obtain the images corresponding to the multiple pages respectively; establish a second thread, the second thread is a child thread of the first thread, and the second thread is used to generate a document file corresponding to the web page; in the second thread, generate the document file corresponding to the web page based on the image.
[0015] In one embodiment, the processing module is also used to: control the first thread to pass instructions to the second thread, the instructions being used to instruct the second thread to store the generated document file; in response to the second thread obtaining the instructions and generating the document file, control the second thread to store the document file.
[0016] In one embodiment, the processing module generates a document file corresponding to the web page based on the pictures corresponding to each page in the following manner: based on the pictures corresponding to the multiple pages respectively, generating sub-document files corresponding to the pictures; combining the sub-document files to obtain the document file.
[0017] In one embodiment, before the acquisition module acquires the web page, the processing module is also used to: receive input information, the input information includes content related to the standard operating procedure SOP; the acquisition module acquires the web page in the following manner: render the input information to obtain the web page corresponding to the SOP.
[0018] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including: a memory for storing instructions; and a processor for calling the instructions stored in the memory to execute the file generation method in the first aspect or any one of the implementations of the first aspect.
[0019] According to a fourth aspect of an embodiment of the present disclosure, a storage medium is provided, in which instructions are stored. When the instructions are executed by a processor, the file generation method in the first aspect or any one of the implementations of the first aspect is executed.
[0020] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects: by dividing a web page into multiple pages, converting the multiple pages into images respectively, and generating a document file, the generated document file is effectively avoided from being blank, so that the number of pages of the generated document file is not limited. Since the image conversion is not performed on the entire web page, the jamming phenomenon can also be avoided.
[0021] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0023] Figure 1 The present invention is a flowchart of a method for generating a file according to an exemplary embodiment.
[0024] Figure 2The figure is a schematic diagram showing a method of dividing a web page into pages according to an exemplary embodiment.
[0025] Figure 3 The figure is a schematic diagram showing another method of dividing a web page into pages according to an exemplary embodiment.
[0026] Figure 4 The figure is a flowchart of another file generating method according to an exemplary embodiment.
[0027] Figure 5 The figure is a flowchart of another file generating method according to an exemplary embodiment.
[0028] Figure 6 The figure is a flowchart of another file generating method according to an exemplary embodiment.
[0029] Figure 7 The figure is a flowchart of another file generating method according to an exemplary embodiment.
[0030] Figure 8 The figure is a flowchart of another file generating method according to an exemplary embodiment.
[0031] Fig. 9 The figure is a flowchart of another file generating method according to an exemplary embodiment.
[0032] Fig.10 The figure is a flowchart of another file generating method according to an exemplary embodiment.
[0033] Fig.11 The invention is a block diagram of a file generating device according to an exemplary embodiment.
[0034] Fig.12 It is a block diagram of another file generating device according to an exemplary embodiment. DETAILED DESCRIPTION
[0035] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present disclosure.
[0036] Currently, users are increasingly downloading web page content to local computers for viewing. In related technologies, web pages are exported by converting them into PDF files. However, problems such as freezing and export failure may occur during the PDF file export process.
[0037] In the related art, a web page is exported to a PDF file through a browser plug-in. For example, the browser plug-in may be window.print. However, the effect of this method is uncontrollable and may cause a disordered layout of the web page.
[0038] In another related technology, a screenshot tool is used to take a screenshot of a web page to generate an image, and then a PDF generation tool is used to convert the generated image into a PDF file. However, this method also has many problems. For example, if the number of pages on a web page is too large and exceeds the height limit of the browser for rendering images, the generated image will be a blank image or the page will freeze.
[0039] Therefore, the present disclosure provides a file generation method, which effectively avoids the situation where the generated document file is blank by dividing a web page into multiple pages, converting the multiple pages into images respectively, and generating a document file, so that the number of pages of the generated document file is not limited. Since the image conversion is not performed on the entire web page, the jamming phenomenon can also be avoided.
[0040] Among them, the file generation method can be applied to a terminal, which can also be called a terminal device, a mobile station (MobileStation, MS), a mobile terminal (Mobile Terminal, MT), etc. It is a device that provides voice and / or data connectivity to users. For example, the terminal can be a handheld device with wireless connection function, a vehicle-mounted device, etc. At present, some examples of terminals are: smart phones (Mobile Phone), pocket computers (Pocket Personal Computer, PPC), handheld computers, personal digital assistants (Personal Digital Assistant, PDA), laptops, tablet computers, wearable devices, or vehicle-mounted devices, etc. In addition, when it is a vehicle-to-everything (V2X) communication system, the terminal device can also be a vehicle-mounted device. It should be understood that the embodiments of the present disclosure do not limit the specific technology and specific device form adopted by the terminal.
[0041] Figure 1 is a flowchart of a method for generating a file according to an exemplary embodiment. Figure 1 As shown, the file generation method includes the following steps.
[0042] In step S11, a web page is obtained.
[0043] In one implementation, the terminal may obtain a web page, wherein a web page refers to a basic element of a website, and a website is composed of web pages, and a web page contains a large amount of network content, such as text, pictures, links, and the like.
[0044] In step S12, the web page is divided into pages to obtain a plurality of pages corresponding to the web page.
[0045] In one implementation, the terminal may divide the web page into multiple pages. The multiple corresponding content information constitutes the content information corresponding to the web page. For example, Figure 2 As shown, the terminal divides the web page into page one and page two.
[0046] In one embodiment, the content information of a web page is divided into content information of multiple modules. Figure 3 As shown, the terminal can divide the content information of several modules into one page according to the content information of the web page. This method can avoid the situation where the content information of the same module is divided into different pages.
[0047] In step S13, the page is converted into an image to obtain an image corresponding to the page.
[0048] In one embodiment, the terminal can convert a page into an image. The terminal can call a pre-configured browser plug-in to take a screenshot of a web page. For example, the browser plug-in can be html2canvas. The terminal can use the plug-in to convert a web page into a canvas. The terminal can convert a canvas into an image. For example, the terminal can call a pre-configured method to convert a canvas. Exemplarily, the pre-configured method can be HTMLCanvasElement.toDataURL().
[0049] In step S14, a document file corresponding to the webpage is generated based on the pictures corresponding to the multiple pages.
[0050] In one embodiment, the terminal can convert the images corresponding to the multiple pages to generate a document file corresponding to the web page. Exemplarily, the document file can be a PDF file. Of course, the document file can also be a document file in other forms, such as a work document format (word) document, which is not limited in the present disclosure.
[0051] The present invention divides a web page into multiple pages, converts the multiple pages into images respectively, and generates a document file, thereby effectively avoiding the situation where the generated document file is blank, so that the number of pages of the generated document file is not limited. Since the image conversion is not performed on the entire web page, the jamming phenomenon can also be avoided.
[0052] In some embodiments, the present disclosure provides a file generation method, such as Figure 4 The file generation method comprises the following steps.
[0053] In step S21, a target area in the web page is determined.
[0054] In step S22, the target area is divided into pages.
[0055] In one embodiment, the terminal may determine the target area of the webpage. The target area may be an area including target content information. For example, the terminal may determine the target area according to the content layout of the webpage. For another example, the terminal may determine the target area according to the display window of the browser. For another example, the terminal may also determine the target area according to the user's operation.
[0056] The target area is determined according to the user's operation, for example, the user may input certain information, and the target area is determined according to the information. For another example, the user may click to select a certain area, and the area is determined as the target area, etc., which is not limited in the present disclosure.
[0057] In one implementation, the terminal may divide the file content into pages.
[0058] It can be understood that in this embodiment, after step S22, the above steps S13 and S14 may be performed to generate a document file corresponding to the target area of the web page.
[0059] The present disclosure determines the target area of a webpage and divides the target area so as to obtain the document file corresponding to the target area and generate the required document file more accurately.
[0060] In some implementations, the terminal can group multiple pages of a web page according to the height of a single page of the web page and the height limit of the image. The present disclosure provides a file generation method, such as Figure 5 As shown, the file generation method includes the following steps.
[0061] In step S31, the height of the page is determined based on a pre-configured restricted height.
[0062] In one embodiment, the terminal may pre-configure a height limit, wherein the height limit may be considered as the maximum height at which the terminal renders the image. It is understood that if the height of the image to be rendered exceeds the height limit, the terminal cannot render the image.
[0063] In this implementation, the terminal determines the height of the page based on the restricted height, wherein the height of the page is less than or equal to the restricted height corresponding to the image.
[0064] In one embodiment, the content information of a webpage is divided into content information of multiple modules, and the terminal can determine the height corresponding to a single module. The terminal divides several modules into one page according to the height corresponding to the single module and the limited height corresponding to the picture. For example, N modules are divided into one page, and N is a positive integer. Then the size of N can be obtained according to the following formula.
[0065] N*pageHeight <limit
[0066] Formula 1
[0067] Where pageHeight refers to the height of a single module, and limit refers to the height limit of the image. The height of a single module multiplied by N is less than the height limit of the image.
[0068] In step S32, the web page is divided into pages based on the height of the page to obtain a plurality of pages corresponding to the web page.
[0069] In one implementation, the terminal may divide the web page into multiple pages according to the determined height of the page.
[0070] The present disclosure determines the height of a page according to a height limit of an image, thereby dividing a web page into multiple pages. The present disclosure can accurately divide the web page into pages, thereby improving the success rate and efficiency of generating images.
[0071] In some embodiments, the present disclosure provides a method for generating a file, such as Figure 6 As shown, the following steps are included.
[0072] In step S41, a first thread is established.
[0073] In step S42, in the first thread, image conversion is performed on multiple pages to obtain images corresponding to the multiple pages respectively.
[0074] In step S43, a second thread is established.
[0075] In step S44, in the second thread, a document file corresponding to the webpage is generated based on the image.
[0076] In one embodiment, the terminal can establish a first thread. The first thread is used to perform image conversion on the page. The way in which the terminal establishes the first thread can refer to the method in the relevant technology, and the present disclosure will not repeat it here. The terminal performs image conversion on multiple pages based on the established first thread to obtain images corresponding to the multiple pages. The terminal can establish a sub-thread of the first thread, and the sub-thread is used to convert the images generated in the first thread into document files in real time. The present disclosure refers to the sub-thread of the established first thread as the second thread. Among them, the second thread can be a worker thread. Exemplarily, the terminal calls the worker constructor in the first thread to establish a worker thread.
[0077] In one embodiment, the terminal can control the first thread to pass the generated picture to the second thread in real time. Exemplarily, the terminal can pass the picture from the first thread to the second thread through a preconfigured application programming interface (API). Exemplarily, the API interface can be postMessage.
[0078] Of course, the first thread and the second thread may also communicate with each other through other inter-thread communication methods. The API interface proposed in the present disclosure is only exemplary, and the present disclosure does not limit this.
[0079] In the present disclosure, the terminal can convert images of the page based on the first thread, and convert the generated images into document files based on the second thread. Generating document files through multiple threads can improve the efficiency of document file generation, avoid freezes, and save the overhead of the first thread.
[0080] In some embodiments, the present disclosure provides a method for generating a file, such as Figure 7 As shown, the following steps are included.
[0081] In step S51, the first thread is controlled to pass instructions to the second thread.
[0082] In step S52, in response to the second thread acquiring the instruction and generating the document file, the second thread is controlled to store the document file.
[0083] In one implementation, the terminal may control the first thread to pass an instruction to the second thread. The instruction may indicate that the first thread converts all pages of the webpage into images, thereby instructing the second thread to generate a document file and store the document file.
[0084] In one embodiment, the terminal may generate a document file in response to the second thread obtaining the instruction and store the document file. The terminal may store the document file in a binary object (blob) in the form of a binary file. The terminal may view the document file in the first thread. Exemplarily, the terminal may create a link in the first thread and automatically click on the link to download the document file from the blob. For example, the connection may be a blob URL.
[0085] It can be understood that the terminal stores the generated document file in the blob by controlling the second thread, and downloads the document file from the blob by controlling the first thread, thereby returning the document file from the second thread to the first thread.
[0086] The present disclosure controls the first thread to pass instructions to the second thread, so that after the second thread obtains the instructions and generates the document file, the document file is returned to the first thread, and the document file can be viewed in the first thread. The present disclosure enables users to quickly preview or download document files, improves the efficiency of generating document files, and enhances the user experience.
[0087] In some embodiments, the present disclosure provides a method for generating a file, such as Figure 8 As shown, the following steps are included.
[0088] In step S61, based on the pictures corresponding to the multiple pages, sub-document files corresponding to the pictures are generated.
[0089] In step S62, the sub-document files are combined to obtain a document file.
[0090] In one embodiment, the terminal can generate a sub-document file corresponding to each image. The terminal combines the generated multiple sub-document files to obtain a document file. Among them, the terminal can combine the sub-document files through jspdf. Of course, the method of combining sub-document files into a document file can also refer to other methods in the relevant technology, and the present disclosure does not limit this.
[0091] The present disclosure generates document files respectively from pictures corresponding to each page, and combines multiple document files to obtain a final document file, so that the first thread and the second thread can be performed simultaneously, thereby improving efficiency.
[0092] In some embodiments, the present disclosure provides a method for generating a file, such as Fig. 9 As shown, the following steps are included.
[0093] In step S71, input information is received, where the input information includes content related to standard operating procedures.
[0094] In step S72, the input information is rendered to obtain a web page corresponding to the SOP.
[0095] In one embodiment, the terminal can receive input information. Wherein, the input information includes content related to a standard operating procedure (SOP). A standard operating procedure refers to describing the standard operating procedures and requirements of an event in a unified format for guiding and standardizing daily work. Exemplarily, the content related to the standard operating procedure can be operating steps, etc. After the terminal receives the input information, it lays out and renders the input information to obtain a web page corresponding to the SOP. The terminal can divide the page corresponding to the obtained SOP into pages, and convert the obtained page into an image to obtain an image corresponding to the page, and generate a document file corresponding to the SOP based on the image.
[0096] The present invention receives SOP-related content input by a user, renders it to obtain a web page corresponding to the SOP, and thereby generates a document file corresponding to the SOP. The present invention can standardize the generation of SOP and improve the success rate and efficiency of generating SOP.
[0097] In some implementations, the present disclosure provides a file generation method, the method comprising: in response to the document file completing downloading, deleting the document file in the binary object.
[0098] In one implementation, the terminal may detect whether the document file has been downloaded. If the document file has been downloaded, the document file in the binary object may be deleted to save storage resources and avoid wasting resources.
[0099] In some embodiments, the present disclosure provides a method for generating a file. Fig.10 As shown, the terminal generates a document file corresponding to a web page based on a picture, which can refer to the following steps.
[0100] In step S81, it is determined whether the remaining conversion height of the picture corresponding to the picture is greater than zero.
[0101] In step S82, in response to the remaining conversion height of the picture being greater than zero, based on the offset height, the corresponding part of the picture is inserted into the document file, the remaining conversion height and the offset height corresponding to the picture are updated, and step S81 is executed.
[0102] In step S83, in response to the remaining conversion height of the picture being not greater than zero, a document file is generated.
[0103] In one embodiment, the terminal can determine whether the remaining conversion height of the picture corresponding to the picture is greater than zero. When the conversion starts, the remaining offset height of the picture is equal to the height of the picture, and the offset height is zero. The remaining conversion height of the picture refers to the height corresponding to the part of the picture that has not been converted into a document file. The offset height refers to the height corresponding to the part of the picture converted into a document file in the previous conversion. As shown in the figure, the terminal can move the picture according to the offset height. The moved picture is converted to the part corresponding to the blank page of the document file.
[0104] The present disclosure converts a picture into a document file by judging whether the remaining conversion height of the picture corresponding to the picture is greater than zero and converting the picture into a document file based on the offset height.
[0105] It should be noted that those skilled in the art can understand that the various implementation methods / embodiments involved in the embodiments of the present disclosure can be used in conjunction with the aforementioned embodiments or can be used independently. Whether used alone or in conjunction with the aforementioned embodiments, the implementation principle is similar. In the implementation of the present disclosure, some embodiments are described in terms of implementation methods used together. Of course, those skilled in the art can understand that such examples are not limitations of the embodiments of the present disclosure.
[0106] Based on the same concept, the embodiment of the present disclosure also provides a file generating device.
[0107] It is understandable that the file generation device provided by the embodiment of the present disclosure includes hardware structures and / or software modules corresponding to the execution of each function in order to realize the above functions. In combination with the units and algorithm steps of each example disclosed in the embodiment of the present disclosure, the embodiment of the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the technical solution of the embodiment of the present disclosure.
[0108] Fig.11 is a block diagram of a file generating device 100 according to an exemplary embodiment. Fig.11 The device includes an acquisition module 101 and a processing module 102.
[0109] The acquisition module 101 is used to acquire a web page. The processing module 102 is used to divide the web page into pages to obtain multiple pages corresponding to the web page, wherein the content information corresponding to the multiple pages constitutes the content information corresponding to the web page. The multiple pages are converted into images to obtain images corresponding to the multiple pages. Based on the images corresponding to the multiple pages, a document file corresponding to the web page is generated.
[0110] In one implementation, the processing module 102 is further used to: determine a target area in a webpage; and divide the target area into pages.
[0111] In one embodiment, the processing module 102 divides the web page into pages in the following manner to obtain multiple pages corresponding to the web page: based on a pre-configured limit height, determine the height of the page, the height of the page is less than or equal to the limit height. Based on the height of the page, divide the web page into pages to obtain multiple pages corresponding to the web page.
[0112] In one embodiment, the processing module 102 performs image conversion on the page to obtain an image corresponding to the page in the following manner: establish a first thread. In the first thread, perform image conversion on the page to obtain images corresponding to multiple pages. Establish a second thread, which is a child thread of the first thread and is used to generate a document file corresponding to the web page. In the second thread, generate a document file corresponding to the web page based on the image.
[0113] In one embodiment, the processing module 102 is further used to: control the first thread to pass an instruction to the second thread, the instruction being used to instruct the second thread to store the generated document file. In response to the second thread acquiring the instruction and generating the document file, control the second thread to store the document file.
[0114] In one embodiment, the processing module 102 generates a document file corresponding to a webpage based on the pictures corresponding to each page in the following manner: based on the pictures corresponding to multiple pages, generate sub-document files corresponding to the pictures, and combine the sub-document files to obtain a document file.
[0115] In one embodiment, before the acquisition module 101 acquires the webpage, the processing module 102 is further used to: receive input information, the input information includes content related to the standard operating procedure SOP. The acquisition module 101 acquires the webpage in the following manner: render the input information to obtain a webpage corresponding to the SOP.
[0116] Fig.12 It is a block diagram of a file generating device 200 according to an exemplary embodiment.
[0117] like Fig.12As shown, apparatus 200 may include one or more of the following components: a processing component 202 , a memory 204 , a power component 206 , a multimedia component 208 , an audio component 210 , an input / output (I / O) interface 212 , a sensor component 214 , and a communication component 216 .
[0118] The processing component 202 generally controls the overall operation of the device 200, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 202 may include one or more processors 220 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 202 may include one or more modules to facilitate interaction between the processing component 202 and other components. For example, the processing component 202 may include a multimedia module to facilitate interaction between the multimedia component 208 and the processing component 202.
[0119] The memory 204 is configured to store various types of data to support operations on the device 200. Examples of such data include instructions for any application or method operating on the device 200, contact data, phone book data, messages, pictures, videos, etc. The memory 204 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0120] The power component 206 provides power to the various components of the device 200. The power component 206 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 200.
[0121] The multimedia component 208 includes a screen that provides an output interface between the device 200 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 208 includes a front camera and / or a rear camera. When the device 200 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0122] The audio component 210 is configured to output and / or input audio signals. For example, the audio component 210 includes a microphone (MIC), and when the device 200 is in an operation mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 204 or sent via the communication component 216. In some embodiments, the audio component 210 also includes a speaker for outputting audio signals.
[0123] I / O interface 212 provides an interface between processing component 202 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0124] The sensor assembly 214 includes one or more sensors for providing various aspects of the status assessment of the device 200. For example, the sensor assembly 214 can detect the open / closed state of the device 200, the relative positioning of components, such as the display and keypad of the device 200, the sensor assembly 214 can also detect the position change of the device 200 or a component of the device 200, the presence or absence of user contact with the device 200, the orientation or acceleration / deceleration of the device 200 and the temperature change of the device 200. The sensor assembly 214 can include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 214 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 214 can also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.
[0125] The communication component 216 is configured to facilitate wired or wireless communication between the device 200 and other devices. The device 200 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 216 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 216 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0126] In an exemplary embodiment, the apparatus 200 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0127] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 204 including instructions, and the instructions can be executed by the processor 220 of the device 200 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0128] The present disclosure can effectively avoid the situation where the generated pictures are blank pictures by grouping multiple pages of a webpage and taking screenshots of the multiple pages to obtain pictures corresponding to each page. Since the screenshot is not taken of the entire webpage, the freeze phenomenon can also be avoided.
[0129] It is to be understood that in the present disclosure, "plurality" refers to two or more than two, and other quantifiers are similar. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. The singular forms "a", "the" and "the" are also intended to include plural forms, unless the context clearly indicates other meanings.
[0130] It is further understood that the terms "first", "second", etc. are used to describe various information, but such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other, and do not indicate a specific order or degree of importance. In fact, the expressions "first", "second", etc. can be used interchangeably. For example, without departing from the scope of the present disclosure, the first information can also be referred to as the second information, and similarly, the second information can also be referred to as the first information.
[0131] It is further understood that, although the operations are described in a specific order in the drawings in the embodiments of the present disclosure, it should not be understood as requiring the operations to be performed in the specific order shown or in a serial order, or requiring the execution of all the operations shown to obtain the desired results. In certain environments, multitasking and parallel processing may be advantageous.
[0132] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modifications, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.
[0133] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
Claims
1. A file generation method, characterized in that: The method comprises: Get the web page; Dividing the web page into pages to obtain a plurality of pages corresponding to the web page, wherein content information corresponding to the plurality of pages constitutes content information corresponding to the web page; Performing image conversion on the multiple pages to obtain images corresponding to the multiple pages respectively; Based on the pictures corresponding to the multiple pages, a document file corresponding to the webpage is generated.
2. The method according to claim 1, characterized in that: The dividing the webpage into pages comprises: Determining a target area in the webpage, the target area including target content information; The target area is divided into pages.
3. The method according to claim 1 or 2, characterized in that: The dividing the webpage into pages to obtain a plurality of pages corresponding to the webpage includes: Based on a preconfigured restricted height, determining a height of the page, the height of the page being less than or equal to the restricted height; The web page is divided into pages based on the height of the page to obtain a plurality of pages corresponding to the web page.
4. The method according to claim 1, characterized in that: The performing image conversion on the page to obtain an image corresponding to the page includes: Establish the first thread; In the first thread, performing image conversion on the multiple pages to obtain images corresponding to the multiple pages respectively; The step of generating a document file corresponding to the webpage based on the pictures corresponding to the multiple pages respectively includes: Establishing a second thread, where the second thread is a child thread of the first thread, and the second thread is used to generate a document file corresponding to the webpage; In the second thread, a document file corresponding to the webpage is generated based on the image.
5. The method according to claim 4, characterized in that The method further comprises: Controlling the first thread to pass an instruction to the second thread, wherein the instruction is used to instruct the second thread to store the generated document file; In response to the second thread acquiring the instruction and generating the document file, the second thread is controlled to store the document file.
6. The method according to claim 1, characterized in that The step of generating a document file corresponding to the webpage based on the images corresponding to the multiple pages includes: Based on the pictures respectively corresponding to the multiple pages, generating sub-document files corresponding to the pictures; The sub-document files are combined to obtain a document file.
7. The method according to claim 1, characterized in that Before obtaining the webpage, the method further includes: Receiving input information, wherein the input information includes content related to a standard operating procedure (SOP); The obtaining of the web page comprises: The input information is rendered to obtain the web page corresponding to the SOP.
8. A file generating device, characterized in that: The device comprises: The acquisition module is used to acquire web pages; The processing module is used to divide the web page into pages to obtain multiple pages corresponding to the web page, wherein the content information corresponding to the multiple pages constitutes the content information corresponding to the web page; perform image conversion on the multiple pages to obtain images corresponding to the multiple pages respectively; and generate a document file corresponding to the web page based on the images corresponding to the multiple pages respectively.
9. An electronic device, characterized in that: include: A memory for storing instructions; as well as A processor, configured to call the instructions stored in the memory to execute the file generation method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores instructions, and when the instructions are executed by the processor, the file generation method according to any one of claims 1 to 7 is executed.
