A PDF document generation apparatus, method, electronic device, and storage medium

CN116301678BActive Publication Date: 2026-10-09ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310281455.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-20
Publication Date
2026-10-09
Estimated Expiration
2043-03-20

Smart Images

  • Figure CN116301678B_ABST
    Figure CN116301678B_ABST
Patent Text Reader

Abstract

The embodiment of the present specification provides a PDF document generation device, method, electronic equipment and storage medium, wherein the PDF document generation device realizes ordered printing of multiple times of sending contents into one PDF document by establishing a first page and a second page with a bidirectional communication connection, and realizes the purpose of supporting the demand of a user to orderly print more contents in one PDF document. Moreover, the device does not need to install a third-party client, and does not need to communicate with a server, and can complete the generation of the PDF document locally, and has the characteristics of simple and easy operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments described in this specification relate to the field of computer application technology, specifically to document conversion technology in the field of computer application technology, and more specifically, to an apparatus, method, electronic device, and storage medium for generating PDF documents. Background Technology

[0002] PDF (Portable Document Format) is a portable document file format used for the reliable presentation and exchange of documents. PDF documents are independent of software, hardware, or operating systems, meaning they have excellent compatibility, can operate across platforms, and achieve reliable content display on different platforms.

[0003] Given the advantages mentioned above, converting content from various other documents or web pages into PDF format has become a common need for users in various application scenarios. Therefore, it is necessary to provide a device that makes generating PDF documents relatively simple. Summary of the Invention

[0004] This specification provides a PDF document generation apparatus, method, electronic device, and storage medium through various embodiments to achieve the purpose of easily generating PDF documents.

[0005] In one aspect, one embodiment of this specification provides a PDF document generation apparatus applied to a client, the client being used to create a browser page, the PDF document generation apparatus comprising: a first page and a second page, the first page and the second page having a bidirectional communication connection;

[0006] The first page is configured to send a plurality of first print requests with a temporal relationship to the second page in response to a print operation on the content of the first page, and to send a second print request to the second page in response to a document generation operation on the print instruction page;

[0007] The second page is used to sequentially respond to the first print request and generate a PDF page corresponding to the document content carried by the first print request, and to respond to the second print request and generate a PDF document according to the generation order of the generated PDF pages.

[0008] Secondly, one embodiment of this specification provides a method for generating a PDF document, applied to a client, the client being used to create a browser page, the method for generating the PDF document comprising:

[0009] In response to a print operation on the content of the first page, multiple first print requests with a temporal relationship are sent to the second page, so that the second page can respond to the first print requests in sequence and generate a PDF page corresponding to the document content carried by the first print request; the first page and the second page establish a bidirectional communication connection.

[0010] In response to a document generation operation for the print instruction page, a second print request is sent to the second page, so that the second page, in response to the second print request, generates a PDF document in the order in which the generated PDF pages were generated.

[0011] Thirdly, one embodiment of this specification provides an electronic device, including: a processor and a memory;

[0012] The memory is connected to the processor and is used to store computer programs;

[0013] The processor is configured to implement the short link sending method or the short link access method described above by running a computer program stored in the memory.

[0014] Fourthly, one embodiment of this specification provides a storage medium storing a computer program that, when executed by a processor, implements the short link sending method or the short link access method described above.

[0015] Fifthly, one embodiment of this specification provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium; a processor of the computer device reads the computer instructions from the computer-readable storage medium, and when the processor executes the computer instructions, it implements the steps of the short link sending method or the short link access method described above.

[0016] This specification provides several embodiments of a PDF document generation apparatus, method, electronic device, and storage medium. The PDF document generation apparatus includes a first page and a second page with a bidirectional communication connection. In response to a print operation on the content of the first page, the first page can send multiple sequentially ordered first print requests to the second page, causing the second page to respond to the first print requests sequentially and generate PDF pages corresponding to the document content carried in the first print requests. Furthermore, after converting all the document content to be printed into corresponding PDF pages, the first page can also respond to a document generation operation on the print instruction page and send second print requests to the second page, causing the second page to respond to the second print requests and generate a PDF document according to the generation order of the generated PDF pages, thus completing the PDF document generation process. Using this PDF document generation apparatus, multiple sent contents can be printed sequentially into a single PDF document, fulfilling the user's need to print a large amount of content in an orderly manner within a single PDF document. Moreover, this apparatus does not rely on a third-party client or communicate with a server; it can be completed locally, making it simple and easy to operate. Attached Figure Description

