A method and device for printing browser content

By setting up a receiving container on the terminal device, listening to the client port and calling the corresponding print processor, the problem of cross-browser printing is solved, support for different browsers and multiple protocols is achieved, and the flexibility and efficiency of printing are improved. .

CN113536170BActive Publication Date: 2024-08-30SHENZHEN MINGYUAN CLOUD TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110730030.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-29
Publication Date
2024-08-30
Estimated Expiration
2041-06-29

AI Technical Summary

Technical Problem

The existing technology is difficult to implement cross-browser printing, especially for browsers that do not support embedded plug-ins, and cannot effectively print web page content.

Method used

By setting up a receiving container on the terminal device, listening to the client port to receive print requests and data from any browser, and calling the corresponding print processor according to the data type, cross-browser and multi-protocol printing functions are realized.

Benefits of technology

It can receive print requests and respond to print data regardless of browser type, supports multiple protocols (such as HTTP and HTTPS), and can handle multiple print requests at the same time, improving printing flexibility and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113536170B
    Figure CN113536170B
Patent Text Reader

Abstract

The present application relates to the field of computer technology and provides a method for printing browser content, comprising: monitoring a port of a client through a receiving container; receiving a first print request and first print data from a first browser from the port; and calling a first print processor to print the first print data according to the first print request. The above method can realize cross-browser printing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method and device for printing browser content. Background Art

[0002] With the continuous development of computer technology, users can access websites of their interest through browsers. Through the website, users can browse the webpage content of their interest, which can be pictures, documents, news information, etc. When users need to print these webpage contents, they need to use a local printer to print them. Usually, technicians embed plug-ins that can realize printing functions in the page, such as ActiveX, Applet, and COM, to call the local printer to print the webpage content. However, this method of embedding various plug-ins in the page to realize printing is only applicable to some browsers, such as IE browser, and is not supported by some browsers.

[0003] Therefore, how to achieve cross-browser printing is an urgent problem that needs to be solved. Summary of the invention

[0004] The present application provides a method and device for printing browser content, which can realize cross-browser printing.

[0005] In a first aspect, a method for printing browser content is provided, comprising: monitoring a port of a client through a receiving container; receiving a first print request and first print data from a first browser from the port; and calling a first print processor to print the first print data according to the first print request.

[0006] The above method can be executed by a printing module on a terminal device. The printing module monitors the port of a client (e.g., a computer) through a receiving container, and waits for the client to send a first printing request and first printing data. The receiving container can receive the first printing request and first printing data sent by any browser of the client by monitoring the port of the client, without being affected by the browser type, so as to realize the cross-browser printing function.

[0007] Optionally, the receiving container is an HttpServer container, and the port includes an Http port and an Https port.

[0008] The Http port of the HttpServer container can receive the first print request and the first print data sent by a part of sites (i.e., websites) through the Http protocol, while the Https port of the HttpServer container can receive the first print request and the first print data sent by another part of sites through the Https protocol, thereby realizing the multi-protocol printing function.

[0009] Optionally, calling the first print processor according to the first print request to print the first print data includes: determining the first print processor from multiple print processors according to the data type information in the first print request, the first print processor being associated with the data type information; and calling the first print processor to print the first print data.

[0010] The receiving container determines the type of material that the user wants to print (for example, word documents, reports, and pictures, etc.) according to the data type information in the first print request, and finds the corresponding print processor according to the material type. For example, if the user wants to print a report, the first print request includes RdlcPrint.aspx information, and the receiving container finds the corresponding report print processor according to the URL address corresponding to the RdlcPrint.aspx information (for example, http: / / 127.0.0.1:53962 / RdlcPrint.aspx); the present application provides a variety of print processors for users to use, which can meet the needs of users to print different types of materials.

[0011] Optionally, calling the first print processor according to the first print request to print the first print data includes: calling the first print processor through a thread pool according to the first print request to print the first print data; the method also includes: receiving a second print request and second print data from a second browser from the port; and calling the second print processor through the thread pool according to the second print request to print the second print data.

