CN114968134A - Receipt printing method based on webpage and related device - Google Patents
Receipt printing method based on webpage and related device Download PDFInfo
- Publication number
- CN114968134A CN114968134A CN202210609506.7A CN202210609506A CN114968134A CN 114968134 A CN114968134 A CN 114968134A CN 202210609506 A CN202210609506 A CN 202210609506A CN 114968134 A CN114968134 A CN 114968134A
- Authority
- CN
- China
- Prior art keywords
- printing
- text
- area
- printed
- paging
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/12—Digital output to print unit, e.g. line printer, chain printer
- G06F3/1201—Dedicated interfaces to print systems
- G06F3/1223—Dedicated interfaces to print systems specifically adapted to use a particular technique
- G06F3/1237—Print job management
- G06F3/125—Page layout or assigning input pages onto output media, e.g. imposition
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/12—Digital output to print unit, e.g. line printer, chain printer
- G06F3/1201—Dedicated interfaces to print systems
- G06F3/1223—Dedicated interfaces to print systems specifically adapted to use a particular technique
- G06F3/1237—Print job management
- G06F3/1253—Configuration of print job parameters, e.g. using UI at the client
- G06F3/1257—Configuration of print job parameters, e.g. using UI at the client by using pre-stored settings, e.g. job templates, presets, print styles
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/12—Digital output to print unit, e.g. line printer, chain printer
- G06F3/1201—Dedicated interfaces to print systems
- G06F3/1278—Dedicated interfaces to print systems specifically adapted to adopt a particular infrastructure
- G06F3/1285—Remote printer device, e.g. being remote from client or server
- G06F3/1288—Remote printer device, e.g. being remote from client or server in client-server-printer device configuration
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Record Information Processing For Printing (AREA)
Abstract
本申请实施例公开了一种基于网页打印回单方法及相关装置,可应用于金融领域或其他领域。其中该方法包括:基于预设的静态打印模板,调整待打印网页的布局,将所述待打印网页中的页眉区域和页脚区域挤出正文打印区域;基于预设的页边距,调整所述正文打印区域中保留下来的正文内容;配置打印函数,基于所述打印函数,打印所述正文打印区域中保留下来的正文内容。该方法能够保证基于网页打印出来的业务回单满足对于业务回单的格式要求。
The embodiments of the present application disclose a method and a related device for printing a receipt based on a webpage, which can be applied to the financial field or other fields. The method includes: adjusting the layout of the web page to be printed based on a preset static printing template, and extruding the header area and the footer area of the web page to be printed out of the text printing area; based on the preset page margins, adjusting The text content retained in the text printing area; a print function is configured, and based on the printing function, the text content retained in the text printing area is printed. The method can ensure that the business receipt printed based on the web page meets the format requirements for the business receipt.
Description
技术领域technical field
本申请涉及计算机技术领域,具体涉及一种基于网页打印回单方法及相关装置。The present application relates to the field of computer technology, and in particular, to a method for printing a receipt based on a web page and a related device.
背景技术Background technique
客户接入系统(CAS)作为一种B/S系统,其需要在生产环境的定制机上运行,但是定制机对操作系统的大部分功能都进行了限制,只能用浏览器打开网页,基于网页打印业务回单。但是基于网页打印出来的业务回单通常都自带页眉页脚,而这并不符合实际应用中对于业务回单的格式要求。As a B/S system, the Customer Access System (CAS) needs to run on the customized machine in the production environment, but the customized machine restricts most of the functions of the operating system, and can only open the webpage with a browser, based on the webpage Print the business receipt. However, business receipts printed based on web pages usually come with headers and footers, which do not meet the format requirements for business receipts in practical applications.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种基于网页打印回单方法及相关装置,能够保证基于网页打印出来的业务回单满足对于业务回单的格式要求。The embodiments of the present application provide a method and a related device for printing a receipt based on a webpage, which can ensure that the business receipt printed based on the webpage meets the format requirements for the business receipt.
有鉴于此,本申请第一方面提供了一种基于网页打印回单方法,所述方法包括:In view of this, a first aspect of the present application provides a method for printing a receipt based on a web page, the method comprising:
基于预设的静态打印模板,调整待打印网页的布局,将所述待打印网页中的页眉区域和页脚区域挤出正文打印区域;Based on a preset static printing template, adjust the layout of the web page to be printed, and squeeze the header area and the footer area of the web page to be printed out of the text printing area;
基于预设的页边距,调整所述正文打印区域中保留下来的正文内容;Based on the preset page margins, adjusting the text content retained in the text printing area;
配置打印函数,基于所述打印函数,打印所述正文打印区域中保留下来的正文内容。A print function is configured, and based on the print function, the text content retained in the text print area is printed.
可选的,所述配置打印函数,包括:Optionally, the configuration printing function includes:
配置分页算法;所述分页算法是基于业务回单打印需求配置的,其用于对所述正文打印区域中的正文内容进行分页处理;Configuring a paging algorithm; the paging algorithm is configured based on business receipt printing requirements, and is used to perform paging processing on the text content in the text printing area;
配置浏览器对象模型;所述浏览器对象模型中封装有打印算法,所述打印算法用于调用打印机驱动,并打印浏览器当前页面。A browser object model is configured; a printing algorithm is encapsulated in the browser object model, and the printing algorithm is used to invoke a printer driver and print the current page of the browser.
可选的,所述基于所述打印函数,打印所述正文打印区域中保留下来的正文内容,包括:Optionally, printing the text content retained in the text printing area based on the printing function, including:
基于所述分页算法,对所述正文打印区域中保留下来的正文内容进行分页处理,得到至少两页待打印内容;Based on the paging algorithm, paging processing is performed on the text content retained in the text printing area to obtain at least two pages of to-be-printed content;
通过所述浏览器对象模型,针对所述至少两页待打印内容分别进行打印处理。Through the browser object model, print processing is performed separately for the at least two pages of content to be printed.
可选的,所述基于所述分页算法,对所述正文打印区域中保留下来的正文内容进行分页处理,得到至少两页待打印内容,包括:Optionally, based on the paging algorithm, paging processing is performed on the text content retained in the text printing area to obtain at least two pages of to-be-printed content, including:
基于所述分页算法所指示的单页打印行数,对所述正文打印区域中保留下来的正文内容进行分页处理,得到所述至少两页待打印内容。Based on the number of printing lines on a single page indicated by the paging algorithm, paging processing is performed on the text content retained in the text printing area to obtain the at least two pages of to-be-printed content.
可选的,所述基于预设的静态打印模板,调整待打印网页的布局,将所述待打印网页中的页眉区域和页脚区域挤出正文打印区域,包括:Optionally, the layout of the web page to be printed is adjusted based on a preset static printing template, and the header area and the footer area of the web page to be printed are squeezed out of the text printing area, including:
基于所述静态打印模板指示的页眉区域宽度和页脚区域宽度,对所述待打印网页进行拉长处理,以将所述待打印网页中的页眉区域和页脚区域挤出所述正文打印区域;Based on the width of the header area and the width of the footer area indicated by the static printing template, the to-be-printed web page is elongated, so as to squeeze the header area and the footer area of the to-be-printed web page out of the text print area;
所述基于预设的页边距,调整所述正文打印区域中保留下来的正文内容,包括:The adjusting the text content retained in the text printing area based on the preset page margins includes:
基于所述预设的页边距,对所述正文打印区域中保留下来的正文内容进行回缩处理,以保证所述正文内容显示尺寸正常。Based on the preset page margin, the text content retained in the text printing area is subjected to retraction processing to ensure that the display size of the text content is normal.
本申请第二方面提供了一种基于网页打印回单装置,所述装置包括:A second aspect of the present application provides a web page-based printing receipt device, the device comprising:
调整模块,用于基于预设的静态打印模板,调整待打印网页的布局,将所述待打印网页中的页眉区域和页脚区域挤出正文打印区域;an adjustment module for adjusting the layout of the web page to be printed based on a preset static printing template, and extruding the header area and the footer area in the web page to be printed out of the text printing area;
所述调整模块,还用于基于预设的页边距,调整所述正文打印区域中保留下来的正文内容;The adjustment module is further configured to adjust the text content retained in the text printing area based on a preset page margin;
打印模块,用于配置打印函数,基于所述打印函数,打印所述正文打印区域中保留下来的正文内容。The printing module is configured to configure a printing function, and based on the printing function, print the text content retained in the text printing area.
可选的,所述打印模块具体用于:Optionally, the printing module is specifically used for:
配置分页算法;所述分页算法是基于业务回单打印需求配置的,其用于对所述正文打印区域中的正文内容进行分页处理;Configuring a paging algorithm; the paging algorithm is configured based on business receipt printing requirements, and is used to perform paging processing on the text content in the text printing area;
配置浏览器对象模型;所述浏览器对象模型中封装有打印算法,所述打印算法用于调用打印机驱动,并打印浏览器当前页面。A browser object model is configured; a printing algorithm is encapsulated in the browser object model, and the printing algorithm is used to invoke a printer driver and print the current page of the browser.
可选的,所述打印模块具体用于:Optionally, the printing module is specifically used for:
基于所述分页算法,对所述正文打印区域中保留下来的正文内容进行分页处理,得到至少两页待打印内容;Based on the paging algorithm, paging processing is performed on the text content retained in the text printing area to obtain at least two pages of to-be-printed content;
通过所述浏览器对象模型,针对所述至少两页待打印内容分别进行打印处理。Through the browser object model, print processing is performed separately for the at least two pages of content to be printed.
可选的,所述打印模块具体用于:Optionally, the printing module is specifically used for:
基于所述分页算法所指示的单页打印行数,对所述正文打印区域中保留下来的正文内容进行分页处理,得到所述至少两页待打印内容。Based on the number of printing lines on a single page indicated by the paging algorithm, paging processing is performed on the text content retained in the text printing area to obtain the at least two pages of to-be-printed content.
可选的,所述调整模块具体用于:Optionally, the adjustment module is specifically used for:
基于所述静态打印模板指示的页眉区域宽度和页脚区域宽度,对所述待打印网页进行拉长处理,以将所述待打印网页中的页眉区域和页脚区域挤出所述正文打印区域;Based on the width of the header area and the width of the footer area indicated by the static printing template, the to-be-printed web page is elongated, so as to squeeze the header area and the footer area of the to-be-printed web page out of the text print area;
基于所述预设的页边距,对所述正文打印区域中保留下来的正文内容进行回缩处理,以保证所述正文内容显示尺寸正常。Based on the preset page margin, the text content retained in the text printing area is subjected to retraction processing to ensure that the display size of the text content is normal.
从以上技术方案可以看出,本申请实施例具有以下优点:As can be seen from the above technical solutions, the embodiments of the present application have the following advantages:
本申请实施例提供了一种基于网页打印回单的方法,该方法包括:基于预设的静态打印模板,调整待打印网页的布局,将待打印网页中的页眉区域和页脚区域挤出正文打印区域;然后,基于预设的页边距,调整正文打印区域中保留下来的正文内容;进而,配置打印函数,基于该打印函数打印该正文打印区域中保留下来的正文内容。该方法通过修改前端打印模板的样式,通过调整内外边距的方式将网页中的页面区域和页脚区域挤出打印范围,并且将所需打印的正文内容调整至页面中间,即消除了所打印的业务回单中无用的页面和页脚,又保证了打印出的正文内容符合业务回单的打印规范。An embodiment of the present application provides a method for printing a receipt based on a webpage, the method includes: based on a preset static printing template, adjusting the layout of the webpage to be printed, and extruding the header area and the footer area in the webpage to be printed The text printing area; then, based on the preset page margin, adjust the text content retained in the text printing area; further, configure a printing function to print the text content retained in the text printing area based on the printing function. In this method, by modifying the style of the front-end printing template, by adjusting the inner and outer margins, the page area and the footer area in the web page are squeezed out of the printing range, and the content of the text to be printed is adjusted to the middle of the page, which eliminates the need for printing The useless pages and footers in the business receipt ensure that the printed text content conforms to the printing specifications of the business receipt.
附图说明Description of drawings
图1为本申请实施例提供的一种基于网页打印回单方法的流程示意图;1 is a schematic flowchart of a method for printing a receipt based on a webpage according to an embodiment of the present application;
图2为本申请实施例提供的一种基于网页打印回单装置的结构示意图。FIG. 2 is a schematic structural diagram of a web page-based printing receipt device according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make those skilled in the art better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only It is a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
本发明提供的基于网页打印回单方法可用于金融领域或其他领域,例如,可用于金融领域中的业务回单打印应用场景。其他领域为除金融领域之外的任意领域,例如,电力领域。上述仅为示例,并不对本发明提供的基于网页打印回单方法的应用领域进行限定。The web page-based printing receipt method provided by the present invention can be used in the financial field or other fields, for example, in the application scenario of business receipt printing in the financial field. The other fields are any fields other than the financial field, for example, the electric power field. The above is only an example, and does not limit the application field of the web page-based printing receipt method provided by the present invention.
下面通过方法实施例对本申请提供的基于网页打印回单方法进行介绍。The method for printing a receipt based on a webpage provided by the present application will be introduced below through method embodiments.
参见图1,图1为本申请实施例提供的基于网页打印回单方法的流程示意图。如图1所示,该方法包括以下步骤:Referring to FIG. 1 , FIG. 1 is a schematic flowchart of a method for printing a receipt based on a webpage according to an embodiment of the present application. As shown in Figure 1, the method includes the following steps:
步骤101:基于预设的静态打印模板,调整待打印网页的布局,将所述待打印网页中的页眉区域和页脚区域挤出正文打印区域。Step 101: Based on a preset static printing template, adjust the layout of the web page to be printed, and squeeze the header area and the footer area of the web page to be printed out of the text printing area.
在本申请实施例中,可以预先配置静态打印模板,该静态打印模板通常对应于特定尺寸的打印纸(如A4纸)。具体配置静态打印模板时,可以根据所需打印的业务回单的布局、样式等,配置该静态打印模板,如设置在该静态打印模板中标题、栏位等内容的显示位置,并在配置该静态打印模板时保证其中的模板内容不超过对应的打印纸的尺寸。在本申请实施例中,所配置的静态打印模板的主要作用是去除网页中的页面区域和页脚区域,并且保证所保留的正文内容的显示格式正常。In this embodiment of the present application, a static printing template may be preconfigured, and the static printing template generally corresponds to printing paper of a specific size (eg, A4 paper). When configuring the static print template, you can configure the static print template according to the layout and style of the business receipt to be printed, such as setting the display position of the title, field, etc. in the static print template, and configuring the When printing a template statically, ensure that the template content does not exceed the size of the corresponding printing paper. In the embodiment of the present application, the main function of the configured static printing template is to remove the page area and the footer area in the web page, and to ensure that the display format of the retained body content is normal.
在本申请实施例中,打印待打印网页时,可以先基于上述预先配置的静态打印模板,对该待打印网页的布局进行调整,将该待打印网页中的页眉区域和页脚区域挤出正文打印区域,即在实际打印的页面中不体现待打印网页中的页面区域和页脚区域。In this embodiment of the present application, when printing the web page to be printed, the layout of the web page to be printed may be adjusted based on the above-mentioned pre-configured static printing template, and the header area and the footer area of the web page to be printed may be extruded. The text printing area, that is, the page area and the footer area in the web page to be printed are not reflected in the actually printed page.
具体实现时,可以基于该静态打印模板指示的页面区域宽度和页脚区域宽度,对该待打印网页进行拉长处理,以将该待打印网页中的页面区域和页脚区域挤出正文打印区域。During specific implementation, the to-be-printed web page may be elongated based on the page area width and the footer area width indicated by the static printing template, so as to squeeze the page area and footer area of the to-be-printed web page out of the text printing area .
示例性的,预先配置静态打印模板时,可以配置所需挤出的页面区域的宽度和页脚区域的宽度。相应地,基于该静态打印模板调整待打印网页的布局时,可以将该待打印网页在纵向的方向上拉长该页面区域宽度和页脚区域宽度的和,从而将该待打印网页中的页面区域和页脚区域挤出会打印的正文打印区域。Exemplarily, when the static printing template is preconfigured, the width of the page area to be extruded and the width of the footer area may be configured. Correspondingly, when adjusting the layout of the to-be-printed web page based on the static printing template, the to-be-printed web page can be elongated in the vertical direction by the sum of the page area width and the footer area width, so that the page in the to-be-printed web page can be extended. The area and footer area extrude the body print area that would be printed.
需要说明的是,在本申请实施例中,当存在新的打印需求时,可以针对该新的打印需求配置对应的静态打印模板,以通过所配置的静态打印模板打印出满足该打印需求的业务回单。It should be noted that, in this embodiment of the present application, when a new printing demand exists, a corresponding static printing template may be configured for the new printing demand, so as to print out a service that meets the printing demand through the configured static printing template receipt.
步骤102:基于预设的页边距,调整所述正文打印区域中保留下来的正文内容。Step 102: Based on a preset page margin, adjust the text content retained in the text printing area.
将待打印网页中的页眉区域和页脚区域挤出正文打印区域后,可以对正文打印区域中保留下来的正文内容进行调整,以恢复该正文内容的显示尺寸。After the header area and the footer area in the web page to be printed are extruded from the text printing area, the text content retained in the text printing area can be adjusted to restore the display size of the text content.
具体实现时,可以基于预设的页边距,对正文打印区域中保留下来的正文内容进行回缩处理,以保证该证明内容的显示尺寸正常。在本申请实施例中,为了将待打印网页中的页眉区域和页脚区域挤出实际打印的正文打印区域,会基于页眉区域和页脚区域的宽度,对待打印网页进行纵向拉长处理,而随着对于待打印网页的纵向拉长处理,该待打印网页中保留下来的正文内容也会在纵向被拉长,为了保证正文打印区域中保留下来的正文内容能够以正常的尺寸被打印出来,本申请实施例可以设置纵向的页边距,该页边距与页眉区域和页脚区域的宽度和值可以相等,进而,基于该页边距对正文打印区域进行回缩调整,从而使得该正文打印区域中保留下来的正文内容能够以正常的尺寸显示和打印。During specific implementation, the text content retained in the text printing area may be retracted based on a preset page margin to ensure that the display size of the proof content is normal. In this embodiment of the present application, in order to extrude the header area and footer area in the web page to be printed out of the actual printed text printing area, the web page to be printed is vertically elongated based on the width of the header area and the footer area. , and with the longitudinal extension of the web page to be printed, the text content retained in the web page to be printed will also be elongated in the longitudinal direction, in order to ensure that the text content retained in the text printing area can be printed in a normal size In this embodiment of the present application, a vertical page margin can be set, and the page margin can be equal to the width and value of the header area and the page footer area, and further, the text printing area can be retracted and adjusted based on the page margin, thereby The text content retained in the text printing area can be displayed and printed in normal size.
步骤103:配置打印函数,基于所述打印函数,打印所述正文打印区域中保留下来的正文内容。Step 103: Configure a print function, and print the text content retained in the text print area based on the print function.
对正文打印区域中保留下来的正文内容进行调整处理,使得保留下来的正文内容能够以正常的尺寸显示后,可以配置打印函数,进而基于该打印函数打印该正文打印区域中保留下来的正文内容,也即打印业务回单。After adjusting the text content retained in the text printing area, so that the retained text content can be displayed in normal size, you can configure the print function, and then print the text content retained in the text printing area based on the printing function. That is, print the business receipt.
在本申请实施例中,配置打印函数具体包括两部分内容,一部分是配置分页算法,另一部分是配置浏览器对象模型。其中,所配置的分页算法是基于业务回单打印需求配置的,该分页算法用于对正文打印区域中的正文内容进行分页处理。所配置的浏览器对象模型中封装有打印算法,该打印算法能够调用打印机驱动,打印浏览器的当前页面。In the embodiment of the present application, the configuration printing function specifically includes two parts, one part is configuring the paging algorithm, and the other part is configuring the browser object model. The configured paging algorithm is configured based on business receipt printing requirements, and the paging algorithm is used to perform paging processing on the text content in the text printing area. A printing algorithm is encapsulated in the configured browser object model, and the printing algorithm can call a printer driver to print the current page of the browser.
具体的,配置分页算法时,可以根据业务回单的打印需求配置单页打印行数,以保证所打印出来的每个页面包括的行数在该分页算法指示的单页打印行数内,符合业务回单的打印要求。配置浏览器对象模型,可以支持通过浏览器打印的方式打印待打印网页的正文打印区域,通过浏览器打印的方式能够兼容不同的浏览器和多种打印机,提高了打印机定制的灵活性,并且能够减少对于硬件设备的依赖。Specifically, when configuring the paging algorithm, the number of lines to be printed on a single page can be configured according to the printing requirements of the business receipt, so as to ensure that the number of lines included in each printed page is within the number of lines to be printed on a single page indicated by the paging algorithm. Printing requirements for business receipts. Configure the browser object model, which can support printing the text printing area of the web page to be printed through browser printing. The browser printing method can be compatible with different browsers and various printers, which improves the flexibility of printer customization, and can Reduce dependence on hardware devices.
具体基于打印函数打印正文打印区域中保留下来的正文内容时,可以先基于分页算法,对正文打印区域中保留下来的正文内容进行分页处理,得到至少两页待打印内容;进而,通过浏览器对象模型,针对至少两页待打印内容分别进行打印处理,得到对应的业务回单Specifically, when printing the text content retained in the text printing area based on the print function, the text content retained in the text printing area can be paginated based on the paging algorithm, to obtain at least two pages of content to be printed; then, through the browser object model, respectively perform printing processing for at least two pages of the content to be printed, and obtain the corresponding business receipt
示例性的,由于配置打印函数时配置的分页算法会指示单页打印行数,因此,基于分页算法对正文打印区域中保留下来的正文内容进行分页处理时,可以基于该单页打印行数对该正文内容进行分页处理,例如,假设分页算法指示的单页打印函数为10行,正文打印区域中保留下来的正文内容包括23行内容,则可以将第一行至第十行作为所需打印的第一页内容,将第十一行至第二十行作为所需打印的第二页内容,将第二十一行至第二十三行作为所需打印的第三页内容。如此,通过上述分页处理,保证打印出来的内容符合业务回单的打印需求。Exemplarily, since the paging algorithm configured when the printing function is configured will indicate the number of printed lines on a single page, when paging processing is performed on the text content retained in the text printing area based on the paging algorithm, the number of printed lines on a single page can be paired based on the paging algorithm. The text content is processed by paging. For example, if the single-page printing function indicated by the paging algorithm is 10 lines, and the text content retained in the text printing area includes 23 lines of content, the first line to the tenth line can be used as the required printing. The content of the first page, the eleventh line to the twentieth line is the content of the second page to be printed, and the twenty-first to the twenty-third line is the content of the third page to be printed. In this way, through the above-mentioned paging processing, it is ensured that the printed content meets the printing requirements of the business receipt.
进而,可以通过所配置的浏览器对象模型,渲染打印组件,更新页面并调用打印函数打印分页出来的每页待打印内容,从而打印出不包含页眉区域和页脚区域、符合业务回单打印需求的业务回单。Furthermore, through the configured browser object model, the printing component can be rendered, the page can be updated, and the printing function can be called to print the content to be printed on each page that is paginated, so as to print out the header area and footer area, which is in line with the business receipt printing. Demand business receipts.
上述基于网页打印回单的方法包括:基于预设的静态打印模板,调整待打印网页的布局,将待打印网页中的页眉区域和页脚区域挤出正文打印区域;然后,基于预设的页边距,调整正文打印区域中保留下来的正文内容;进而,配置打印函数,基于该打印函数打印该正文打印区域中保留下来的正文内容。该方法通过修改前端打印模板的样式,通过调整内外边距的方式将网页中的页面区域和页脚区域挤出打印范围,并且将所需打印的正文内容调整至页面中间,即消除了所打印的业务回单中无用的页面和页脚,又保证了打印出的正文内容符合业务回单的打印规范。The above method for printing a receipt based on a web page includes: adjusting the layout of the web page to be printed based on a preset static printing template, and extruding the header area and the footer area in the web page to be printed out of the text printing area; then, based on the preset static printing template The page margins are adjusted for the text content retained in the text printing area; further, a print function is configured to print the text content retained in the text printing area based on the printing function. In this method, by modifying the style of the front-end printing template, by adjusting the inner and outer margins, the page area and the footer area in the web page are squeezed out of the printing range, and the content of the text to be printed is adjusted to the middle of the page, which eliminates the need for printing The useless pages and footers in the business receipt ensure that the printed text content conforms to the printing specifications of the business receipt.
本申请实施例还提供了一种基于网页打印回单装置,参见图2,图2为本申请实施例提供的基于网页打印回单装置的结构示意图,如图2所示,该基于网页打印回单装置包括:An embodiment of the present application further provides a web page-based printing receipt device. Referring to FIG. 2, FIG. 2 is a schematic structural diagram of the web page-based printing receipt device provided by the embodiment of the present application. As shown in FIG. A single unit includes:
调整模块201,用于基于预设的静态打印模板,调整待打印网页的布局,将所述待打印网页中的页眉区域和页脚区域挤出正文打印区域;The
所述调整模块201,还用于基于预设的页边距,调整所述正文打印区域中保留下来的正文内容;The
打印模块202,用于配置打印函数,基于所述打印函数,打印所述正文打印区域中保留下来的正文内容。The
可选的,所述打印模块202具体用于:Optionally, the
配置分页算法;所述分页算法是基于业务回单打印需求配置的,其用于对所述正文打印区域中的正文内容进行分页处理;Configuring a paging algorithm; the paging algorithm is configured based on business receipt printing requirements, and is used to perform paging processing on the text content in the text printing area;
配置浏览器对象模型;所述浏览器对象模型中封装有打印算法,所述打印算法用于调用打印机驱动,并打印浏览器当前页面。A browser object model is configured; a printing algorithm is encapsulated in the browser object model, and the printing algorithm is used to invoke a printer driver and print the current page of the browser.
可选的,所述打印模块202具体用于:Optionally, the
基于所述分页算法,对所述正文打印区域中保留下来的正文内容进行分页处理,得到至少两页待打印内容;Based on the paging algorithm, paging processing is performed on the text content retained in the text printing area to obtain at least two pages of to-be-printed content;
通过所述浏览器对象模型,针对所述至少两页待打印内容分别进行打印处理。Through the browser object model, print processing is performed separately for the at least two pages of content to be printed.
可选的,所述打印模块202具体用于:Optionally, the
基于所述分页算法所指示的单页打印行数,对所述正文打印区域中保留下来的正文内容进行分页处理,得到所述至少两页待打印内容。Based on the number of printing lines on a single page indicated by the paging algorithm, paging processing is performed on the text content retained in the text printing area to obtain the at least two pages of to-be-printed content.
可选的,所述调整模块201具体用于:Optionally, the
基于所述静态打印模板指示的页眉区域宽度和页脚区域宽度,对所述待打印网页进行拉长处理,以将所述待打印网页中的页眉区域和页脚区域挤出所述正文打印区域;Based on the width of the header area and the width of the footer area indicated by the static printing template, the to-be-printed web page is elongated, so as to squeeze the header area and the footer area of the to-be-printed web page out of the text print area;
基于所述预设的页边距,对所述正文打印区域中保留下来的正文内容进行回缩处理,以保证所述正文内容显示尺寸正常。Based on the preset page margin, the text content retained in the text printing area is subjected to retraction processing to ensure that the display size of the text content is normal.
上述基于网页打印回单的装置包括:调整模块,用于基于预设的静态打印模板,调整待打印网页的布局,将待打印网页中的页眉区域和页脚区域挤出正文打印区域;以及,基于预设的页边距,调整正文打印区域中保留下来的正文内容;打印模块,用于配置打印函数,基于该打印函数打印该正文打印区域中保留下来的正文内容。该装置通过修改前端打印模板的样式,通过调整内外边距的方式将网页中的页面区域和页脚区域挤出打印范围,并且将所需打印的正文内容调整至页面中间,即消除了所打印的业务回单中无用的页面和页脚,又保证了打印出的正文内容符合业务回单的打印规范。The above-mentioned apparatus for printing a receipt based on a web page includes: an adjustment module for adjusting the layout of the web page to be printed based on a preset static printing template, and extruding the header area and the footer area in the web page to be printed out of the text printing area; and , based on the preset page margin, adjust the text content retained in the text printing area; the printing module is used to configure the printing function, and print the text content retained in the text printing area based on the printing function. By modifying the style of the front-end printing template, the device extrudes the page area and footer area in the web page from the printing range by adjusting the inner and outer margins, and adjusts the content of the text to be printed to the middle of the page, which eliminates the need for printing The useless pages and footers in the business receipt ensure that the printed text content conforms to the printing specifications of the business receipt.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and unit described above may refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(英文全称:Read-OnlyMemory,英文缩写:ROM)、随机存取存储器(英文全称:Random Access Memory,英文缩写:RAM)、磁碟或者光盘等各种可以存储计算机程序的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (full English name: Read-Only Memory, English abbreviation: ROM), random access memory (English full name: Random Access Memory, English abbreviation: RAM), magnetic disks Or various media such as optical discs that can store computer programs.
应当理解,在本申请中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”,其中a,b,c可以是单个,也可以是多个。It should be understood that, in this application, "at least one (item)" refers to one or more, and "a plurality" refers to two or more. "And/or" is used to describe the relationship between related objects, indicating that there can be three kinds of relationships, for example, "A and/or B" can mean: only A, only B, and both A and B exist , where A and B can be singular or plural. The character "/" generally indicates that the associated objects are an "or" relationship. "At least one item(s) below" or similar expressions thereof refer to any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (a) of a, b or c, can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c" ", where a, b, c can be single or multiple.
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand: The technical solutions described in the embodiments are modified, or some technical features thereof are equivalently replaced; 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 in the embodiments of the present application.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210609506.7A CN114968134A (en) | 2022-05-31 | 2022-05-31 | Receipt printing method based on webpage and related device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210609506.7A CN114968134A (en) | 2022-05-31 | 2022-05-31 | Receipt printing method based on webpage and related device |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN114968134A true CN114968134A (en) | 2022-08-30 |
Family
ID=82956722
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210609506.7A Pending CN114968134A (en) | 2022-05-31 | 2022-05-31 | Receipt printing method based on webpage and related device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114968134A (en) |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2002190899A (en) * | 2000-12-19 | 2002-07-05 | Fuji Xerox Co Ltd | Internet facsimile communication method and its unit |
| JP2006277183A (en) * | 2005-03-29 | 2006-10-12 | Dainippon Screen Mfg Co Ltd | Print system, print controller and method and program for preparing data for print output |
| US20090021790A1 (en) * | 2007-07-20 | 2009-01-22 | Yahoo! Inc. | User-controlled print friendly page |
| US20100202010A1 (en) * | 2009-02-11 | 2010-08-12 | Jun Xiao | Method and system for printing a web page |
| CN104714766A (en) * | 2015-03-12 | 2015-06-17 | 福建工程学院 | Method for direct printing in WEB report browser |
| CN109615803A (en) * | 2018-10-09 | 2019-04-12 | 北京辰森世纪科技股份有限公司 | A kind of data-printing method and device |
| CN110865775A (en) * | 2019-09-26 | 2020-03-06 | 福建亿能达信息技术股份有限公司 | Printing method for online design and preview based on WEB |
| CN111752501A (en) * | 2020-06-28 | 2020-10-09 | 中国银行股份有限公司 | Paging printing method and device for official receipt |
-
2022
- 2022-05-31 CN CN202210609506.7A patent/CN114968134A/en active Pending
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2002190899A (en) * | 2000-12-19 | 2002-07-05 | Fuji Xerox Co Ltd | Internet facsimile communication method and its unit |
| JP2006277183A (en) * | 2005-03-29 | 2006-10-12 | Dainippon Screen Mfg Co Ltd | Print system, print controller and method and program for preparing data for print output |
| US20090021790A1 (en) * | 2007-07-20 | 2009-01-22 | Yahoo! Inc. | User-controlled print friendly page |
| US20100202010A1 (en) * | 2009-02-11 | 2010-08-12 | Jun Xiao | Method and system for printing a web page |
| CN104714766A (en) * | 2015-03-12 | 2015-06-17 | 福建工程学院 | Method for direct printing in WEB report browser |
| CN109615803A (en) * | 2018-10-09 | 2019-04-12 | 北京辰森世纪科技股份有限公司 | A kind of data-printing method and device |
| CN110865775A (en) * | 2019-09-26 | 2020-03-06 | 福建亿能达信息技术股份有限公司 | Printing method for online design and preview based on WEB |
| CN111752501A (en) * | 2020-06-28 | 2020-10-09 | 中国银行股份有限公司 | Paging printing method and device for official receipt |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN104714766B (en) | A kind of method directly printed in WEB forms browser | |
| CN100478867C (en) | Information processing apparatus and control method thereof | |
| JP4847183B2 (en) | Information processing apparatus, control method therefor, and program | |
| JP5189497B2 (en) | Form creation system, network system using the same, and form creation method. | |
| JP2022172110A (en) | Systems and methods for automatically reformatting publications | |
| CN105607880A (en) | Printing method and device for examined and approved documents | |
| GB2430059A (en) | Variable data printing | |
| CN102541827B (en) | Method and system for describing extensible marking language of document | |
| JP2012529675A (en) | Using margins for electronic paper displays | |
| CN105975268A (en) | Method of width self-adaptation for PC end information system webpage interface | |
| EP2354964A2 (en) | Processing styles for spreadsheets | |
| CN114296662A (en) | Page-based form document paging printing method, device and application thereof | |
| CN110737860A (en) | rich text picture insertion method and device | |
| CN114968134A (en) | Receipt printing method based on webpage and related device | |
| US20050125724A1 (en) | PPML to PDF conversion | |
| CN111552447A (en) | Printing method and system | |
| US9218327B2 (en) | Optimizing the layout of electronic documents by reducing presentation size of content within document sections so that when combined a plurality of document sections fit within a page | |
| CN105740239A (en) | Translation method and system of character on webpage | |
| JP7264821B2 (en) | System and method for cropping images | |
| JP4308448B2 (en) | Content generation according to the output device | |
| JP4306725B2 (en) | Printing support system, printing support program, and printing support method | |
| CN105573974B (en) | Method of combination, the apparatus and system of the space of a whole page | |
| JP2019104122A (en) | Printer and program | |
| CN104461408A (en) | Small margin or margin-free printing method | |
| CN115526186A (en) | Translation method, electronic device and readable storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| AD01 | Patent right deemed abandoned |
Effective date of abandoning: 20251003 |