[0017] Figure 1 This is a schematic diagram of the page content provided in this specification;

[0018] Figure 2 This specification provides a method for... Figure 1 The image shown illustrates the effect of converting the page content into a PDF document.

[0019] Figure 3 Another method provided in this specification Figure 1 The image shown illustrates the effect of converting the page content into a PDF document.

[0020] Figure 4 An example of an application scenario for a PDF document generation apparatus provided in the embodiments of this specification;

[0021] Figure 5 A signaling flowchart of a PDF document generation apparatus provided for embodiments of this specification;

[0022] Figure 6 Signaling flowchart of another PDF document generation apparatus provided for embodiments of this specification;

[0023] Figure 7 A schematic diagram of a first page and a second page provided for embodiments of this specification;

[0024] Figure 8Signaling flowchart of another PDF document generation apparatus provided for embodiments of this specification;

[0025] Figure 9 A flowchart illustrating a method for generating a PDF document as provided in the embodiments of this specification;

[0026] Figure 10 This is a schematic diagram of the structure of an electronic device provided for the embodiments of this specification. Detailed Implementation

[0027] Unless otherwise defined, the technical or scientific terms used in the embodiments of this specification shall have the ordinary meaning understood by one of ordinary skill in the art to which this specification pertains. The terms "first," "second," and similar terms used in the embodiments of this specification do not indicate any order, quantity, or importance, but are merely used to avoid confusion of constituent elements.

[0028] Unless the context otherwise requires, throughout this specification, "a plurality of" means "at least two," and "including" is interpreted as open-ended or encompassing, that is, "including, but not limited to." In the description of this specification, terms such as "one embodiment," "some embodiments," "exemplary embodiment," "example," "specific example," or "some examples" are intended to indicate that a particular feature, structure, material, or characteristic associated with that embodiment or example is included in at least one embodiment or example of this specification. The illustrative representations of the above terms do not necessarily refer to the same embodiment or example.

[0029] The technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this specification, and not all embodiments. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.

[0030] Overview

[0031] As described in the background section, when browsing web pages and other content, users may need to convert the web page content (or user-edited web page content) into PDF documents. For example, see [reference]. Figure 1Users can browse and edit a purchase order on a webpage, and make changes to it (such as filling in the quantity of each item). For example, if the purchase order is for Company A's internal use, the page can display information such as the purchase order number, purchaser, purchase date, item number, item name, quantity, and unit price. Users can also fill in this information on the page. After filling in the purchaser (Zhang San), purchase date (March 2, 2023), and the item number, item name, quantity, and unit price (see reference for details), the user can proceed. Figure 1 Users need to convert the edited webpage into a PDF document for use by departments such as purchasing.

[0032] In related technologies, to convert webpage content into PDF documents, users can use browsers that support html2canvas (Hyper Text Markup Language 2.0 Canvas) technology to directly convert the webpage content into a PDF document. However, this method requires the webpage to have already been rendered, and the printed PDF document must be printed exactly as the page was, which does not fully meet printing needs. For example, users using html2canvas technology to convert... Figure 1 After the page shown is converted to PDF, it may appear as follows: Figure 2 The effect shown is due to the original webpage content exceeding the specified length. In this case, the page content is likely to be split into paginated parts, resulting in page content fragmentation (e.g., ...). Figure 2 In some cases, notes that were originally in one column are split across two different pages. This can make the PDF document look unattractive and create reading difficulties for the reader.

[0033] Additionally, when embedded advertisements exist on certain pages, directly printing the page using html2canvas technology will also print the advertisements in the PDF document, causing some content that users need to be invisible (such as...). Figure 3 (As shown).