[0012] When different users send print requests (e.g., the first print request and the second print request) to the receiving container at the same time, the receiving container can receive multiple print requests at the same time, and find corresponding print processors (e.g., the first print processor and the second print processor) for the multiple print requests at the same time, and then meet the printing needs of different users through thread calls. It can be seen that the method provided by the present application can respond to multiple print requests at the same time.

[0013] Optionally, the first print data is a data URL, and calling the first print processor according to the first print request to print the first print data includes: obtaining print resources from a resource location corresponding to the data URL; and calling the first print processor according to the first print request to print the print resources.

[0014] In a second aspect, a device for printing browser content is provided, comprising a module for executing any one of the methods in the first aspect.

[0015] According to a third aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the method according to any one of the first aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0017] Figure 1 A schematic diagram of the structure of a printing processing system in an embodiment of the present invention;

[0018] Figure 2 A schematic diagram of a method flow for printing browser content in an embodiment of the present invention;

[0019] Figure 3 It is a timing diagram of printing browser content in an embodiment of the present invention;

[0020] Figure 4 A schematic diagram of the internal processing process of the client tool in an embodiment of the present invention;

[0021] Figure 5 It is a schematic diagram of a device for printing browser content provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0023] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0024] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0025] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0026] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0027] The present application is further described in detail below with reference to the accompanying drawings and specific embodiments.

[0028] Figure 1 A printing processing system provided by the present application is shown, which includes a client browser 101, a client printing module 102 and a printer 103. The client browser 101 is used for users to visit some websites of interest and send print requests and print data to the client printing module 102; the client printing module 102 is used to receive the print request and print data sent by the user from the client browser 101, and process the print request and print data to send a print document to the printer 103; the printer 103 is used to receive the print document sent by the client printing module 102, and print resources for the user according to the print document. For example, the user visits the website of interest on the client browser 101 and browses the webpage content of interest on the website. When the user wants to print some webpage content, the user can send a print request and print data to the client printing module 102 through the client browser 101. When the client printing module 102 receives the print request and print data, it processes the print request and print data to allocate a corresponding print processor for the print request and print data, and the print processor generates a print document and sends it to the printer 103. The printer 103 performs a printing operation after receiving the print document. After the printer 103 completes the printing operation, it sends a feedback message indicating that the printing is successful (or failed) to the printing module 102 of the client. The printing module 102 of the client sends the received feedback message to the client browser 101. The client browser 101 informs the user that the printing operation is completed and the user can go to the printer 103 to get the printed materials.

[0029] In order to process the print requests sent by users from different browsers, this application proposes a method for printing browser contents, which can realize the function of cross-browser printing. Figure 2 As shown, the method can be executed by a printing module of a client (i.e., a terminal device), and the method includes:

[0030] S201, listening to the client port through the receiving container.

[0031] The printing module of the client includes a receiving container, which includes an HttpServer container. The HttpServer container is used to receive a first print request and first print data sent by a browser of the client. The HttpServer container monitors the port of the client (i.e., the terminal device). The browser of the client sends the first print request and the first print data to the HttpServer container through the port. Since different websites use different transmission protocols, in order to meet various printing requests of users, the ports monitored by the HttpServer container on the client include an Http port and an Https port, wherein the Http port is used to receive the first print request and the first data sent via the Hyper Text Transfer Protocol (HTTP); and the Https port is used to receive the first print request and the first data sent via the Hyper Text Transfer Protocol over Secure Socket Layer (HTTPS), thereby realizing that the HttpServer container can receive the first print request and the first print data sent by any website.

[0032] S202, receiving a first print request and first print data from a first browser from the port.

