Webpage-based batch printing method and device, electronic equipment and storage medium
By generating the identification array of the page to be printed and using the PhantomJS tool, the problem of the inability to batch print HTML pages in the existing technology is solved, and efficient batch printing of HTML web pages is achieved, and printing efficiency is improved.
Patent Information
- Application Number
- CN202411038495.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-07-31
AI Technical Summary
Existing batch printing technology cannot batch print HTML-based pages, resulting in low printing efficiency.
By generating an identification array of the page to be printed, obtaining page links and parameter information, displaying the print preview interface, and using the PhantomJS tool to take screenshots or build HTML strings to achieve batch printing, supporting print format areas in the form of tables.
It realizes batch printing of HTML web pages, improves printing efficiency and meets different printing needs.
Smart Images

Figure CN119201013A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of print data processing technology, and in particular to a web page-based batch printing method, device, electronic device and storage medium. Background Art
[0002] With the development of computers, the use of printing is becoming more and more common. When people need to convert electronic files into paper files, they need to use a printing device to print. Batch printing can quickly realize one-time printing of various document contents, improving printing efficiency. However, the existing batch printing is for various documents of office software. For HTML-based page printing, each page can only be printed separately, and batch printing is not possible, resulting in low printing efficiency. Summary of the invention
[0003] In order to solve the above problems existing in the prior art, the present invention provides a web-based batch printing method, device, electronic device and storage medium. The technical problem to be solved by the present invention is achieved through the following technical solutions:
[0004] A first aspect of an embodiment of the present invention provides a web page-based batch printing method, comprising the following steps:
[0005] In response to a batch printing instruction of a plurality of pages to be printed triggered on a to-be-printed list page, a printing format area is created; wherein the pages to be printed correspond to a to-be-printed mark, and each of the pages to be printed corresponds to a page link;
[0006] Generate a logo array from the logo to be printed;
[0007] Acquire parameter information of the element of the corresponding print format area and the page link according to the identification array;
[0008] Display the page to be printed according to the parameter information and the page link, and generate a print preview interface;
[0009] In response to the triggered batch printing operation, the print preview interface is printed.
[0010] In one embodiment of the present invention, the print format area is in a table form;
[0011] The step of generating a logo array from the logo to be printed includes:
[0012] Generate a logo array for each logo to be printed; wherein each logo array is an element of the printing format area.
[0013] In one embodiment of the present invention, the step of displaying the page to be printed according to the parameter information and the page link and generating a print preview interface includes:
[0014] When the form type indicated in the parameter information is CAP4 type, obtaining the image of the page to be printed according to the parameter information and the page link;
[0015] The image of the page to be printed is displayed in the print format area to generate a print preview interface.
[0016] In one embodiment of the present invention, the step of obtaining the image of the page to be printed according to the parameter information and the page link includes:
[0017] The image of the page to be printed is obtained using the PhantomJS tool according to the page link and the parameter information.
[0018] In one embodiment of the present invention, displaying the image of the page to be printed in the print format area to generate a print preview interface includes:
[0019] An HTML string including the image of the page to be printed is constructed to display the image of the page to be printed in the print format area, and a print preview interface is generated.
[0020] In one embodiment of the present invention, the page to be printed includes: a full area, a main printing area and at least one additional printing area, and correspondingly, the mark to be printed includes: a full area mark, a main printing mark and at least one additional printing area mark, and the page link includes: a full area link, a main link and at least one additional printing area link;
[0021] The method further comprises:
[0022] The to-be-printed mark corresponding to the to-be-printed page is obtained; the to-be-printed mark is the main printing mark.
[0023] In one embodiment of the present invention, in response to a batch printing instruction of a plurality of pages to be printed triggered on a to-be-printed list page, creating a print format area includes:
[0024] In response to the configuration operation of the to-be-printed pages on the to-be-printed list page and the triggered batch printing instruction of multiple to-be-printed pages, a print format area is created; wherein the configuration operation of the to-be-printed pages is a selection operation of the to-be-printed identification of the to-be-printed pages, and the print format area is in a table form;
[0025] The step of generating a logo array from the logo to be printed includes:
[0026] Generate a logo array for each logo to be printed;
[0027] Determining whether at least two of the to-be-printed marks correspond to the same to-be-printed page;
[0028] If so, the identification array generated by the at least two identifications to be printed is an element of the printing format area.
[0029] A second aspect of an embodiment of the present invention provides a web page-based batch printing device, comprising:
[0030] A creation module, used to create a print format area in response to a batch print instruction of multiple pages to be printed triggered on a to-be-printed list page; wherein the to-be-printed page corresponds to a to-be-printed identifier, and each of the to-be-printed pages corresponds to a page link;
[0031] A generating module, used for generating a logo array from the logo to be printed;
[0032] An acquisition module, used for acquiring parameter information of the element of the corresponding print format area and the page link according to the identification array;
[0033] A preview module, used to display the page to be printed according to the parameter information and the page link, and generate a print preview interface;
[0034] The printing module is used to print the print preview interface in response to a triggered batch printing operation.
[0035] A third aspect of an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a web-based batch printing method provided by the first aspect of an embodiment of the present invention is implemented.
[0036] A fourth aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the web-based batch printing method provided by the first aspect of the embodiment of the present invention is implemented.
[0037] Beneficial effects of the present invention:
[0038] The present invention stores multiple identifications to be printed in the form of an array, obtains page links by reading the identification array, displays and performs batch printing according to the format of the required printing format area, realizes batch printing of HTML web pages according to demand, and improves the printing efficiency of HTML web pages while meeting the printing demand.
[0039] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.
[0040] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0042] Figure 1 A schematic diagram of a process flow of a web page-based batch printing method provided by an embodiment of the present invention;
[0043] Figure 2 A block diagram of a web page-based batch printing device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0044] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.
[0045] like Figure 1 As shown, a first aspect of an embodiment of the present invention provides a web page-based batch printing method, comprising the following steps:
[0046] Step 11: Create a print format area in response to a batch print instruction of multiple pages to be printed triggered on a to-be-printed list page.
[0047] Among them, the page to be printed corresponds to a to-be-printed mark, and each page to be printed corresponds to a page link.
[0048] In this step, the print format area is created according to the required print format, which is the typesetting format of the final printed file, such as table format, text HTML format, word, Excel, etc. Before or after triggering the batch print command, the print format can be selected, and the print format area can be created according to the selected format, such as creating a table format area or a word format area. The print format area can be formatted, such as the row and column width and height of the table, the line frame width and color, etc.
[0049] Step 12, generating a logo array from the logo to be printed.
[0050] Step 13: Obtain parameter information and page links of elements in the corresponding print format area according to the identification array.
[0051] Step 14: Display the page to be printed according to the parameter information and the page link, and generate a print preview interface.
[0052] Step 15: In response to the triggered batch printing operation, print a print preview interface.
[0053] In this embodiment, multiple identifications to be printed are stored in the form of an array, page links are obtained by reading the identification array, and batch printing is performed according to the format of the required printing format area, thereby realizing batch printing of HTML web pages according to demand, while meeting printing needs and improving the printing efficiency of HTML web pages.
[0054] A second aspect of an embodiment of the present invention provides a web page-based batch printing method, comprising the following steps:
[0055] Step 21 : creating a print format area in response to a batch print instruction of a plurality of pages to be printed triggered on a to-be-printed list page.
[0056] The page to be printed is associated with a to-be-printed identifier, and each page to be printed corresponds to a page link.
[0057] In this embodiment, the print format area is specifically described by taking a table as an example. In this embodiment, the page to be printed is the entire page of a web page by default. Reading the page link can obtain the content of the page. The page title to be printed is displayed on the to-be-printed list page. The page title is associated with the page link. A selection box is displayed before each page title. You can check multiple selection boxes to select. The checked ones are the pages to be printed. After checking, click the batch print button of the to-be-printed list page, and then create a print format area. In this embodiment, the default print format area is a table.
[0058] In addition, for the print format area in the form of a table, the properties of the table can be pre-configured, and the format type and properties of the print format area can be set after clicking the batch print button, and the properties are the line frame width, each line width, etc. In this embodiment, usually each page to be printed occupies one line of the table, and the width of each line can be 100% by default according to the paper size, or it can be set by itself, and the height of each line is adaptive according to the content of the page to be printed.
[0059] Step 22, generating a logo array from the logo to be printed.
[0060] The specific steps of step 22 are: obtaining the to-be-printed identification associated with the to-be-printed page, and generating an identification array for each to-be-printed identification, wherein each identification array is an element of the print format area.
[0061] In this embodiment, the content in a row of the table-like printing format area is an element. The printing format area (table) for batch printing of multiple pages to be printed has multiple rows, and an element in each row corresponds to a page to be printed.
[0062] Step 23, obtaining parameter information and page links of elements in the corresponding print format area according to the identification array.
[0063] In this step, the array is read to obtain the mark to be printed, and the parameter information of the print format area is obtained according to the mark to be printed, such as the print format area mark and row mark (which row) and content type and other parameter information, and the corresponding page link is obtained according to the mark to be printed.
[0064] Step 24, display the page to be printed according to the parameter information and the page link, and generate a print preview interface. The print preview interface displays the print format area (table) and the content of each row of the table (the content of the page to be printed). If the page to be printed is a CAP3 form, directly call the link to display the CAP3 form. If the page to be printed is a CAP4 form, it is necessary to take a screenshot and insert the screenshot into each row of the corresponding print format area (table).
[0065] The specific steps of step 24 include step 241 to step 244:
[0066] Step 241: Determine the type of content of the page to be printed according to the parameter information. The type of content is obtained from the parameter information.
[0067] Step 242, when the type of the content of the page to be printed is a CAP3 form, the page to be printed is displayed according to the page link, and a print preview interface is generated.
[0068] Step 243, when the type of the content of the page to be printed is a CAP4 form, obtain the image of the page to be printed according to the parameter information and the page link.
[0069] When taking a screenshot of a page to be printed in a row of the print format area, the image of the page to be printed is obtained according to parameter information of the row, such as the print format area identifier and the row identifier (row number) and the page link.
[0070] Specifically, the PhantomJS tool is used to obtain the image of the page to be printed according to the page link and parameter information.
[0071] Step 244, display the image of the page to be printed in the print format area, and generate a print preview interface. Specifically, construct an HTML string including the image of the page to be printed, so as to display the image of the page to be printed in the print format area, and generate a print preview interface. Insert the image of the page to be printed into the row of the corresponding print format area, and display the print preview interface.
[0072] In a feasible implementation, the code examples of step 243-step 244 are as follows:
[0073] Performs screen scraping of the form data contents based on the provided parameter bean.
[0074] @param paramBean Bean object containing the parameters required for screen scraping.
[0075] @return Returns an HTML string containing the screen scraping results. If the scraping is successful, the results will be embedded in the HTML as an image.
[0076] Lic String doFormDataContentScreenCapture(ScreenCapture4FormParamBeanparamBean){
[0077] / / Get the current HttpServletRequest object
[0078] HttpServletRequest request=AppContext.getRawRequest();
[0079] / / According to paramBean, get the parameters required for form screen capture
[0080] Map<String,0object>screenParams=this.getFormScreenCaptureScreenParams(paramBean);
[0081] / / Construct the URL for form screen capture
[0082] String url=this.getFormScreenCaptureUrl(paramBean,request);
[0083] / / Use PhantomJS to perform screen capture based on the URL and parameters, and convert the result into a base64-encoded string
[0084] String img=PhantomJSUtil.doScreenToBase64(url,screenParams,newHashMap(),reguest);
[0085] / / Build an HTML string containing the captured result image
[0086] StringBuilder html=new StringBuilder();
[0087] html.append(" <img src=\"");
[0088] html.append(Strings.isBlank(img)?"":"data:image / png;base64,"+img);
[0089] html.append("\" / >");
[0090] return html.toString();
[0091] }
[0092] Step 25, in response to the triggered batch printing operation, printing a print preview interface.
[0093] Here, the contents of the pages to be printed in the print preview interface are displayed continuously, and the actual printed file will be separated according to each page. After the contents of a page to be printed are printed, the contents of the next page to be printed will be printed again from a new piece of printing paper.
[0094] In this embodiment, HTML web pages can be directly printed in batches, thereby improving the printing efficiency of HTML web pages.
[0095] Among them, when the front-end user operates, after the user triggers the batch print button, the print preview interface will be directly displayed, and the above specific process is executed and completed in the back-end.
[0096] A third aspect of an embodiment of the present invention provides a web page-based batch printing method comprising the following steps:
[0097] Step 31 : creating a print format area in response to a batch print instruction of a plurality of pages to be printed triggered on a to-be-printed list page.
[0098] The page to be printed includes: a full area, a main printing area and at least one additional printing area, and accordingly, the identifier to be printed includes: a full area identifier, a main printing identifier and at least one additional printing area identifier, and the page link includes: a full area link, a main link and at least one additional printing area link. A page to be printed is associated with a full area identifier and a main printing identifier.
[0099] In this step, a web page to be printed can be divided into multiple areas to be printed. When batch printing is performed, one or more areas to be printed in a web page can be printed. For example, a page to be printed contains three parts of content: a form, approval opinions for each approval process, and notes. The corresponding three areas to be printed are the form content as the main printing area, and the other two contents as two additional printing areas. When batch printing is performed, you can choose to print the main printing area or other additional printing areas or the entire area (the entire content of the entire web page) of the page. A link can be generated for each content area of a web page. The full area corresponds to the full area link, the main printing area corresponds to the main link, and the remaining areas correspond to their respective additional printing area links. The links are unique.
[0100] It should be noted that, in this embodiment, the main printing area of all pages to be printed is printed by default.
[0101] In this embodiment, the print format area is specifically described using a table as an example, and the corresponding link can obtain the content of the corresponding area. The page title to be printed is displayed on the to-be-printed list page, and the page title is associated with the full area link. A selection box is displayed before each page title, and multiple selection boxes can be checked to select the page to be printed. After checking, click the batch print button on the to-be-printed list page, and then create a print format area. In this embodiment, the default print format area is a table.
[0102] In addition, for the print format area in the form of a table, the properties of the table can be pre-configured, and the format type and properties of the print format area can be set after clicking the batch print button. The properties are the line frame width, each line width, etc. In this embodiment, each main print area usually occupies one line of the table, and the width of each line can be 100% by default according to the paper size, or it can be set by itself, and the height of each line is adaptive according to the content of the main print area.
[0103] Step 32, obtaining the to-be-printed identification associated with the to-be-printed page, the to-be-printed identification being the main printing identification. When obtaining the to-be-printed identification of each to-be-printed page, the main printing identification of each to-be-printed page is used as the first acquisition item, that is, in this step, when obtaining the to-be-printed identification, the first acquisition item, that is, the main printing identification, is obtained by default, thus simplifying the programming process and the logical processing process of the batch printing program and improving the processing efficiency.
[0104] In a feasible implementation, when obtaining the main printing mark, the obtaining authority can be set. The authorized user can obtain the main printing mark, while the unauthorized user cannot obtain it, that is, cannot print the main printing area.
[0105] Step 33, generating a logo array from the main printing logo.
[0106] The specific steps of step 33 are: generating an identification array from each main printing identification, wherein each identification array is an element of the printing format area.
[0107] In this embodiment, the content in a row of the print format area in the form of a table is an element. The print format area (table) for batch printing of multiple pages to be printed has multiple rows, and an element in each row corresponds to a main print area.
[0108] Step 34, obtaining parameter information and main links of elements in the corresponding print format area according to the identification array.
[0109] In this step, the array is read to obtain the main printing identifier, and parameter information of the printing format area is obtained according to the main printing identifier, such as the printing format area identifier and row identifier (which row) and form type parameter information, and the corresponding main link is obtained according to the main printing identifier.
[0110] Step 35, display the main print area according to the parameter information and the main link, and generate a print preview interface. The print preview interface displays the print format area (table) and the content of each row of the table (the content of the main print area). If the main print area is a CAP3 form, the link is directly called to display the CAP3 form. If the main print area is a CAP4 form, a screenshot needs to be taken and the screenshot is inserted into each row of the corresponding print format area (table).
[0111] The specific steps of step 35 include step 351 to step 354:
[0112] Step 351, determining the type of the content of the main printing area according to the parameter information.
[0113] Step 352: When the type of the content of the main printing area is a CAP3 form, the main printing area is displayed according to the main link, and a print preview interface is generated.
[0114] Step 353: when the type of the content of the main printing area is a CAP4 form, obtain the image of the main printing area according to the parameter information and the main link.
[0115] When taking a screenshot of the main printing area of a row of the printing format area, the image of the main printing area is obtained according to the parameter information of the row, such as the printing format area identifier and the row identifier (row number) and the main link.
[0116] Specifically, the PhantomJS tool is used to obtain the image of the main printing area according to the page link and parameter information.
[0117] Step 354: Display the image of the main print area in the print format area and generate a print preview interface. Specifically, construct an HTML string including the image of the main print area to display the image of the main print area in the print format area and generate a print preview interface. Insert the image of the main print area into the row of the corresponding print format area and display the print preview interface.
[0118] In a feasible implementation, the code examples of step 353-step 354 are as follows:
[0119] Performs screen scraping of the form data contents based on the provided parameter bean.
[0120] @param paramBean Bean object containing the parameters required for screen scraping.
[0121] @return Returns an HTML string containing the screen scraping results. If the scraping is successful, the results will be embedded in the HTML as an image.
[0122] Lic String doFormDataContentScreenCapture(ScreenCapture4FormParamBeanparamBean){
[0123] / / Get the current HttpServletRequest object
[0124] HttpServletRequest request=AppContext.getRawRequest();
[0125] / / According to paramBean, get the parameters required for form screen capture
[0126] Map<String,0object>screenParams=this.getFormScreenCaptureScreenParams(paramBean);
[0127] / / Construct the URL for form screen capture
[0128] String url=this.getFormScreenCaptureUrl(paramBean,request);
[0129] / / Use PhantomJS to perform screen capture based on the URL and parameters, and convert the result into a base64-encoded string
[0130] String img=PhantomJSUtil.doScreenToBase64(url,screenParams,newHashMap(),reguest);
[0131] / / Build an HTML string containing the captured result image
[0132] StringBuilder html=new StringBuilder();
[0133] html.append(" <img src=\"");
[0134] html.append(Strings.isBlank(img)?"":"data:image / png;base64,"+img);
[0135] html.append("\" / >");
[0136] return html.toString();
[0137] }
[0138] Step 36: In response to the triggered batch printing operation, print a print preview interface.
[0139] Here, the contents of the main print area in the print preview interface are displayed continuously, and the actual printed file will be separated according to each page. After the contents of the main print area of a page to be printed are printed, the contents of the main print area of the next page to be printed will be printed again from a new piece of printing paper.
[0140] In this embodiment, part of the content of the HTML webpage can be directly printed in batches, which improves the printing efficiency of the HTML webpage and meets different printing requirements.
[0141] Among them, when the front-end user operates, after the user triggers the batch print button, the print preview interface will be directly displayed, and the above specific process is executed and completed in the back-end.
[0142] A fourth aspect of an embodiment of the present invention provides a web page-based batch printing method comprising the following steps:
[0143] Step 41 : creating a print format area in response to the configuration operation of the to-be-printed pages on the to-be-printed list page and the triggered batch printing instruction of multiple to-be-printed pages.
[0144] The operation of configuring the page to be printed is a selection operation of the mark to be printed on the page to be printed, and the printing format area is in a table form.
[0145] The page to be printed includes: a full area, a main printing area and at least one additional printing area. Correspondingly, the mark to be printed includes: a full area mark, a main printing mark and at least one additional printing area mark. The page link includes: a full area link, a main link and at least one additional printing area link. A page to be printed is associated with a full area mark and a main printing mark.
[0146] In this step, a web page to be printed can be divided into multiple areas to be printed. When batch printing is performed, one or more areas to be printed in a web page can be printed. For example, a page to be printed contains three parts of content: a form, approval opinions of each approval process, and notes. The corresponding three areas to be printed are the content of the form as the main printing area, the other two contents as two additional printing areas, and the entire content of the web page as the full area. When batch printing is performed, you can choose to print at least one area to be printed on the page. A link can be generated for each content area of a web page. The full area corresponds to the full area link, the main printing area corresponds to the main link, and the remaining areas correspond to their respective additional printing area links. The links are unique.
[0147] It should be noted that the batch printing in this embodiment is to print at least one additional printing area and / or main printing area of a page to be printed, or to print the entire area, and the entire content or part of the required content of the web page can be batch printed.
[0148] In this embodiment, the print format area is specifically described using a table as an example, and the corresponding link can obtain the content of the corresponding area. The page title to be printed is displayed on the to-be-printed list page, and the page title is associated with the full area link. A selection box is displayed in front of each page title, and multiple selection boxes can be checked for selection. The checked ones are the pages to be printed. After checking the page to be printed, the selection interface for the to-be-printed mark of the page to be printed is displayed. Check the to-be-printed mark of the page to be printed, and after checking, click the batch print button of the to-be-printed list page, and then create the print format area. In this embodiment, the default print format area is a table.
[0149] In addition, for the print format area in the form of a table, the properties of the table can be pre-configured, and the format type and properties of the print format area can be set after clicking the batch print button, and the properties are the line frame width, each line width, etc. In this embodiment, usually each page to be printed occupies one line of the table, and the width of each line can be 100% by default according to the paper size, or it can be set by itself, and the height of each line is adaptive according to the content of the page to be printed.
[0150] Step 42, generating a logo array from the logo to be printed.
[0151] Step 42 specifically includes step 421-step 422:
[0152] Step 421, generating a logo array for each logo to be printed selected by the configuration operation.
[0153] In a feasible implementation, selection authority can be set when selecting the main print mark. Authorized users can select the main print mark, while unauthorized users cannot select it, that is, cannot print the main print area.
[0154] Step 422, determining whether the to-be-printed areas corresponding to at least two to-be-printed marks correspond to the same to-be-printed page.
[0155] If so, the identification array generated by at least two identifications to be printed is an element of the print format area.
[0156] In this step, the identification array corresponding to each page to be printed is an element of the print format area. That is, when multiple areas to be printed in a page need to be printed, multiple identification arrays associated with a page to be printed are one element, and in the subsequent steps, the contents of multiple areas to be printed in a page to be printed in the print preview interface are displayed in a row of the table.
[0157] In this embodiment, the content in a row of the print format area in the form of a table is an element. The print format area (table) for batch printing of multiple pages to be printed has multiple rows, and an element in each row corresponds to at least one to-be-printed area of a to-be-printed page.
[0158] Step 43, obtaining parameter information and links (full area link or a main link and / or at least one additional printing area link) of the elements of the corresponding printing format area according to the identification array.
[0159] In this step, the array is read to obtain the selected mark to be printed, and parameter information of the print format area is obtained according to the mark to be printed, such as the print format area identifier and row identifier (which row) and form type parameter information, and the corresponding link is obtained according to the mark to be printed.
[0160] Step 44, display the corresponding area to be printed according to the parameter information and the page link, and generate a print preview interface. The print preview interface displays the print format area (table) and the content of each row of the table. If the content of the area to be printed is a CAP3 form or text, the link is directly called to display the CAP3 form or text. If the content of the area to be printed is a CAP4 form, a screenshot needs to be taken and the screenshot is inserted into each row of the corresponding print format area (table).
[0161] The specific steps of step 44 include step 441 to step 444:
[0162] Step 441, determining the type of the content of the area to be printed according to the parameter information.
[0163] Step 442: When the type of the content of the area to be printed is a CAP3 form, the area to be printed is displayed according to the corresponding link, and a print preview interface is generated.
[0164] Step 443, when the type of the content of the area to be printed is a CAP4 form, obtain a picture of the area to be printed according to the parameter information and the link.
[0165] When taking a screenshot of a row of the print format area to be printed, the image of the print format area is obtained according to the parameter information of the row, such as the print format area identifier and the row identifier (row number) and the link. Specifically, the image of the print format area is obtained using the PhantomJS tool according to the link and the parameter information.
[0166] Step 444, display the image of the area to be printed in the print format area, and generate a print preview interface. Specifically, construct an HTML string including the image of the area to be printed, so as to display the image of the area to be printed in the print format area, and generate a print preview interface.
[0167] In this step, the image of the area to be printed is inserted into the row of the corresponding print format area, and the print preview interface is displayed.
[0168] Step 45, in response to the triggered batch printing operation, printing a print preview interface.
[0169] Here, the contents of the to-be-printed area in the print preview interface are displayed continuously, and the actual printed file is separated according to each page. After the contents of one to-be-printed area are printed, the contents of the to-be-printed area of the next to-be-printed page will be printed again from a new piece of printing paper.
[0170] In this embodiment, part of the content of the HTML webpage can be directly printed in batches, which improves the printing efficiency of the HTML webpage and meets different printing requirements.
[0171] Among them, when the front-end user operates, after the user triggers the batch print button, the print preview interface will be directly displayed, and the above specific process is executed and completed in the back-end.
[0172] like Figure 2 As shown, a fifth aspect of an embodiment of the present invention provides a web page-based batch printing device, comprising:
[0173] The creation module 51 is used to create a printing format area in response to a batch printing instruction of multiple pages to be printed triggered on the to-be-printed list page; wherein the to-be-printed page corresponds to a to-be-printed identifier, and each to-be-printed page corresponds to a page link;
[0174] A generating module 52, used for generating a logo array from the logo to be printed;
[0175] An acquisition module 53, used for acquiring parameter information and page links of elements in a corresponding print format area according to the identification array;
[0176] A preview module 54 is used to display the page to be printed according to the parameter information and the page link, and generate a print preview interface;
[0177] The printing module 55 is used to print a print preview interface in response to a triggered batch printing operation.
[0178] In one embodiment of the present invention, the print format area is in a table format;
[0179] Generate a logo array from the logo to be printed, including:
[0180] Generate a logo array for each logo to be printed; wherein each logo array is an element of the print format area.
[0181] In one embodiment of the present invention, the page to be printed is displayed according to the parameter information and the page link, and a print preview interface is generated, including:
[0182] When the form type indicated in the parameter information is CAP4 type, the image of the page to be printed is obtained according to the parameter information and the page link;
[0183] Display the image of the page to be printed in the print format area and generate a print preview interface.
[0184] In one embodiment of the present invention, obtaining a picture of a page to be printed according to parameter information and a page link includes:
[0185] Use the PhantomJS tool to obtain the image of the page to be printed based on the page link and parameter information.
[0186] In one embodiment of the present invention, a picture of a page to be printed is displayed in a print format area, and a print preview interface is generated, including:
[0187] An HTML string including the image of the page to be printed is constructed to display the image of the page to be printed in the print format area, and a print preview interface is generated.
[0188] In one embodiment of the present invention, the page to be printed includes: a full area, a main printing area and at least one additional printing area, and accordingly, the mark to be printed includes: a full area mark, a main printing mark and at least one additional printing area mark, and the page link includes: a full area link, a main link and at least one additional printing area link;
[0189] A web-based batch printing device also includes:
[0190] The default acquisition module is used to obtain the mark to be printed; the mark to be printed is the main printing mark.
[0191] In response to a batch printing instruction of a plurality of pages to be printed triggered on a to-be-printed list page, a printing format area is created, including:
[0192] In response to the configuration operation of the to-be-printed pages on the to-be-printed list page and the triggered batch printing instruction of multiple to-be-printed pages, a print format area is created; wherein the configuration operation of the to-be-printed pages is a selection operation of the to-be-printed identification of the to-be-printed pages, and the print format area is in a table form;
[0193] Generate a logo array from the logo to be printed, including:
[0194] Generate an array of logos for each logo to be printed;
[0195] Determining whether at least two to-be-printed marks correspond to the same to-be-printed page;
[0196] If so, the identification array generated by at least two identifications to be printed is an element of the print format area.
[0197] A sixth aspect of an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a web-based batch printing method provided in the above embodiment of the present invention is implemented.
[0198] A seventh aspect of an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of a web-based batch printing method provided in the above embodiment of the present invention are implemented.
[0199] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0200] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be 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, discrete hardware systems.
[0201] The method provided in the embodiment of the present invention can be applied to electronic devices. Specifically, the electronic device can be: a desktop computer, a portable computer, an intelligent mobile terminal, a server, etc. This is not limited here, and any electronic device that can implement the present invention belongs to the protection scope of the present invention.
[0202] As for the device / electronic device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0203] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0204] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0205] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0206] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A batch printing method based on a web page, characterized in that: The following steps are involved: In response to a batch printing instruction of a plurality of pages to be printed triggered on a to-be-printed list page, a printing format area is created; wherein the pages to be printed correspond to a to-be-printed mark, and each of the pages to be printed corresponds to a page link; Generate a logo array from the logo to be printed; Acquire parameter information of the element of the corresponding print format area and the page link according to the identification array; Display the page to be printed according to the parameter information and the page link, and generate a print preview interface; In response to the triggered batch printing operation, the print preview interface is printed.
2. The method according to claim 1, characterized in that The printing format area is in table form; The step of generating a logo array from the logo to be printed includes: Generate a logo array for each logo to be printed; wherein each logo array is an element of the printing format area.
3. The method according to claim 2, characterized in that The step of displaying the page to be printed according to the parameter information and the page link and generating a print preview interface includes: When the form type indicated in the parameter information is CAP4 type, obtaining the image of the page to be printed according to the parameter information and the page link; The image of the page to be printed is displayed in the print format area to generate a print preview interface.
4. The method according to claim 3, characterized in that The step of obtaining the image of the page to be printed according to the parameter information and the page link includes: The image of the page to be printed is obtained using the PhantomJS tool according to the page link and the parameter information.
5. The method according to claim 1, characterized in that The step of displaying the image of the page to be printed in the print format area and generating a print preview interface includes: An HTML string including the image of the page to be printed is constructed to display the image of the page to be printed in the print format area, and a print preview interface is generated.
6. The method according to claim 1, characterized in that The page to be printed includes: a full area, a main printing area and at least one additional printing area, and correspondingly, the mark to be printed includes: a full area mark, a main printing mark and at least one additional printing area mark, and the page link includes: a full area link, a main link and at least one additional printing area link; The method further comprises: The to-be-printed mark corresponding to the to-be-printed page is obtained; the to-be-printed mark is the main printing mark.
7. The method according to claim 6, characterized in that The step of creating a print format area in response to a batch print instruction of a plurality of pages to be printed triggered on a to-be-printed list page includes: In response to the configuration operation of the to-be-printed pages on the to-be-printed list page and the triggered batch printing instruction of multiple to-be-printed pages, a print format area is created; wherein the configuration operation of the to-be-printed pages is a selection operation of the to-be-printed identification of the to-be-printed pages, and the print format area is in a table form; The step of generating a logo array from the logo to be printed includes: Generate a logo array for each logo to be printed; Determining whether at least two of the to-be-printed marks correspond to the same to-be-printed page; If so, the identification array generated by the at least two identifications to be printed is an element of the printing format area.
8. A batch printing device based on a web page, characterized in that: include: A creation module, used to create a print format area in response to a batch print instruction of multiple pages to be printed triggered on a to-be-printed list page; wherein the to-be-printed page corresponds to a to-be-printed identifier, and each of the to-be-printed pages corresponds to a page link; A generating module, used for generating a logo array from the logo to be printed; An acquisition module, used for acquiring parameter information of the element of the corresponding print format area and the page link according to the identification array; A preview module, used to display the page to be printed according to the parameter information and the page link, and generate a print preview interface; The printing module is used to print the print preview interface in response to a triggered batch printing operation.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the web-based batch printing method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the web-based batch printing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
System and method of re-purposing a document to save ink and paper
CN102346656A
Method and device for printing table data based on line printing style
CN112230870A
Page printing and exporting method suitable for multiple browsers
CN114296661A
Multi-webpage merging printing method and device and computing equipment
CN116661715A
Method and system for delivery of a newspaper or magazine
CN1351730A