[0034] Furthermore, the PDF document printing method based on html2canvas technology can only generate one PDF document per print command (for example, when the currently displayed part of the page is converted into one PDF document, the remaining undisplayed part is converted into other PDF documents). When users need to print multiple contents on the page into one PDF document, they still need to manually stitch the individual documents together, which brings inconvenience to the user experience.

[0035] Besides the PDF document printing technology based on html2canvas mentioned above, there are other related technologies that send the printed content to a server and rely on the server to convert it into a PDF document. The main drawback of this technology is that the server's ability to generate the PDF document is technically complex, and the layout and debugging process is cumbersome. Specifically, the server needs to format the printed content and generate a PDF document to save locally. The user needs to open the PDF document locally to see the formatting result. If there are any formatting problems, the printed content needs to be adjusted and sent back to the server, repeating the above process. The whole process is quite cumbersome.

[0036] To address the aforementioned problems, the inventors, through extensive research, discovered a PDF document generation device based on a client capable of creating browser pages. This device establishes a bidirectional communication connection between a first page and a second page. In response to a print operation on the content of the first page, the first page can send multiple sequentially ordered print requests to the second page. The second page then responds to these print requests sequentially, generating PDF pages corresponding to the document content carried in each print request. Furthermore, after converting all the document content to be printed into corresponding PDF pages, the first page can also respond to a document generation operation on the print instruction page by sending a second print request to the second page. The second page then responds to this second print request, generating the PDF document according to the order in which the PDF pages were generated, thus completing the PDF document generation process. This PDF document generation device allows multiple sent contents to be printed sequentially into a single PDF document, fulfilling the user's need to print a large amount of content within a single PDF document. Moreover, this device does not rely on a third-party client or communicate with a server; it can operate locally, offering ease of use and convenience.

[0037] Based on the above concept, this specification provides a PDF document generation apparatus. The following will describe, with reference to the accompanying drawings, the possible application scenarios and feasible implementation methods of the PDF document generation apparatus.

[0038] Scenario Example

[0039] This specification provides an example application scenario for a PDF document generation device, see reference. Figure 4 Users access the page using a client device via a host or other device. They can edit or select the content to be printed on the client's display page. Once the content is finalized, a client-based PDF document generator can convert it into a PDF document, ultimately providing the user with a file named "image.pdf". Figure 4 In addition to showing the content of the PDF document, the manual also shows the editing, view, window, and help buttons for viewing the PDF document. The functions of these buttons will not be described in detail in this manual.

[0040] System Architecture

[0041] This specification provides a host device, which can be an electronic device with network access capabilities. Specifically, for example, the host device can be a desktop computer, tablet computer, laptop computer, smartphone, digital assistant, shopping guide terminal, television set, etc.

[0042] The host machine can run a client capable of creating browser pages. This client can be a browser or an application built on a browser engine. Applications built on a browser engine can support operations such as creating browser pages. The browser engine is responsible for interpreting webpage syntax and rendering the webpage. The client can also be other applications with browser page creation capabilities.

[0043] Example device

[0044] One embodiment of this specification provides an apparatus for generating PDF documents, such as... Figure 5 As shown, the device is applied to a client, which is used to create a browser page. The PDF document generation device includes a first page and a second page, and the first page and the second page have a bidirectional communication connection.

[0045] The first page is configured to send a plurality of first print requests with a temporal relationship to the second page in response to a print operation on the content of the first page, and to send a second print request to the second page in response to a document generation operation on the print instruction page;

[0046] The second page is used to sequentially respond to the first print request and generate a PDF page corresponding to the document content carried by the first print request, and to respond to the second print request and generate a PDF document according to the generation order of the generated PDF pages.

[0047] As mentioned earlier, the client can be a browser, an application built on a browser kernel, or other applications with browser page creation capabilities. Both the first page and the second page can be browser pages created by the browser. Unlike traditional browser pages, a bidirectional communication connection is established between the first page and the second page. This ensures that when the first page and the second page need to communicate in a specific time sequence, the communication content can maintain its temporal order. Specifically, the first page can send multiple first print requests sequentially, and the second page can respond to these requests sequentially, guaranteeing that multiple first print requests with a temporal relationship can be responded to in sequence. This avoids the problem in related technologies where pages can only send messages once, leading to the inability to perform time-sequential, bidirectional communication.