[0033] Exemplarily, a user visits a website of interest through a first browser of a client. When the user wants to print a certain webpage content, the first browser can send a first print request and first print data to a print module of a client (i.e., a terminal device). The first browser can be any type of browser, such as IE browser, Google Chrome, Firefox, and Sogou browser, etc. This application does not impose any restrictions on the type and version of the first browser. The first browser uses an asynchronous method (e.g., AJAX method) to initiate a print request to the print module of the client based on the first print request and the first print data initiated by the user. After sending the print request, the first browser can handle other things instead of staying on the print page to wait for the printing to end, thereby avoiding the situation where the page freezes during the printing of the page content, causing the user to be unable to perform other operations.

[0034] The above-mentioned first print request includes a print request message type, and the print request message type is used to inform the receiving container of what type of resource the user wants to print, so that the receiving container can find the corresponding print processor for the user according to the first print request; the print request message type includes a picture print request message (for example, Picture.aspx), a document print request message (for example, Documentation.aspx), a template set printing request message (for example, TemplateSettingPrinting.aspx) and a report print request message, for example, the picture print request message is used to inform the receiving container that the user wants to print a picture, the document print request message is used to inform the receiving container that the user wants to print a document, the office set printing request message is used to inform the receiving container that the user wants to set the web page content in the office template, and the report print request message is used to inform the receiving container that the user wants to print a report. This application does not impose any restrictions on the specific content of the above-mentioned print request message types.

[0035] The first print data includes specific print data content and a data uniform resource locator (URL). Since the data URL is the server address where the print data content is located, the print resource (i.e., the print data content) can be obtained from the resource location corresponding to the data URL, so that the receiving container can call the first print processor to print the print resource according to the first print request. For example, the first print data sent by the browser is a paper. When the print processor receives the paper, it can generate a print document for the paper and send the print document to the printer for printing; if the first print data sent by the browser is the server address where the report data is located, when the print processor receives the server address where the report data is located, it needs to first log in to the server according to the server address where the report data is located to obtain the report data to be printed, and then generate a print document from the report data and send the print document to the printer for printing.

[0036] The printing module of the client can be implemented using any development language, such as JAVA, C++, etc., and this application does not impose any restrictions on this. In addition, after the printing module of the client is first started, it will add itself to the registry of the operating system of the client (i.e., the terminal device), so that the printing module of the client can automatically run each time the user turns on the computer to provide continuous printing services for the user.

[0037] Exemplarily, if a request sent by website X to the outside is sent via HTTP protocol, when a user accesses website X via browser A and wants to print the content of a web page on website X, for example, the content of the web page is a picture, browser A will use HTTP protocol to send the user's first print request (i.e., picture print request) and first print data (i.e., picture data) to HttpServer container via Http port. When HttpServer container receives the first print request and the first print data, it will query the internal routing rule table according to the first print request message type (i.e., picture print request message), as shown in Table 1, so as to find the print processor type (e.g., picture print processor) corresponding to the first print request message (e.g., picture print request message). The print processor type includes picture print processor, document print processor, report print processor and template printing processor. The print processor type of the present application is not limited to the listed types, and other print processor types can also be set according to demand, such as PDF print processor type, etc., and the present application does not make any limitation on this.

[0038] Table 1 Routing rules table

[0039]

[0040] The routing rule table is a routing rule registered in the HttpServer container by the print processor module in the client's print module. The routing rule includes the print request message type, print request message format, URL addresses of different types of print processors, and print processor types. The URL addresses of different types of print processors are used by the HttpServer container to find the corresponding print processor type for the first print request and the first print data sent by the A browser. For example, the HttpServer container finds the image print processor for the image print request based on the image print request and the image print data sent by the A browser. The image print processor is the print processor (i.e., the image print processor) pointed to by the image URL address (i.e., http: / / 127.0.0.1:53962 / Picture.aspx). It is hereby explained that if the X website sends a request to the outside through the HTTPS protocol, the image URL address where the image print processor is located is https: / / 127.0.0.1:53963 / Picture.aspx.

[0041] S203: Calling a first print processor to print the first print data according to the first print request.

[0042] Exemplarily, a first print processor is determined from a plurality of print processors according to data type information (i.e., print request message type) in a first print request, and there is an association relationship between the first print processor and the data type information (i.e., the print request message type corresponds to a URL address of a print processor, and the URL address of the print processor corresponds to a print processor), as shown in Table 1; the first print processor is called to print the first print data. For example, the HttpServer container finds a URL address of a matching report print processor for the report print request message by searching a routing rule table (see Table 1) according to the print request message type in the first print request, for example, the print request message type is a report print request message, and the URL address of the report print processor points to the report print processor. If the print module of the client is developed using a non-object-oriented language (e.g., C language), after the HttpServer container finds a corresponding print processor (e.g., a report print processor) for the first print request (e.g., a report print request) and the first print data (e.g., report print data), the print processor can generate a print document from the first print data, and send the print document to the printer, and the printer performs a print operation according to the print document. In addition, if the client's printing module is developed using an object-oriented language (e.g., JAVA language, C++ language), after the HttpServer container finds a matching print processor type (e.g., report print processor) for the first print request (e.g., report print request) and the first print data (e.g., report print data), the HttpServer container creates a print processor instance object that can process the first print request and the first print data based on the matching print processor type. The print processor instance object generates a print document from the first print data and sends the print document to the printer. The printer performs a print operation based on the print document.

[0043] Exemplarily, according to the first print request, the first print processor is called through the thread pool to print the first print data; the second print request and the second print data of the second browser are received from the port; according to the second print request, the second print processor is called through the thread pool to print the second print data.

[0044] For example, the first browser sends a first print request and first print data to the HttpServer container through a port (e.g., Http port), and the HttpServer container searches the routing rule table according to the first print request and finds the first print processor (or the first print processor type) corresponding to the first print request. If the print module of the client is developed using a non-object-oriented language (e.g., C language), the HttpServer container searches the routing rule table according to the first print request and finds the first print processor corresponding to the first print request, and the first print processor is used to process the first print request and the first print data. If the print module of the client is developed using an object-oriented language (e.g., JAVA language), the HttpServer container creates a first print processor instance object according to the first print processor type corresponding to the first print request, and the first print processor instance object is used to process the first print request and the first print data; at the same time, the second browser sends a second print request and second print data to the HttpServer container through a port (e.g., Http port), and the HttpServer container searches the routing rule table according to the second print request and finds the second print processor (or the second print processor type) corresponding to the second print request. If the client's print module is developed using a non-object-oriented language (e.g., C language), the HttpServer container searches the routing rule table according to the second print request and finds the second print processor corresponding to the second print request, and the second print processor is used to process the first print request and the first print data. If the client's print module is developed using an object-oriented language (e.g., JAVA language), the HttpServer container creates a second print processor instance object according to the second print processor type corresponding to the second print request, and the second print processor instance object is used to process the second print request and the second print data.

[0045] If the client's printing module is developed using a non-object-oriented language (e.g., C language), the HttpServer container searches the routing rule table according to the first printing request and the second printing request, and finds the first printing processor corresponding to the first printing request and the second printing processor corresponding to the second printing request; or, if the client's printing module is developed using an object-oriented language (e.g., JAVA language), the HttpServer container creates the first printing processor instance object and the second printing processor instance object for the first printing request and the second printing request respectively; the HttpServer container queues the first printing request, the first printing data and the first printing processor (or the first printing processor instance object), and the second printing request, the second printing data and the second printing processor (or the second printing processor instance object) in the background thread pool of the terminal device (or the client), for example, the background operating system of the terminal device (or the client) allocates the first thread to process the first printing request, and the second thread to process the second printing request. When the background operating system processes the first thread, the first printing processor (or the first printing processor instance object) generates an internal printing document according to the agreed parameters, and sends the printing document to the printer, and the printer performs a printing operation according to the printing document. After the printer executes the printing operation, it sends feedback information of printing success or printing failure to the first print processor (or the first print processor instance object). After receiving the feedback information, the first print processor (or the first print processor instance object) sends it to the HttpServer container. The HttpServer container sends the feedback information to the first browser through a port (for example, an Http port), and the first browser displays the feedback information to the user. It is hereby explained that the method of the background operating system processing the second thread is the same as the method of the background operating system processing the first thread, which will not be repeated here.