[0048] In one feasible implementation, refer to Figure 6 The first page sends multiple first print requests with a temporal relationship to the second page. The second page responds to the first print requests sequentially in the following manner: the first page sends the first print request that has not yet received a response and is the one with the earlier time sequence to the second page, according to the temporal relationship of the first print requests; after the second page responds to the first print request, it sends a response completion instruction back to the first page; only after the first page receives the response completion instruction does it send the next first print request, and the above process is repeated until the last first print request (e.g., ...) is sent. Figure 6 The Nth first print request (as shown) is sent to the second page. In this way, it can be ensured that multiple first print requests are responded to in a timely manner, and the order of the multiple PDF pages generated by the second page corresponds to the time sequence of the multiple first print requests.

[0049] The content printing operation can be triggered by clicking the "Confirm Print" button after determining the content to be printed (e.g., the content selected and edited from the content displayed on the first page).

[0050] The document generation operation can be triggered by clicking the "Generate Document" button after all printable content has been delivered to the second page for printing.

[0051] For example, refer to Figure 7 , Figure 7 The diagram illustrates a possible display method for the first and second pages. Figure 7 The first page shows the content the user is browsing, and the second page shows a schematic diagram of the second page. On the first page, content including the content the user wants to print can be displayed for the user to browse and edit. In addition, the first page can also provide "Confirm Print" and "Generate Document" buttons for the user to perform the content printing operation and document generation operation, respectively. In some embodiments, refer to... Figure 7 The second page can be accessed by triggering the "Page Call" button on the first page.

[0052] On the second page, printing options are available, such as references. Figure 7 The printer is set to "Print to PDF," and printing options include "Print as color PDF" and "Print as black and white PDF." In addition, the second page offers other options, such as adjusting page size (e.g., A4, A5) and margins.

[0053] The document content carried by the first print request can include text, data, images, and print styles. In this way, on the one hand, the document content does not need to be rendered on the first page, which helps to reduce costs; on the other hand, when the document content carried by each first print request comes from multiple interface data sources and print styles, it is possible to generate first print requests for multiple interface data sources and print styles respectively, and integrate them into a time-series PDF page on the second page, and finally integrate them into a complete PDF document, which is conducive to realizing an overall printing technology solution system.

[0054] In this embodiment, the PDF document generation device establishes a bidirectional communication connection between a first page and a second page, enabling the orderly printing of multiple transmitted contents into a single PDF document. This fulfills the user's need to print a large amount of content within a single PDF document. Furthermore, the device requires no third-party client installation or server communication; it can generate PDF documents locally, making it simple and easy to use.

[0055] In some implementations, the first page is further configured to, in response to a page call operation for the first page, establish the second page within the client and establish the bidirectional communication connection with the second page.

[0056] Still referencing Figure 7 The page invocation operation can be triggered by the "Page Invocation" button on the first page. In this case, the first page creates a second page within the client and establishes a two-way communication connection with it, preparing for the subsequent printing of the PDF document. Alternatively, the page invocation operation can also be triggered by the "Confirm Print" button on the first page. That is, after the user has confirmed the content to be printed on the first page, they can directly trigger the "Confirm Print" button to invoke the second page and send the first print request.

[0057] By creating a second page from the first page and establishing a two-way communication connection with it, the second page can be hidden when PDF document printing is not required, improving the simplicity of the page and avoiding potential interference to the user when the second page is displayed when printing is not needed.

[0058] One embodiment of this specification provides a feasible way to establish a second page within a client and establish a bidirectional communication connection therewith. Specifically, the first page establishes a page loaded with a PDF generation tool within the client, which serves as the second page.

[0059] Based on the bidirectional communication protocol, a bidirectional communication connection is established with the second page.

[0060] By creating a page that loads a PDF generation tool, the second page can seamlessly convert content to PDF format without the user noticing. Users will only see an extra second page; they don't need to understand how it generates the PDF or actually operate the tool, thus improving the ease of use of the PDF generation device. The PDF generation tool can be jsPDF (JavaScript PDF), an open-source PDF library that uses JavaScript.

[0061] In another exemplary embodiment of this specification, a feasible method for establishing a bidirectional communication connection with a second page based on a bidirectional communication protocol is provided, see reference. Figure 8 Specifically, it can include:

[0062] The first page sends a connection request message to the second page, the connection request message being used to request the establishment of a bidirectional communication connection with the second page;

[0063] After receiving the first confirmation message returned by the second page in response to the connection request message, a second confirmation message is sent to the second page; the first confirmation message is used to indicate that the second page has received the connection request message, and the second confirmation message is used to indicate that the bidirectional communication connection is established.

[0064] In this embodiment, the specific formats of the connection request message, the first acknowledgment message, and the second acknowledgment message can refer to the message formats sent in the three-way handshake protocol of the TCP protocol (Transmission Control Protocol). In this embodiment, referring to the TCP protocol used for communication between a host and a server, a bidirectional communication connection is established between the first page and the second page, which can ensure that after the first page and the second page know that they have the ability to send and receive information, a reliable and trustworthy bidirectional communication connection is established.

[0065] In some implementations, reference Figure 7 The second page is also used to preview the generated PDF page and / or the PDF document.

[0066] In this embodiment, in addition to printing-related options, the second page also provides some pages for previewing the generated PDF pages and / or PDF documents. This allows the user to preview the PDF page corresponding to the print content carried by the first print command, or the PDF document corresponding to the print content carried by multiple first print commands, on the second page after each first print command is sent. This allows for content preview before the actual production of the PDF document, which helps to avoid generating PDF documents with incorrect content and also facilitates timely debugging of incorrect content, reducing the complexity of the debugging process.

[0067] The presentation of the second page can be adjusted according to different application scenarios or client types, for example, in Figure 7 In this document, the second page includes a pop-up page within the client, which is suitable for applications built on a browser engine. Alternatively, the second page can be a new tab within the client or an embedded page within the first page. When the second page is a new tab within the client, the first and second pages can be displayed separately without interference. When the second page is an embedded page within the first page, the printing effects and printing parameters of the document content can be viewed on the first page. This specification does not limit the specific display format of the second page; it depends on the actual situation.

[0068] Exemplary methods

[0069] Some embodiments of this specification also provide a method for generating PDF documents, such as... Figure 9 As shown, the method for generating the PDF document, applied to a client-side application and used to create a browser page, includes:

[0070] S901: In response to a printing operation on the content of the first page, a plurality of first print requests with a temporal relationship are sent to the second page, so that the second page can respond to the first print requests in sequence and generate a PDF page corresponding to the document content carried by the first print requests; the first page and the second page establish a bidirectional communication connection.

[0071] S902: In response to the document generation operation for the print instruction page, a second print request is sent to the second page, so that the second page, in response to the second print request, generates a PDF document in the order in which the generated PDF pages are generated.

[0072] Optionally, before sending a plurality of sequentially related first print requests to the second page in response to a content print operation on the first page, the method further includes:

[0073] In response to a page call operation on the first page, a second page is created within the client, and a bidirectional communication connection is established with the second page.

[0074] Optionally, establishing the second page within the client and establishing the bidirectional communication connection with the second page includes:

[0075] A page containing a PDF generation tool is created within the client, serving as the second page;

[0076] Based on the bidirectional communication protocol, a bidirectional communication connection is established with the second page.

[0077] The PDF document generation method provided in this embodiment belongs to the same application concept as the PDF document generation apparatus provided in the above embodiments of this specification. Technical details not described in detail in this embodiment can be found in the specific processing content of the PDF document generation apparatus provided in the above embodiments of this specification, and will not be repeated here.

[0078] Example electronic devices, storage media, and software

[0079] This specification also provides an embodiment of an electronic device, see [link to embodiment]. Figure 10 As shown, an exemplary embodiment of this specification also provides an electronic device, including: a memory and a processor, the memory storing a computer program, the processor executing the computer program to perform steps in the PDF document generation method according to various embodiments of this specification described above.