[0046] The above-mentioned agreed parameters include the print page paper settings and the server address where the print data is located. For example, the print page paper settings include setting the paper size of the print page, setting the page range, setting single-sided and double-sided, setting black and white or color printing, etc.; the server address where the print data is located means that some print data is not the specific print content sent from the browser page, but the server address where the print data is located. The print processor (or print processor instance object) (for example, the first print processor or the first print processor instance object) needs to log in to the server address where the print data is located in order to obtain the print data.

[0047] The first browser and the second browser can be the same browser or different browsers, and the first print request and the second print request can be the same type of print request or different types of requests, and this application does not impose any limitation on this. For example, if browser B sends two identical print requests to the HttpServer container at the same time, for example, the two print requests are both picture print requests; the HttpServer container receives the first picture print request and the first picture print data from the Http port, and can also receive the second picture print request and the second picture print data from the Http port or the Https port; the HttpServer container searches the routing rule table according to the first picture print request and the first picture print data to find the picture print processor (or picture print processor type) corresponding to the first picture print request. If the print module of the client is developed using a non-object-oriented language (for example, C language), the HttpServer container searches the routing rule table according to the first picture print request, and finds the first picture print processor corresponding to the first picture print request, and the first picture print processor is used to process the first picture print request and the first picture print data. If the client's printing module is developed using an object-oriented language (e.g., JAVA), the HttpServer container creates a first image print processor instance object for the first image print request, and the first image print processor instance object is used to process the first image print request and the first image data; at the same time, the HttpServer container searches the routing rule table according to the second image print request and the second image print data to find the image print processor (or image print processor type) corresponding to the second image print request. If the client's printing module is developed using a non-object-oriented language (e.g., C), the HttpServer container searches the routing rule table according to the second image print request and finds the second image print processor corresponding to the second image print request, and the second image print processor is used to process the second image print request and the second image print data. If the client's printing module is developed using an object-oriented language (e.g., JAVA), the HttpServer container creates a second image print processor instance object for the second image print request, and the second image print processor instance object is used to process the second image print request and the second image data.It can be seen that the HttpServer container can receive two identical print requests at the same time. If the client's print module is developed using a non-object-oriented language (for example, C language), the HttpServer container can find a matching print processor for the two identical print requests at the same time; if the client's print module is developed using an object-oriented language (for example, JAVA language), the HttpServer container can create corresponding print processor instance objects (for example, a first image print processor instance object and a second image print processor instance object) for the two identical print requests at the same time, so as to realize the function of responding to two identical print requests at the same time.

[0048] If the client's printing module is developed using a non-object-oriented language (for example, C language), the HttpServer container searches the routing rule table according to the first image printing request and the second image printing request, and finds the first image printing processor corresponding to the first image printing request and the second image printing processor corresponding to the second image printing request; or, if the client's printing module is developed using an object-oriented language (for example, JAVA language), after the HttpServer container allocates the first image printing processor instance object and the second image printing processor instance object to two identical image printing requests, the first image printing request, the first image printing data and the first image printing processor (or the first image printing processor instance object) are placed in the thread pool queue, and at the same time, the second image printing request, the second image printing data and the second image printing processor (or the second image printing processor instance object) are also placed in the background thread pool queue of the terminal device (or client). The background operating system of the terminal device (or client) allocates the first image thread to process the first image print request, and the second image thread user processes the second image print request. When the background operating system processes the first image thread, the first image print processor (or the first image print processor instance object) generates an internal print document according to the agreed parameters, and sends the print document to the printer, and the printer performs a print operation according to the print document. After the printer performs the print operation, it sends feedback information of successful or failed printing to the first image print processor (or the first image print processor instance object). After receiving the feedback information, the first image print processor (or the first image print processor instance object) sends it to the HttpServer container. The HttpServer container sends the feedback information to the first browser through a port (for example, an Http port), and the first browser displays the feedback information to the user. It is hereby explained that the method by which the background operating system processes the second image thread is the same as the method by which the background operating system processes the first image thread, and will not be repeated here.