[0080] The internal structure of the electronic device can be as follows: Figure 10 As shown, the electronic device includes a processor, memory, network interface, and input device connected via a system bus. The processor provides computing and control capabilities. The memory of the central control device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the electronic device is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it follows the steps in the PDF document generation method according to various embodiments of this specification described in the above embodiments.

[0081] The processor may include the main processor, as well as baseband chips, modems, etc.

[0082] The memory stores a computer program that executes the technical solution of this invention, and may also store an operating system and other key programs. Specifically, the computer program may include program code, which includes computer operation instructions. More specifically, the memory may include read-only memory (ROM), other types of static storage devices capable of storing static information and instructions, random access memory (RAM), other types of dynamic storage devices capable of storing information and instructions, disk storage, flash memory, etc.

[0083] The processor can be a general-purpose processor, such as a general-purpose processor (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the program of the present invention. It can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0084] Input devices may include devices that receive data and information input by the user, such as keyboards, mice, cameras, scanners, light pens, voice input devices, touch screens, pedometers, or gravity sensors.

[0085] Output devices may include devices that allow information to be output to the user, such as displays, printers, speakers, etc.

[0086] The communication interface may include any transceiver-like device for communicating with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.

[0087] The processor executes the computer program stored in the memory and calls other devices, which can be used to implement the various steps of any of the PDF document generation methods provided in the above embodiments of this application.

[0088] The electronic device may also include a display component and a voice component. The display component may be a liquid crystal display screen or an e-ink display screen. The input device of the electronic device may be a touch layer covering the display component, or a button, trackball or touchpad set on the casing of the electronic device, or an external keyboard, touchpad or mouse, etc.

[0089] Those skilled in the art will understand that Figure 10The structures shown are merely block diagrams of a portion of the structure related to the scheme described in this specification, and do not constitute a limitation on the electronic devices to which the scheme described in this specification is applied. Specific electronic devices may include more or fewer components than those shown in the figures, or may combine certain components, or may have different component arrangements.

[0090] In addition to the methods and devices described above, the PDF document generation method provided in the embodiments of this specification can also be a computer program product, which includes a computer program that, when run by a processor, causes the processor to perform the steps in the PDF document generation method according to various embodiments of this specification as described in the "Exemplary Methods" section above.

[0091] The computer program product described herein can be written in any combination of one or more programming languages ​​to perform the operations of the embodiments described herein. These programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's electronic device, partially on the user's device, as a standalone software package, partially on the user's electronic device and partially on a remote electronic device, or entirely on a remote electronic device or server.

[0092] Furthermore, embodiments of this specification also provide a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor of the steps in the methods for generating PDF documents according to various embodiments of this specification as described in the "Example Methods" section above.

[0093] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this manual are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0094] It is understood that the specific examples in this document are only intended to help those skilled in the art better understand the implementation methods of this specification, and are not intended to limit the scope of this specification.

[0095] It is understood that in the various embodiments described in this specification, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments described in this specification.

[0096] It is understood that the various implementation methods described in this specification can be implemented individually or in combination, and the implementation methods in this specification are not limited in this respect.

[0097] Unless otherwise stated, all technical and scientific terms used in the embodiments of this specification have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of this specification. The term "and / or" as used in this specification includes any and all combinations of one or more of the associated listed items. The singular forms "a," "the," and "the" as used in the embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise.

[0098] It is understood that the processor in the embodiments of this specification can be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this specification. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this specification can be directly implemented by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above methods.

[0099] It is understood that the memory in the embodiments of this specification may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM). It should be noted that the memory in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0100] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software 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 beyond the scope of this specification.

[0101] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the aforementioned method implementations, and will not be repeated here.

[0102] In the several embodiments provided in this specification, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0103] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0104] In addition, the functional units in the various embodiments of this specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0105] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of this specification, in essence, or the parts that contribute to the prior art, or parts of the technical solutions, can be embodied in the form of software products. These computer software products are stored in a storage medium and include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this specification. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0106] The above description is merely a specific embodiment of this specification, but the scope of protection of this specification is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this specification should be included within the scope of protection of this specification. Therefore, the scope of protection of this specification should be determined by the scope of the claims.

Claims

1. A PDF document generation device, characterized in that, Applied to a client, the client is used to create a browser page, and the PDF document generation device includes: a first page and a second page, the first page and the second page having a bidirectional communication connection, and the first page and the second page being browser pages; The first page is configured to send multiple first print requests with a temporal relationship to the second page in response to a content print operation on the first page, and to send a second print request to the second page in response to a document generation operation on the first page; The second page is configured to sequentially respond to the first print request, generate a PDF page corresponding to the document content carried by the first print request, such that the order of the multiple PDF pages generated by the second page corresponds to the time sequence of the multiple first print requests; and to generate a PDF document in response to the second print request, according to the generation order of the generated PDF pages. The step of sending multiple first print requests with a temporal relationship to the second page includes: the first page sending the first print request that has not received a response and is earlier in the time sequence to the second page according to the temporal relationship of the first print requests; the first page sending the next first print request to the second page in response to the feedback response completion instruction for the first print request, and repeating the above process until the last first print request is sent to the second page, wherein the response completion instruction is sent from the second page to the first page.

2. The apparatus according to claim 1, characterized in that, The first page is also configured to, in response to a page call operation for the first page, establish the second page within the client and establish the bidirectional communication connection with the second page.

3. The apparatus according to claim 2, characterized in that, The first page creates the second page within the client, and the bidirectional communication connection between the first page and the second page is specifically used for: A page containing a PDF generation tool is created within the client, serving as the second page; Based on the bidirectional communication protocol, a bidirectional communication connection is established with the second page.

4. The apparatus according to claim 3, characterized in that, The first page, based on a bidirectional communication protocol, establishes a bidirectional communication connection with the second page specifically for: The first page sends a connection request message to the second page, the connection request message being used to request the establishment of a bidirectional communication connection with the second page; After receiving the first confirmation message returned by the second page in response to the connection request message, a second confirmation message is sent to the second page; The first confirmation message is used to indicate that the second page has received the connection request message, and the second confirmation message is used to indicate that the bidirectional communication connection has been established.

5. The apparatus according to claim 1, characterized in that, The second page is also used to preview the generated PDF page and / or the PDF document.

6. The apparatus according to any one of claims 1 to 5, characterized in that, The second page includes any one of the following: a new tab page within the client, an embedded page within the first page, and a pop-up page within the client.

7. A method for generating a PDF document, characterized in that, Applied to a client-side application, the client is used to create a browser page, and the method for generating the PDF document includes: In response to a print operation on the content of the first page, multiple first print requests with a temporal relationship are sent to the second page, so that the second page can respond to the first print requests in sequence and generate a PDF page corresponding to the document content carried by the first print request, so that the order of the multiple PDF pages generated by the second page corresponds to the temporal order of the multiple first print requests; the first page and the second page establish a bidirectional communication connection, and the first page and the second page are browser pages; In response to the document generation operation for the first page, a second print request is sent to the second page, so that the second page can generate a PDF document in the order in which the generated PDF pages are generated in response to the second print request; The step of sending multiple first print requests with a temporal relationship to the second page includes: the first page sending the first print request that has not received a response and is earlier in the time sequence to the second page according to the temporal relationship of the first print requests; the first page sending the next first print request to the second page in response to the feedback response completion instruction for the first print request, and repeating the above process until the last first print request is sent to the second page, wherein the response completion instruction is sent from the second page to the first page.

8. The method according to claim 7, characterized in that, Before sending multiple sequentially related first print requests to the second page in response to a content print operation on the first page, the method further includes: In response to a page call operation on the first page, a second page is created within the client, and a bidirectional communication connection is established with the second page.

9. The method according to claim 8, characterized in that, The step of establishing the second page within the client and establishing the bidirectional communication connection with the second page includes: A page containing a PDF generation tool is created within the client, serving as the second page; Based on the bidirectional communication protocol, a bidirectional communication connection is established with the second page.

10. An electronic device, characterized in that, include: Processor and memory; The memory is connected to the processor and is used to store computer programs; The processor is configured to implement the PDF document generation method as described in any one of claims 7 to 9 by running a computer program stored in the memory.

11. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the PDF document generation method as described in any one of claims 7 to 9.