[0049] Exemplarily, if browser B sends two different print requests to the HttpServer container at the same time, for example, the first print request is a picture print request, and the second print request is a report print request. This embodiment only takes the client's print module developed in an object-oriented language (for example, JAVA language) as an example to illustrate how the client's print module responds to two different print requests at the same time. The HttpServer container receives a picture print request and picture print data from the Http port, and can also receive a report print request and report print data from the Http port or the Https port; the HttpServer container searches the routing rule table according to the picture print request and the picture print data to find the picture print processor type corresponding to the picture print request, and creates a picture print processor instance object for the picture print request according to the picture print processor type, and the picture print processor instance object is used to process the picture print request and the picture data; at the same time, the HttpServer container searches the routing rule table according to the report print request and the report print data to find the report print processor type corresponding to the report print request, and creates a report print processor instance object for the report print request according to the report print processor type, and the report print processor instance object is used to process the report print request and the report print data. It can be seen that the HttpServer container can receive two different print requests at the same time, and create corresponding print processor instance objects (for example, a picture print processor instance object and a report print processor instance object) for the two different print requests at the same time, so as to realize the function of responding to two different print requests at the same time.

[0050] After the HttpServer container creates the corresponding image print processor instance object and report print processor instance object for two different print requests, the image print request, image print data and image print processor instance object are placed in the thread pool queue. At the same time, the report print request, report print data and report print processor instance object are also placed in the background thread pool queue of the terminal device (or client). The background operating system of the terminal device (or client) allocates the image thread to process the image print request, and the report thread user processes the report print request. When the background operating system processes the report thread, the report print processor instance object generates an internal print document according to the agreed parameters and sends the print document to the printer. The printer performs the print operation according to the print document. After the printer performs the print operation, it will send feedback information of printing success or printing failure to the report print processor instance object. After receiving the feedback information, the report print processor instance object sends it to the HttpServer container. The HttpServer container sends the feedback information to the first browser through a port (for example, an Http port), and the first browser displays the feedback information to the user. It is hereby explained that the method for the background operating system to process the image thread is the same as the method for the background operating system to process the report thread, which will not be repeated here.

[0051] For a client printing module developed in a non-object-oriented language (eg, C language), the method for simultaneously responding to two different printing requests is similar to the method for simultaneously responding to two identical printing requests, which will not be described in detail here.

[0052] Exemplarily, if browser B sends multiple print requests to the HttpServer container at the same time, the method by which the HttpServer container processes the multiple print requests is the same as the method by which the above two print requests are processed, and this application will not elaborate on this.

[0053] For ease of understanding, the following Figure 3 and Figure 4 The overall process steps of the method for printing browser content provided by the present application are exemplarily described. First, a timing diagram of the entire process of printing browser content is introduced, such as Figure 3 As shown, the specific process is as follows: (This is to explain, Figure 3 and Figure 4 The client tool takes object-oriented language development as an example to illustrate the entire processing process of implementing the method of printing browser content)

[0054] Step 301: A user visits a website of interest through a browser of a client. When the user wants to print a certain webpage content, the user can send a first print request and first print data to the print module of the client (i.e., the terminal device) through the browser. The browser sends the customer's print request to the client tool (i.e., the print processing module of the client) through the POST method. The POST method needs to submit the following data to the client tool: a first print request message (e.g., print request message type) and first print data (e.g., data URL, http: / / localhsot:53962 / RdlcPrint.aspx, and body parameters: parameters required for the report).

[0055] Step 302: The receiving container of the client tool (e.g., HttpServer container, Figure 3 The first print request and the first print data sent by the browser of the client are received by the processor (not shown), and the corresponding print processor is searched for the first print request. The print processor sends an HTTP request (i.e., a request for obtaining the content of the print data) to the server where the first print data is located according to the URL parameter (i.e., the first print data) sent by the browser of the client, so as to obtain the specific content of the first print data from the server.

[0056] Step 303: The server returns specific content of the first print data (eg, image data stream) to the print processor according to the received HTTP request.

[0057] Step 304: After receiving the specific content of the first print data, the print processor constructs a print data structure internally (ie, generates a print document).

[0058] Step 305: The print processor sends the generated print document to the printer, and the printer performs a print operation according to the print document. After the printer performs the print operation, it feeds back the information of print success or print failure to the print processor ( Figure 3 not shown).

[0059] Step 306: the print processor sends the information fed back by the printer to the browser of the client, and the browser of the client notifies the user of a message of printing success or printing failure.

[0060] The internal processing of the client tool (i.e. the client's printing module) (such as Figure 4 The process steps are as follows:

[0061] Step 401: Send a print request. When a user browses a web page in a browser and needs to perform a print operation, the browser can send a print request (eg, a first print request) to an HttpServer container (ie, a receiving container) through a port of the client.

[0062] Step 402: Searching the routing rule table. After receiving the print request, the HttpServer container searches the routing rule table according to the print request and selects a matching print processor type.

[0063] Step 403: Obtain a print processor instance. The HttpServer container obtains a print processor instance from a processor factory (if the client tool is implemented using an object-oriented language, the processor factory is a processor factory class here) according to the above matched print processor type.

[0064] Step 404: Return the print processor instance. The processor factory class returns a print processor instance object according to the print processor type. The print processor instance object is used to process print requests and print data.

[0065] Step 405: Submit the print task to the thread pool (queue). Put the print request, print data and print processor instance object in the thread pool queue, and the background operating system of the terminal device (or client) will allocate a print thread to process the print request.

[0066] Step 406: Call the processor (ie, call the print processing instance object). When the background operating system processes the above print thread, it will call the print processor instance object.

[0067] Step 407: Obtain print data. The print processor instance object sends an instruction to obtain the print data content to the server where the print data is located according to the URL address of the print data (eg, data URL).

[0068] Step 408: Return the print data. The server where the print data is located returns the specific content of the print data to the print processor instance object according to the above instructions.

[0069] Step 409: Constructing a print data structure. The print processor instance object constructs a print data structure (ie, generates a print document) according to the specific content of the print data.

[0070] Step 410: Execute the printing action. The print processor instance object sends the generated print document to the printer, and the printer executes the printing operation according to the print document.

[0071] Step 411: Return the print status (success / failure). After the printer completes the print operation, it will feed back the print success or print failure information to the print processor instance object ( Figure 4 (not shown). The print processor instance object sends the print status (ie, print success / print failure) fed back by the printer to the client's browser, and the client's browser notifies the user of the print status.

[0072] Figure 5 The device 500 includes a monitoring module 501 , a receiving module 502 and a processing module 503 .

[0073] The monitoring module 501 is used to monitor the port of the client through the receiving container.

[0074] The receiving module 502 is configured to receive a first print request and first print data from a first browser from a port.

[0075] The processing module 503 is used to call the first print processor to print the first print data according to the first print request.

[0076] The specific manner in which the device 500 executes the method for printing browser content and the beneficial effects produced can refer to the relevant description in the method embodiment.

[0077] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the method described in any method embodiment of the present application is implemented. The computer program can be a high-level language program or an executable target program.

[0078] The computer-readable storage medium is, for example, a memory. The memory may be a volatile memory or a nonvolatile memory, or the memory may include both a volatile memory and a nonvolatile memory. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DRRAM).

[0079] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the device described above and the technical effects produced can refer to the corresponding processes and technical effects in the aforementioned method embodiments, and will not be repeated here.

[0080] In several embodiments provided in the present application, the disclosed systems, devices and methods can be implemented in other ways. For example, some features of the method embodiments described above can be ignored or not performed. The device embodiments described above are merely schematic, and the division of units is only a logical function division. There may be other division methods in actual implementation, and multiple units or components may be combined or integrated into another system. In addition, the coupling between the units or the coupling between the components may be direct coupling or indirect coupling, and the above coupling includes electrical, mechanical or other forms of connection.

[0081] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents, and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A method for printing browser content, characterized in that: The method comprises: The receiving container monitors the port of the client, wherein the receiving container is an HttpServer container; receiving a first print request and first print data from a first browser from the port, wherein the first print request includes a print request message type, and the print request message type is used to inform a receiving container of what type of resource a user wants to print, so that the receiving container can find a corresponding print processor for the user according to the first print request, the first browser is any type of browser, and the first print data includes specific print data content and a data uniform resource locator URL, and the data URL is a server address where the print data content is located; Calling a first print processor to print the first print data according to the first print request includes: searching a routing rule table according to the first print request to determine a first print processor from a plurality of print processors, wherein the print request message type in the first request corresponds to a URL address of a print processor, and the URL address of the print processor corresponds to a print processor; while printing the first print data, receiving from the port a second print request from a second browser and second print data; According to the second print request, a second print processor is called through a thread pool to print the second print data.

2. The method according to claim 1, characterized in that The ports include Http port and Https port.

3. The method according to claim 1 or 2, characterized in that: The step of calling a first print processor according to the first print request to print the first print data includes: According to the first print request, the first print processor is called through a thread pool to print the first print data.

4. The method according to claim 1 or 2, characterized in that: The first print data is a data URL, and the calling of a first print processor to print the first print data according to the first print request includes: Acquire the printing resource from the resource location corresponding to the data URL; The first print processor is called according to the first print request to print the print resource.

5. A device for printing browser content, characterized in that: It includes monitoring module, receiving module and processing module. The monitoring module is used to monitor the port of the client through a receiving container, and the receiving container is an HttpServer container; The receiving module is used to receive a first print request and first print data from a first browser from the port, wherein the first print request includes a print request message type, and the print request message type is used to inform the receiving container what type of resource the user wants to print, so that the receiving container can find a corresponding print processor for the user according to the first print request, and the first browser is any type of browser; The processing module is configured to call a first print processor to print the first print data according to the first print request, and is specifically configured to search a routing rule table according to the first print request to determine the first print processor from a plurality of print processors, wherein the print request message type in the first request corresponds to a URL address of a print processor, and the URL address of the print processor corresponds to a print processor; The device also includes: The receiving module is further used to receive a second print request and second print data from the second browser from the port while printing the first print data; According to the second print request, a second print processor is called through a thread pool to print the second print data.

6. The device according to claim 5, characterized in that The ports include Http port and Https port.

7. The device according to claim 5 or 6, characterized in that The step of calling a first print processor according to the first print request to print the first print data includes: According to the first print request, the first print processor is called through a thread pool to print the first print data.

8. The device according to claim 5 or 6, characterized in that The first print data is a data URL, and the calling of a first print processor to print the first print data according to the first print request includes: Acquire the printing resource from the resource location corresponding to the data URL; The first print processor is called according to the first print request to print the print resource.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method and system for realizing Web end self-defined format printing on basis of B / S framework

    CN107463348A

  • Browser-based printing method and device, apparatus and storage medium

    CN109542366A

  • Method for automatically configuring printer by terminal

    CN112486429A