WO2018145456A1 - Thermal printer print method, printer, and computer-readable storage medium - Google Patents

Thermal printer print method, printer, and computer-readable storage medium Download PDF

Info

Publication number
WO2018145456A1
WO2018145456A1 PCT/CN2017/101624 CN2017101624W WO2018145456A1 WO 2018145456 A1 WO2018145456 A1 WO 2018145456A1 CN 2017101624 W CN2017101624 W CN 2017101624W WO 2018145456 A1 WO2018145456 A1 WO 2018145456A1
Authority
WO
WIPO (PCT)
Prior art keywords
printer
memory
printed
data
printing
Prior art date
Application number
PCT/CN2017/101624
Other languages
French (fr)
Chinese (zh)
Inventor
刘伟
李鑫
Original Assignee
百富计算机技术(深圳)有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 百富计算机技术(深圳)有限公司 filed Critical 百富计算机技术(深圳)有限公司
Publication of WO2018145456A1 publication Critical patent/WO2018145456A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/1203Improving or facilitating administration, e.g. print management
    • G06F3/1204Improving or facilitating administration, e.g. print management resulting in reduced user or operator actions, e.g. presetting, automatic actions, using hardware token storing data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1202Dedicated interfaces to print systems specifically adapted to achieve a particular effect
    • G06F3/121Facilitating exception or error detection and recovery, e.g. fault, media or consumables depleted
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1229Printer resources management or printer maintenance, e.g. device status, power levels
    • G06F3/1234Errors handling and recovery, e.g. reprinting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1237Print job management
    • G06F3/126Job scheduling, e.g. queuing, determine appropriate device
    • G06F3/1261Job scheduling, e.g. queuing, determine appropriate device by using alternate printing

Definitions

  • the present application relates to the field of printer technology, and in particular, to a printing method of a thermal printer, a printer, and a computer readable storage medium.
  • a printing method, a printer, and a computer readable storage medium of a thermal printer are provided.
  • a printing method for a thermal printer comprising:
  • the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  • a printer comprising a memory and a processor, the memory storing computer readable instructions, the instructions being executed by the processor, causing the processor to perform the following steps:
  • the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  • One or more non-volatile readable storage media storing computer-executable instructions, when executed by one or more processors, cause the one or more processors to perform the following steps:
  • the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  • FIG. 1 is a flow chart showing a printing method of a thermal printer in an embodiment
  • FIG. 2 is a flow chart of a printing method of a thermal printer in another embodiment. It should be understood that although the steps in the flowchart of FIG. 2 are sequentially displayed as indicated by the arrows, these steps are not necessarily indicated by arrows. The order is executed in order. Except as explicitly stated herein, the execution of these steps is not strictly limited, and may be performed in other sequences. Moreover, in Figure 2 At least some of the steps may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be executed at different times, and the order of execution is not necessarily sequential, but It may be performed alternately or alternately with at least a portion of other steps or sub-steps or stages of other steps;
  • Figure 3 is a block diagram showing the structure of a printer in an embodiment
  • Figure 4 is a block diagram showing the structure of a printer in another embodiment
  • Figure 5 is a block diagram showing the internal structure of a printer in one embodiment.
  • a printing method of a thermal printer including:
  • Step 102 Acquire data to be printed, and back up the data to be printed into the memory.
  • the backup refers to copying the data in the device to the storage device in response to an unexpected situation such as data loss or damage.
  • the data to be printed is copied into the memory.
  • Step 104 Start printing and obtain the number of lines corresponding to the current printing position during the printing process, and back up the number of lines to the memory.
  • the printer is an output device for outputting data on a related medium such as paper.
  • the selected printer includes but is not limited to a dot matrix printer, an ink jet printer, a laser printer, and a thermal printer.
  • Printer word mode printer, thermal transfer printer, LED (Light Emitting Diode) printer, LCS (LCS) printer, electrocautery printer, magnetic printer and fluorescent printer, among them
  • a thermal printer refers to a semiconductor heating element mounted on a printhead of a printer. By heating the semiconductor original, text or a pattern can be printed on the thermal printing paper, such as a printer, a printer in a banking system, and a medical doctor.
  • the printer in the instrument The number of lines is a number for identifying the data being printed, and the number of lines can be used to find the print position corresponding to the data being printed.
  • Step 106 After the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are obtained, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  • the abnormal condition that occurs in the printer refers to any situation that causes the printer to stop working and does not restart, and cannot be reworked, including but not limited to printer power failure, printer downtime, human cause, mechanical failure, or printer card. Paper, etc.
  • the printing method of the above thermal printer saves the data to be printed in the memory, grasps the printing progress by acquiring and updating the number of lines corresponding to the current printing position, and pauses printing when the thermal printer is restarted due to an abnormal reason, waiting for the abnormal reason After the elimination, the number of lines corresponding to the current print position in the memory and the data to be printed are acquired, and the printing is continued according to the number of lines corresponding to the current print position and the data to be printed.
  • a printing method of a thermal printer including:
  • Step 202 Acquire data to be printed, and back up the data to be printed into the memory.
  • the memory is a memory device for storing information in modern information technology.
  • the memory can be a non-volatile memory.
  • the non-volatile memory refers to all forms of solid-state memory. It does not need to periodically refresh the memory contents, and the stored contents are not lost when the device is powered off.
  • Non-volatile memory includes, but is not limited to, programmable read only memory (PROM), erasable programmable read only memory (EPROM), electrically erasable read only memory (EEPROM), and flash memory.
  • PROM programmable read only memory
  • EPROM erasable programmable read only memory
  • EEPROM electrically erasable read only memory
  • flash memory can be a data storage type flash memory (NAND Flash), and the NAND flash is a kind of Flash Memory.
  • the internal non-linear macro cell mode provides a very high cell density, can achieve high storage density, and has a large storage capacity. , reading and writing speed is fast.
  • Step 204 start printing.
  • starting printing means that the printer receives an instruction to print, and according to the instruction, a process of outputting data on a related medium such as paper is performed.
  • the printer is performing print jobs.
  • the data to be printed is first obtained, the data to be printed is saved in the memory of the device motherboard, and the data is printed according to the data in the memory during the printing process.
  • the memory of the device motherboard is a volatile memory, and the data in the memory is lost after an abnormal restart of the device. Normal data processing does not use the data to be printed back to the non-volatile memory. Only when the data in the memory is lost, it is necessary to obtain the backup data in the non-volatile memory to complete the printing work. .
  • Step 206 Obtain the number of lines corresponding to the current print position according to a preset time interval during the printing process of the printer, and back up the number of lines to the memory.
  • the preset time interval and the printing speed of the printer can be adjusted through the system settings.
  • the preset time interval is smaller than the time taken by the printer to print one line of data, so that the data that the printer is printing can be accurately obtained.
  • Corresponding print position to prevent the occurrence of missing lines For example, in the case of printing a voucher using a thermal printer, the time taken to print one line of data is 300 MS (Millisecond, milliseconds), and the time interval for obtaining the number of lines can be set to 100 MS, as much as possible to ensure that each line of data is played. At that time, you can get the new number of rows and back up the new rows to the memory.
  • step 208 it is determined whether the number of rows is the last row. If yes, step 212 is performed, otherwise steps 206 and 210 are performed.
  • the printer needs to determine whether the number of lines corresponding to the current printing position is the last line according to the data to be printed, and if not, continue printing and continue to obtain the number of lines corresponding to the current printing position according to the preset time interval. , back up the number of lines to the memory; if so, stop printing.
  • step 210 printing continues.
  • the printer determines that the number of lines corresponding to the current print position is not the last line, the printer continues to print until the printing of the data to be printed is completed.
  • step 212 the printing is stopped, and the number of lines is no longer backed up to the memory.
  • the printer when the printer determines that the number of lines corresponding to the current print position is the last line, the printer stops printing, and stops acquiring the number of lines corresponding to the current print position according to the preset time interval. Back up the number of rows to memory. Specifically, after the printer completes the printing work, the number of rows corresponding to the current print position acquired is the same as the number of rows stored in the memory, and the number of rows corresponding to the current print position is stopped according to the preset time interval, thereby avoiding printer duplication. Meaningless operation to save system resources.
  • Step 214 Delete the data to be printed backed up in the memory and the number of lines corresponding to the current print position; turn off the printer power.
  • the data to be printed backed up in the memory and the number of lines corresponding to the current printing position are automatically deleted, so that when the printer uses the printer to print data, the memory has enough space to back up the data, thereby avoiding insufficient storage space.
  • the resulting data is lost. Avoid unnecessary energy waste by turning off the printer.
  • POS machine point of sales terminal
  • the corresponding certificate needs to be printed by the POS machine to obtain the signature of the user, and when the POS prints the certificate.
  • the data of the document to be printed is backed up into the memory, the printing is started, and the number of lines corresponding to the current printing position is obtained according to the preset time interval during the printing process, and the number of lines is backed up into the memory; then each dozen in the printing process After a line of data determines whether the number of lines corresponding to the current print position is the last line of the voucher, if not, continue to print and obtain the number of lines corresponding to the current position, and if so, stop printing, and no longer back the number of lines to the memory; Delete the data of the document to be printed backed up in the memory and the number of lines corresponding to the current print position, disconnect the power supply from the POS machine to the printer, and put the POS machine into the standby state.
  • the printer on the POS machine does not need to keep the data all the time after the printing is completed.
  • the backup data is deleted, which can save storage space of the memory.
  • the data to be printed is generally pre-stored in the smart terminal, and does not need to be stored for a long time through the memory.
  • the function of deleting the data backed up in the memory and turning off the power of the printer in this embodiment can be turned on or off by the system setting of the printer.
  • the printer's power can be turned on by the smart power switch module in the printer.
  • the smart power switch module may be a unit that utilizes a combination and compilation of a control board and electronic components to implement control of turning the printer power on and off.
  • the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  • the abnormal condition that occurs in the printer refers to any situation that causes the printer to stop working and does not restart, and cannot be re-worked, including but not limited to printer power failure, printer downtime, human cause, mechanical failure, and printer card. paper.
  • Printer power-off is the most common abnormal condition, which causes data loss in the file being printed, and the file in the print is invalid. For example, in the process of using the POS machine, if the POS machine suddenly loses power, it will make the transaction in progress. Interrupted, if the user has already swiped the bank card and entered the password, but the corresponding voucher is not printed, the user cannot sign the voucher.
  • Printer down refers to the phenomenon that the printer has to restart the system because the system cannot recover from a system error or there is a problem at the hardware level of the system, so that the system does not respond for a long time.
  • the human reason refers to the operator's misoperation causing the printer to be turned off or restarted, or the operator actively turns off the printer due to a lack of paper for a long time.
  • Printer jam refers to a serious jam, and the problem of jams cannot be solved without turning off the power.
  • Mechanical failure refers to the abnormality of the printer hardware during use, which makes the printer malfunction and cannot complete the printing work. In this case, the corresponding repair is required. Generally, the power needs to be turned off. In the case of no configuration to prevent data loss, Will cause data loss.
  • a printer is provided, the internal structure of which may correspond to the structure shown in FIG. 5, and each of the following modules may be wholly or partially passed by software, hardware or a combination thereof. to realise.
  • each of the following modules may be wholly or partially passed by software, hardware or a combination thereof. to realise.
  • the data backup module 302 is configured to acquire data to be printed, and back up the data to be printed into the memory;
  • the printing module 304 is configured to start printing and obtain the number of lines corresponding to the current printing position during the printing process; the data backup module 302 is further configured to back up the number of lines into the memory.
  • the data obtaining module 306 is configured to: after the abnormal restart of the printer occurs, acquire the number of rows corresponding to the current print position and the data to be printed backed up in the memory, and continue to print the data to be printed starting from the number of rows corresponding to the current print position.
  • the printer further includes:
  • the determining module 308 is configured to determine, according to the data to be printed, whether the number of lines corresponding to the current printing position is the last line, and if so, stop printing, otherwise continue printing.
  • the deleting module 310 is configured to delete the data to be printed backed up in the memory and the number of lines corresponding to the current printing position;
  • the power switch module 312 is configured to control the printer power switch.
  • the power switch module 312 can select an intelligent power switch module for controlling whether the printer power is turned on or off.
  • the data backup module 302 is further configured to obtain the number of lines corresponding to the current print position according to a preset time interval during the printing process of the printer, and back up the number of lines into the memory.
  • the determining module 308 is further configured to: when it is determined that the number of rows corresponding to the current printing position is the last row, the number of rows is no longer backed up into the memory.
  • a printer in one embodiment, includes a memory and a processor.
  • the memory stores computer readable instructions.
  • the processor causes the processor to perform the following steps: acquiring data to be printed, and the data to be printed. Backing up to the memory; starting to print and obtaining the number of lines corresponding to the current print position during the printing process, backing up the number of lines to the memory; and acquiring the line corresponding to the current print position backed up in the memory after the abnormal restart of the printer The number and the data to be printed continue to print the data to be printed starting from the number of lines corresponding to the current print position.
  • the processor is further configured to: obtain the number of lines corresponding to the current print position according to a preset time interval during the printing process of the printer, and back up the number of lines into the memory.
  • the processor is further configured to: determine, according to the data to be printed, whether the number of lines corresponding to the current print position is the last line, and if yes, stop printing, otherwise continue printing.
  • the processor is further configured to: when it is determined that the number of rows corresponding to the current print location is the last row, the number of rows is no longer backed up into the memory.
  • the processor is further configured to: delete the data to be printed backed up in the memory and the number of lines corresponding to the current print position; and turn off the power of the printer.
  • one or more computer readable non-volatile storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the following Step: obtaining data to be printed, backing up the data to be printed into a memory; starting printing and obtaining the number of lines corresponding to the current printing position during the printing process, backing up the number of lines to the memory; and restarting when the printer is abnormally Then, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are obtained, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  • the following steps may also be implemented: the number of lines corresponding to the current print position is acquired at a preset time interval during the printing of the printer, and the number of lines is backed up into the memory.
  • the following steps may be further implemented: determining, according to the data to be printed, whether the number of lines corresponding to the current print position is the last line, and if so, stopping printing, otherwise continuing print.
  • the following steps may be further implemented: when it is determined that the number of rows corresponding to the current print position is the last row, the number of rows is no longer backed up into the memory. .
  • the computer readable instructions are further executable by the processor to: delete the data to be printed backed up in the memory and the number of lines corresponding to the current print position; and turn off the printer power.
  • a schematic diagram of the internal structure of the printer includes a processor connected via a system bus, a non-volatile storage medium, an internal memory, and a network interface.
  • the non-volatile storage medium of the printer stores an operating system, a database, and computer readable instructions for implementing a method for automatically generating a Chinese ontology library based on structured network knowledge.
  • the printer's processor is used to provide computing and control capabilities to support the operation of the entire device.
  • the computer's internal memory can store computer readable instructions that, when executed by the processor, cause the processor to perform a method for automatically generating a Chinese ontology library based on structured network knowledge.
  • the network interface of the printer is used to communicate with external terminals via a network connection.
  • the structure shown in FIG. 6 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the printer to which the present application is applied.
  • the specific printer may include more or as shown in the figure. Fewer parts, or some parts, or different parts.

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)
  • Accessory Devices And Overall Control Thereof (AREA)
  • Record Information Processing For Printing (AREA)

Abstract

Provided are a thermal printer print method, printer, and computer-readable storage medium, said method comprising: obtaining to-be-printed data, and backing up said to-be-printed data to a storage device (102); starting to print and, during the printing process, obtaining the line number corresponding to the current print position, and backing up said line number to the storage device (104); after an exception occurs and the printer restarts, obtaining the line number corresponding to the current print position, as well as the to-be-printed data, backed up in the storage device, and starting to continue printing said to-be-printed data from the line number corresponding to the current print position (106).

Description

热敏打印机的打印方法、打印机和计算机可读存储介质Thermal printer printing method, printer and computer readable storage medium
本申请要求于2017年2月13日提交中国专利局、申请号为CN201710076960.X、发明名称为“热敏打印机的打印方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application, filed on Jan. 13, 2017, the entire contents of which is hereby incorporated by reference. In this application.
技术领域Technical field
本申请涉及打印机技术领域,特别是涉及一种热敏打印机的打印方法、打印机和计算机可读存储介质。The present application relates to the field of printer technology, and in particular, to a printing method of a thermal printer, a printer, and a computer readable storage medium.
背景技术Background technique
在热敏打印机打印文件时,有时会因为异常原因造成打印机重启,使得打印机停止运行,这种情况下会造成待打印数据的丢失,或者使打印一半的文件作废,浪费资源。传统技术是采用安装备用电源的方式来解决上述问题,然而备用电源成本高昂,不适合广泛使用。When a thermal printer prints a file, sometimes the printer restarts due to an abnormal cause, causing the printer to stop running. In this case, the data to be printed is lost, or half of the printed data is discarded, which wastes resources. The conventional technology solves the above problems by installing a backup power source. However, the backup power source is expensive and is not suitable for widespread use.
发明内容Summary of the invention
根据本申请的各种实施例,提供一种热敏打印机的打印方法、打印机和计算机可读存储介质。According to various embodiments of the present application, a printing method, a printer, and a computer readable storage medium of a thermal printer are provided.
一种热敏打印机的打印方法,包括:A printing method for a thermal printer, comprising:
获取待打印数据,将所述待打印数据备份到存储器中;Obtaining data to be printed, and backing up the data to be printed into a memory;
开始打印并在打印过程中获取当前打印位置对应的行数,将所述行数备份到存储器中;Start printing and obtain the number of lines corresponding to the current print position during the printing process, and back up the number of lines to the memory;
当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从所述当前打印位置对应的行数开始继续打印所述待打印数据。 After the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
一种打印机,包括存储器及处理器,所述存储器中储存有计算机可读指令,所述指令被所述处理器执行时,使得所述处理器执行以下步骤:A printer comprising a memory and a processor, the memory storing computer readable instructions, the instructions being executed by the processor, causing the processor to perform the following steps:
获取待打印数据,将所述待打印数据备份到存储器中;Obtaining data to be printed, and backing up the data to be printed into a memory;
开始打印并在打印过程中获取当前打印位置对应的行数,将所述行数备份到存储器中;及Start printing and obtain the number of lines corresponding to the current print position during printing, and back up the number of lines to the memory; and
当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从所述当前打印位置对应的行数开始继续打印所述待打印数据。After the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
一个或多个存储有计算机可执行指令的非易失性可读存储介质,所述计算机可执行指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:One or more non-volatile readable storage media storing computer-executable instructions, when executed by one or more processors, cause the one or more processors to perform the following steps:
获取待打印数据,将所述待打印数据备份到存储器中;Obtaining data to be printed, and backing up the data to be printed into a memory;
开始打印并在打印过程中获取当前打印位置对应的行数,将所述行数备份到存储器中;及Start printing and obtain the number of lines corresponding to the current print position during printing, and back up the number of lines to the memory; and
当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从所述当前打印位置对应的行数开始继续打印所述待打印数据。After the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
附图说明DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present application, and other drawings can be obtained according to the drawings without any creative work for those skilled in the art.
图1为一个实施例中热敏打印机的打印方法的流程图;1 is a flow chart showing a printing method of a thermal printer in an embodiment;
图2为另一个实施例中热敏打印机的打印方法的流程图,应该理解的是,虽然图2的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,图2中 的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行;2 is a flow chart of a printing method of a thermal printer in another embodiment. It should be understood that although the steps in the flowchart of FIG. 2 are sequentially displayed as indicated by the arrows, these steps are not necessarily indicated by arrows. The order is executed in order. Except as explicitly stated herein, the execution of these steps is not strictly limited, and may be performed in other sequences. Moreover, in Figure 2 At least some of the steps may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be executed at different times, and the order of execution is not necessarily sequential, but It may be performed alternately or alternately with at least a portion of other steps or sub-steps or stages of other steps;
图3为一个实施例中打印机的结构框图;Figure 3 is a block diagram showing the structure of a printer in an embodiment;
图4为另一个实施例中打印机的结构框图;Figure 4 is a block diagram showing the structure of a printer in another embodiment;
图5为一个实施例中打印机的内部结构框图。Figure 5 is a block diagram showing the internal structure of a printer in one embodiment.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
如图1所示,在一个实施例中,提供了一种热敏打印机的打印方法,包括:As shown in FIG. 1, in one embodiment, a printing method of a thermal printer is provided, including:
步骤102,获取待打印数据,将待打印数据备份到存储器中。Step 102: Acquire data to be printed, and back up the data to be printed into the memory.
本实施例中,备份指的是为应付数据丢失或损坏等可能出现的意外情况,将设备中的数据复制到存储设备中,本实施例中指的是将待打印数据复制到存储器中。In this embodiment, the backup refers to copying the data in the device to the storage device in response to an unexpected situation such as data loss or damage. In this embodiment, the data to be printed is copied into the memory.
步骤104,开始打印并在打印过程中获取当前打印位置对应的行数,将行数备份到存储器中。Step 104: Start printing and obtain the number of lines corresponding to the current printing position during the printing process, and back up the number of lines to the memory.
本实施例中,打印机是将数据输出在纸张等相关介质上的输出设备,按照打印机的工作原理来说,选用的打印机包括但是不限于针式打印机、喷墨式打印机、激光式打印机、热敏式打印机、字模式打印机、热转印式打印机、LED(Light Emitting Diode,发光二极管)式打印机、LCS(LCS,液晶光栅)式打印机、电灼式打印机、磁式打印机和荧光式打印机,其中,热敏打印机指的是打印机的打印头上安装有半导体加热元件,通过加热半导体原件可以将文本或图案打印在热敏打印纸上,例如票据机、银行系统中的打印机和医 疗仪器中的打印机。行数是用于标识正在打印数据的数值,通过行数可以找到正在打印的数据具体对应的打印位置。In this embodiment, the printer is an output device for outputting data on a related medium such as paper. According to the working principle of the printer, the selected printer includes but is not limited to a dot matrix printer, an ink jet printer, a laser printer, and a thermal printer. Printer, word mode printer, thermal transfer printer, LED (Light Emitting Diode) printer, LCS (LCS) printer, electrocautery printer, magnetic printer and fluorescent printer, among them, A thermal printer refers to a semiconductor heating element mounted on a printhead of a printer. By heating the semiconductor original, text or a pattern can be printed on the thermal printing paper, such as a printer, a printer in a banking system, and a medical doctor. The printer in the instrument. The number of lines is a number for identifying the data being printed, and the number of lines can be used to find the print position corresponding to the data being printed.
步骤106,当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从当前打印位置对应的行数开始继续打印待打印数据。Step 106: After the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are obtained, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
本实施例中,打印机出现的异常状况指的是任何使得打印机停止工作并且不重新启动,就无法重新工作的情况,包括但是不限于打印机断电、打印机宕机、人为原因、机械故障或打印机卡纸等。In this embodiment, the abnormal condition that occurs in the printer refers to any situation that causes the printer to stop working and does not restart, and cannot be reworked, including but not limited to printer power failure, printer downtime, human cause, mechanical failure, or printer card. Paper, etc.
上述热敏打印机的打印方法,将待打印数据保存在存储器中,通过获取和更新当前打印位置对应的行数掌握打印进度,在热敏打印机由于异常原因重启的情况下,暂停打印,待异常原因消除后,获取存储器中的当前打印位置对应的行数和待打印数据,根据当前打印位置对应的行数和待打印数据继续打印。The printing method of the above thermal printer saves the data to be printed in the memory, grasps the printing progress by acquiring and updating the number of lines corresponding to the current printing position, and pauses printing when the thermal printer is restarted due to an abnormal reason, waiting for the abnormal reason After the elimination, the number of lines corresponding to the current print position in the memory and the data to be printed are acquired, and the printing is continued according to the number of lines corresponding to the current print position and the data to be printed.
如图2所示,在一个实施例中,提供了一种热敏打印机的打印方法,包括:As shown in FIG. 2, in one embodiment, a printing method of a thermal printer is provided, including:
步骤202,获取待打印数据,将待打印数据备份到存储器中。Step 202: Acquire data to be printed, and back up the data to be printed into the memory.
本实施例中,存储器是现代信息技术中用于保存信息的记忆设备。存储器可以选用非易失性存储器,非易失性存储器指的是所有形式的固态存储器,不用定期地刷新存储器内容,在设备断开电源时,其存储的内容不会丢失。非易失性存储器包括但是不限于可编程只读存储器(PROM)、可擦可编程只读存储器(EPROM)、电可擦除只读存储器(EEPROM)和闪存(Flash Memory)。其中闪存可以是资料存储型闪存(NAND Flash),NAND Flash是Flash Memory的一种,其内部采用非线性宏单元模式,提供了极高的单元密度,可以达到高存储密度,使得存储容量较大,读写速度快。In this embodiment, the memory is a memory device for storing information in modern information technology. The memory can be a non-volatile memory. The non-volatile memory refers to all forms of solid-state memory. It does not need to periodically refresh the memory contents, and the stored contents are not lost when the device is powered off. Non-volatile memory includes, but is not limited to, programmable read only memory (PROM), erasable programmable read only memory (EPROM), electrically erasable read only memory (EEPROM), and flash memory. The flash memory can be a data storage type flash memory (NAND Flash), and the NAND flash is a kind of Flash Memory. The internal non-linear macro cell mode provides a very high cell density, can achieve high storage density, and has a large storage capacity. , reading and writing speed is fast.
步骤204,开始打印。 Step 204, start printing.
本实施例中,开始打印指的是打印机接收到打印的指令,根据该指令执行将数据输出在纸张等相关介质上的过程。具体的,打印机在执行打印工作 时,首先获取到待打印数据,将待打印数据保存在设备主板内存中,在打印过程中根据内存中的数据进行打印。需要说明的是,设备主板内存采用的是易失性存储器,在设备出现异常重启后,会丢失内存中的数据。正常的打印工作中不会用到备份到非易失性存储器中的待打印数据,只有在内存中的数据丢失的情况下,才需要获取非易失性存储器中的备份数据,以完成打印工作。In the present embodiment, starting printing means that the printer receives an instruction to print, and according to the instruction, a process of outputting data on a related medium such as paper is performed. Specifically, the printer is performing print jobs. When the data to be printed is first obtained, the data to be printed is saved in the memory of the device motherboard, and the data is printed according to the data in the memory during the printing process. It should be noted that the memory of the device motherboard is a volatile memory, and the data in the memory is lost after an abnormal restart of the device. Normal data processing does not use the data to be printed back to the non-volatile memory. Only when the data in the memory is lost, it is necessary to obtain the backup data in the non-volatile memory to complete the printing work. .
步骤206,在打印机打印过程中按照预设时间间隔获取当前打印位置对应的行数,将行数备份到存储器中。Step 206: Obtain the number of lines corresponding to the current print position according to a preset time interval during the printing process of the printer, and back up the number of lines to the memory.
本实施例中,预设时间间隔和打印机的打印速度都可以通过系统设置进行调整,一般情况下,设置预设时间间隔小于打印机打印一行数据花费的时间,这样可以准确的获取打印机正在打印的数据对应的打印位置,防止出现行数遗漏的情况。例如在使用热敏打印机打印凭证的情况下,打印一行数据花费的时间是300MS(Millisecond,毫秒),这时可以设置获取行数的时间间隔为100MS,尽可能的保证在每打完一行数据的时候,可以获取到新的行数,将新的行数备份到存储器中。In this embodiment, the preset time interval and the printing speed of the printer can be adjusted through the system settings. In general, the preset time interval is smaller than the time taken by the printer to print one line of data, so that the data that the printer is printing can be accurately obtained. Corresponding print position to prevent the occurrence of missing lines. For example, in the case of printing a voucher using a thermal printer, the time taken to print one line of data is 300 MS (Millisecond, milliseconds), and the time interval for obtaining the number of lines can be set to 100 MS, as much as possible to ensure that each line of data is played. At that time, you can get the new number of rows and back up the new rows to the memory.
步骤208,判断行数是否为最后一行,若是,则执行步骤212,否则执行步骤206和步骤210。In step 208, it is determined whether the number of rows is the last row. If yes, step 212 is performed, otherwise steps 206 and 210 are performed.
本实施例中,打印机在打印过程中,需要根据待打印数据判断当前打印位置对应的行数是否为最后一行,若否,则继续打印并继续按照预设时间间隔获取当前打印位置对应的行数,将行数备份到存储器中;若是,则停止打印。In this embodiment, during the printing process, the printer needs to determine whether the number of lines corresponding to the current printing position is the last line according to the data to be printed, and if not, continue printing and continue to obtain the number of lines corresponding to the current printing position according to the preset time interval. , back up the number of lines to the memory; if so, stop printing.
步骤210,继续打印。In step 210, printing continues.
本实施例中,当打印机判断当前打印位置对应的行数不是最后一行时,打印机继续打印,直到待打印数据打印完成。In this embodiment, when the printer determines that the number of lines corresponding to the current print position is not the last line, the printer continues to print until the printing of the data to be printed is completed.
步骤212,停止打印,不再将行数备份到存储器中。In step 212, the printing is stopped, and the number of lines is no longer backed up to the memory.
本实施例中,当打印机判断当前打印位置对应的行数是最后一行时,打印机停止打印,并且停止按照预设时间间隔获取当前打印位置对应的行数, 将行数备份到存储器中。具体的,在打印机完成打印工作后,再获取的当前打印位置对应的行数与存储器中存储的行数是相同的,停止按照预设时间间隔获取当前打印位置对应的行数,可以避免打印机重复无意义的操作,以达到节约系统资源的目的。In this embodiment, when the printer determines that the number of lines corresponding to the current print position is the last line, the printer stops printing, and stops acquiring the number of lines corresponding to the current print position according to the preset time interval. Back up the number of rows to memory. Specifically, after the printer completes the printing work, the number of rows corresponding to the current print position acquired is the same as the number of rows stored in the memory, and the number of rows corresponding to the current print position is stopped according to the preset time interval, thereby avoiding printer duplication. Meaningless operation to save system resources.
步骤214,删除存储器中备份的待打印数据和当前打印位置对应的行数;关闭打印机电源。Step 214: Delete the data to be printed backed up in the memory and the number of lines corresponding to the current print position; turn off the printer power.
本实施例中,在打印机完成打印工作后,自动删除存储器中备份的待打印数据和当前打印位置对应的行数,使得以后使用打印机打印数据时,存储器有足够的空间备份数据,避免存储空间不足造成的数据丢失。通过关闭打印机电源,避免不必要的能源浪费。例如在使用POS机(point of sales terminal,销售点情报管理系统)时,当用户通过POS机进行交易时,需要通过POS机打印出相应的凭证,用于获取用户的签名,在POS打印凭证时,首先将待打印凭证的数据备份到存储器中,开始打印,并且在打印过程中按照预设时间间隔获取当前打印位置对应的行数,将行数备份到存储器中;然后在打印过程中每打完一行数据判断当前打印位置对应的行数是否为凭证的最后一行,若否,则继续打印和获取当前位置对应的行数,若是,则停止打印,不再将行数备份到存储器中;最后删除存储器中备份的待打印凭证的数据和当前打印位置对应的行数,断开POS机对打印机的供电,并使POS机进入待机状态。In this embodiment, after the printer completes the printing work, the data to be printed backed up in the memory and the number of lines corresponding to the current printing position are automatically deleted, so that when the printer uses the printer to print data, the memory has enough space to back up the data, thereby avoiding insufficient storage space. The resulting data is lost. Avoid unnecessary energy waste by turning off the printer. For example, when using a POS machine (point of sales terminal), when a user conducts a transaction through a POS machine, the corresponding certificate needs to be printed by the POS machine to obtain the signature of the user, and when the POS prints the certificate. First, the data of the document to be printed is backed up into the memory, the printing is started, and the number of lines corresponding to the current printing position is obtained according to the preset time interval during the printing process, and the number of lines is backed up into the memory; then each dozen in the printing process After a line of data determines whether the number of lines corresponding to the current print position is the last line of the voucher, if not, continue to print and obtain the number of lines corresponding to the current position, and if so, stop printing, and no longer back the number of lines to the memory; Delete the data of the document to be printed backed up in the memory and the number of lines corresponding to the current print position, disconnect the power supply from the POS machine to the printer, and put the POS machine into the standby state.
由于POS机打印的凭证属于一次使用的票据,而且在交易完成后,POS机会将产生的交易数据和打印数据上传至对应的服务器,所以POS机上的打印机在打印完成后没有必要将数据一直保存在POS机的存储器中,删除备份的数据,可以节约存储器的存储空间。在其他打印机的场景中,待打印数据一般都预先保存在智能终端中,也无需通过存储器长期保存。此外,本实施例中删除存储器中备份的数据和关闭打印机电源的功能,可以通过打印机的系统设置选择开启或是关闭。Since the voucher printed by the POS machine belongs to the ticket used once, and after the transaction is completed, the transaction data and the print data generated by the POS device are uploaded to the corresponding server, so the printer on the POS machine does not need to keep the data all the time after the printing is completed. In the memory of the POS machine, the backup data is deleted, which can save storage space of the memory. In other printer scenarios, the data to be printed is generally pre-stored in the smart terminal, and does not need to be stored for a long time through the memory. In addition, the function of deleting the data backed up in the memory and turning off the power of the printer in this embodiment can be turned on or off by the system setting of the printer.
在一个实施例中,在获取待打印数据之前,若打印机处于电源关闭的状 态,可以通过打印机中的智能电源开关模块打开打印机的电源。In one embodiment, if the printer is in a power-off state before acquiring data to be printed The printer's power can be turned on by the smart power switch module in the printer.
本实施例中,智能电源开关模块可以是利用控制板和电子元器件的组合和编译,以实现对打印机电源打开和关闭进行控制的单元。In this embodiment, the smart power switch module may be a unit that utilizes a combination and compilation of a control board and electronic components to implement control of turning the printer power on and off.
在一个实施例中,当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从当前打印位置对应的行数开始继续打印待打印数据。In one embodiment, after the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
本实施例中,打印机出现的异常状况指的是任何使得打印机停止工作并且不重新启动,就无法重新工作的情况,包括但是不限于打印机断电、打印机宕机、人为原因、机械故障和打印机卡纸。打印机断电是最常见的异常状况,会造成正在打印文件的数据丢失,并且打印中的文件作废,例如在使用POS机的过程中,如果POS机突然断电,则会使得正在进行中的交易中断,若用户已经刷了银行卡并输入了密码,但是确没有打印出相应的凭证,用户无法在凭证上签名,这种情况下,即使POS机重新连接上电源,如果没有相应的防止数据丢失的机制,也无法再次执行打印出相应凭证的工作。这种情况下,用户的资金已经从银行账户中划走,用户不会同意再次支付,而商家也没有取得合法的权利凭证,使得交易关系处于不稳定的状态。In this embodiment, the abnormal condition that occurs in the printer refers to any situation that causes the printer to stop working and does not restart, and cannot be re-worked, including but not limited to printer power failure, printer downtime, human cause, mechanical failure, and printer card. paper. Printer power-off is the most common abnormal condition, which causes data loss in the file being printed, and the file in the print is invalid. For example, in the process of using the POS machine, if the POS machine suddenly loses power, it will make the transaction in progress. Interrupted, if the user has already swiped the bank card and entered the password, but the corresponding voucher is not printed, the user cannot sign the voucher. In this case, even if the POS machine is reconnected to the power supply, if there is no corresponding data loss prevention The mechanism does not work again to print out the corresponding credentials. In this case, the user's funds have been removed from the bank account, the user will not agree to pay again, and the merchant does not obtain a legal right certificate, making the transaction relationship unstable.
打印机宕机指的是打印机由于系统无法从一个系统错误中恢复过来或是系统硬件层面出现问题,以致系统长时间无响应,而不得不重新启动系统的现象。人为原因指的是操作人的误操作造成打印机关闭或是重新启动,或是由于长时间缺纸等情况,操作人主动关闭打印机等。打印机卡纸指的是严重的卡纸情况,在不关闭电源的情况下,不能解决卡纸的问题。机械故障指的是由于打印机硬件在使用过程中出现异常,使得打印机功能失常,不能完成打印工作,这种情况下需要进行相应的修理一般需要关闭电源,在没有防止数据丢失的配置的情况下,会造成数据丢失。Printer down refers to the phenomenon that the printer has to restart the system because the system cannot recover from a system error or there is a problem at the hardware level of the system, so that the system does not respond for a long time. The human reason refers to the operator's misoperation causing the printer to be turned off or restarted, or the operator actively turns off the printer due to a lack of paper for a long time. Printer jam refers to a serious jam, and the problem of jams cannot be solved without turning off the power. Mechanical failure refers to the abnormality of the printer hardware during use, which makes the printer malfunction and cannot complete the printing work. In this case, the corresponding repair is required. Generally, the power needs to be turned off. In the case of no configuration to prevent data loss, Will cause data loss.
如图3所示,在一个实施例中,提供了一种打印机,该打印机的内部结构可对应于如图5所示的结构,下述每个模块可全部或部分通过软件、硬件或其组合来实现。包括: As shown in FIG. 3, in one embodiment, a printer is provided, the internal structure of which may correspond to the structure shown in FIG. 5, and each of the following modules may be wholly or partially passed by software, hardware or a combination thereof. to realise. Includes:
数据备份模块302,用于获取待打印数据,将待打印数据备份到存储器中;The data backup module 302 is configured to acquire data to be printed, and back up the data to be printed into the memory;
打印模块304,用于开始打印并在打印过程中获取当前打印位置对应的行数;数据备份模块302还用于将行数备份到存储器中。The printing module 304 is configured to start printing and obtain the number of lines corresponding to the current printing position during the printing process; the data backup module 302 is further configured to back up the number of lines into the memory.
数据获取模块306,用于当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从当前打印位置对应的行数开始继续打印待打印数据。The data obtaining module 306 is configured to: after the abnormal restart of the printer occurs, acquire the number of rows corresponding to the current print position and the data to be printed backed up in the memory, and continue to print the data to be printed starting from the number of rows corresponding to the current print position.
如图4所示,在一个实施例中,打印机还包括:As shown in FIG. 4, in one embodiment, the printer further includes:
判断模块308,用于根据待打印数据判断当前打印位置对应的行数是否为最后一行,若是,则停止打印,否则继续打印。The determining module 308 is configured to determine, according to the data to be printed, whether the number of lines corresponding to the current printing position is the last line, and if so, stop printing, otherwise continue printing.
删除模块310,用于删除存储器中备份的待打印数据和当前打印位置对应的行数;The deleting module 310 is configured to delete the data to be printed backed up in the memory and the number of lines corresponding to the current printing position;
电源开关模块312,用于控制打印机电源开关。The power switch module 312 is configured to control the printer power switch.
本实施例中,电源开关模块312可以选用智能电源开关模块,用于控制打印机电源打开或关闭。In this embodiment, the power switch module 312 can select an intelligent power switch module for controlling whether the printer power is turned on or off.
在一个实施例中,数据备份模块302还用于在打印机打印过程中按照预设时间间隔获取当前打印位置对应的行数,将行数备份到存储器中。In one embodiment, the data backup module 302 is further configured to obtain the number of lines corresponding to the current print position according to a preset time interval during the printing process of the printer, and back up the number of lines into the memory.
在一个实施例中,判断模块308还用于当判断到当前打印位置对应的行数为最后一行时,则不再将行数备份到存储器中。In one embodiment, the determining module 308 is further configured to: when it is determined that the number of rows corresponding to the current printing position is the last row, the number of rows is no longer backed up into the memory.
在一个实施例中,一种打印机,包括存储器及处理器,存储器中储存有计算机可读指令,指令被处理器执行时,使得处理器执行以下步骤:获取待打印数据,将所述待打印数据备份到存储器中;开始打印并在打印过程中获取当前打印位置对应的行数,将所述行数备份到存储器中;及当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从所述当前打印位置对应的行数开始继续打印所述待打印数据。In one embodiment, a printer includes a memory and a processor. The memory stores computer readable instructions. When the instructions are executed by the processor, the processor causes the processor to perform the following steps: acquiring data to be printed, and the data to be printed. Backing up to the memory; starting to print and obtaining the number of lines corresponding to the current print position during the printing process, backing up the number of lines to the memory; and acquiring the line corresponding to the current print position backed up in the memory after the abnormal restart of the printer The number and the data to be printed continue to print the data to be printed starting from the number of lines corresponding to the current print position.
在一个实施例中,处理器还用于执行:在打印机打印过程中按照预设时间间隔获取当前打印位置对应的行数,将所述行数备份到存储器中。 In one embodiment, the processor is further configured to: obtain the number of lines corresponding to the current print position according to a preset time interval during the printing process of the printer, and back up the number of lines into the memory.
在一个实施例中,处理器还用于执行:根据所述待打印数据判断所述当前打印位置对应的行数是否为最后一行,若是,则停止打印,否则继续打印。In one embodiment, the processor is further configured to: determine, according to the data to be printed, whether the number of lines corresponding to the current print position is the last line, and if yes, stop printing, otherwise continue printing.
在一个实施例中,处理器还用于执行:当判断到所述当前打印位置对应的行数为最后一行时,则不再将所述行数备份到存储器中。In one embodiment, the processor is further configured to: when it is determined that the number of rows corresponding to the current print location is the last row, the number of rows is no longer backed up into the memory.
在一个实施例中,处理器还用于执行:删除所述存储器中备份的待打印数据和当前打印位置对应的行数;及关闭打印机电源。In one embodiment, the processor is further configured to: delete the data to be printed backed up in the memory and the number of lines corresponding to the current print position; and turn off the power of the printer.
在一个实施例中,一个或多个存储有计算机可读指令的计算机可读非易失性存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:获取待打印数据,将所述待打印数据备份到存储器中;开始打印并在打印过程中获取当前打印位置对应的行数,将所述行数备份到存储器中;及当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从所述当前打印位置对应的行数开始继续打印所述待打印数据。In one embodiment, one or more computer readable non-volatile storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the following Step: obtaining data to be printed, backing up the data to be printed into a memory; starting printing and obtaining the number of lines corresponding to the current printing position during the printing process, backing up the number of lines to the memory; and restarting when the printer is abnormally Then, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are obtained, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
在一个实施例中,计算机可读指令被处理器执行时还可实现以下步骤:在打印机打印过程中按照预设时间间隔获取当前打印位置对应的行数,将所述行数备份到存储器中。In one embodiment, when the computer readable instructions are executed by the processor, the following steps may also be implemented: the number of lines corresponding to the current print position is acquired at a preset time interval during the printing of the printer, and the number of lines is backed up into the memory.
在一个实施例中,计算机可读指令被处理器执行时还可实现以下步骤:根据所述待打印数据判断所述当前打印位置对应的行数是否为最后一行,若是,则停止打印,否则继续打印。In one embodiment, when the computer readable instructions are executed by the processor, the following steps may be further implemented: determining, according to the data to be printed, whether the number of lines corresponding to the current print position is the last line, and if so, stopping printing, otherwise continuing print.
在一个实施例中,计算机可读指令被处理器执行时还可实现以下步骤:当判断到所述当前打印位置对应的行数为最后一行时,则不再将所述行数备份到存储器中。In one embodiment, when the computer readable instructions are executed by the processor, the following steps may be further implemented: when it is determined that the number of rows corresponding to the current print position is the last row, the number of rows is no longer backed up into the memory. .
在一个实施例中,计算机可读指令被处理器执行时还可实现以下步骤:删除所述存储器中备份的待打印数据和当前打印位置对应的行数;及关闭打印机电源。In one embodiment, the computer readable instructions are further executable by the processor to: delete the data to be printed backed up in the memory and the number of lines corresponding to the current print position; and turn off the printer power.
如图5所示,在一个实施例中,提供了打印机的内部结构示意图。该打印机包括通过系统总线连接的处理器、非易失性存储介质、内存储器和网络 接口。其中,该打印机的非易失性存储介质存储有操作系统、数据库和计算机可读指令,该计算机可读指令用于实现一种用于基于结构化网络知识自动生成中文本体库的方法。该打印机的处理器用于提供计算和控制能力,支撑整个设备的运行。该打印机的内存储器中可储存有计算机可读指令,该计算机可读指令被处理器执行时,可使得处理器执行一种用于基于结构化网络知识自动生成中文本体库的方法。打印机的网络接口用于据以与外部的终端通过网络连接通信。图6中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的打印机的限定,具体的打印机可包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。As shown in FIG. 5, in one embodiment, a schematic diagram of the internal structure of the printer is provided. The printer includes a processor connected via a system bus, a non-volatile storage medium, an internal memory, and a network interface. The non-volatile storage medium of the printer stores an operating system, a database, and computer readable instructions for implementing a method for automatically generating a Chinese ontology library based on structured network knowledge. The printer's processor is used to provide computing and control capabilities to support the operation of the entire device. The computer's internal memory can store computer readable instructions that, when executed by the processor, cause the processor to perform a method for automatically generating a Chinese ontology library based on structured network knowledge. The network interface of the printer is used to communicate with external terminals via a network connection. The structure shown in FIG. 6 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the printer to which the present application is applied. The specific printer may include more or as shown in the figure. Fewer parts, or some parts, or different parts.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-described embodiments may be arbitrarily combined. For the sake of brevity of description, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction between the combinations of these technical features, All should be considered as the scope of this manual.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。 The above-mentioned embodiments are merely illustrative of several embodiments of the present application, and the description thereof is more specific and detailed, but is not to be construed as limiting the scope of the claims. It should be noted that a number of variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the present application. Therefore, the scope of the invention should be determined by the appended claims.

Claims (15)

  1. 一种热敏打印机的打印方法,包括:A printing method for a thermal printer, comprising:
    获取待打印数据,将所述待打印数据备份到存储器中;Obtaining data to be printed, and backing up the data to be printed into a memory;
    开始打印并在打印过程中获取当前打印位置对应的行数,将所述行数备份到存储器中;及Start printing and obtain the number of lines corresponding to the current print position during printing, and back up the number of lines to the memory; and
    当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从所述当前打印位置对应的行数开始继续打印所述待打印数据。After the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  2. 根据权利要求1所述的方法,其特征在于,所述获取当前打印位置对应的行数,将所述行数备份到存储器中,包括:The method according to claim 1, wherein the obtaining the number of rows corresponding to the current print position, and backing up the number of rows to the memory comprises:
    在打印机打印过程中按照预设时间间隔获取当前打印位置对应的行数,将所述行数备份到存储器中。During the printing process of the printer, the number of lines corresponding to the current printing position is obtained according to a preset time interval, and the number of lines is backed up into the memory.
  3. 根据权利要求1所述的方法,其特征在于,还包括:The method of claim 1 further comprising:
    根据所述待打印数据判断所述当前打印位置对应的行数是否为最后一行,若是,则停止打印,否则继续打印。Determining, according to the data to be printed, whether the number of lines corresponding to the current print position is the last line, and if so, stopping printing, otherwise continuing printing.
  4. 根据权利要求3所述的方法,其特征在于,还包括:The method of claim 3, further comprising:
    当判断到所述当前打印位置对应的行数为最后一行时,则不再将所述行数备份到存储器中。When it is determined that the number of lines corresponding to the current print position is the last line, the number of lines is no longer backed up into the memory.
  5. 根据权利要求3所述的方法,其特征在于,在所述停止打印之后,还包括:The method according to claim 3, further comprising, after said stopping printing, further comprising:
    删除所述存储器中备份的待打印数据和当前打印位置对应的行数;及Deleting the number of lines corresponding to the data to be printed backed up in the memory and the current print position; and
    关闭打印机电源。Turn off the printer.
  6. 一种打印机,包括存储器及处理器,所述存储器中储存有计算机可读指令,所述指令被所述处理器执行时,使得所述处理器执行以下步骤:A printer comprising a memory and a processor, the memory storing computer readable instructions, the instructions being executed by the processor, causing the processor to perform the following steps:
    获取待打印数据,将所述待打印数据备份到存储器中;Obtaining data to be printed, and backing up the data to be printed into a memory;
    开始打印并在打印过程中获取当前打印位置对应的行数,将所述行数备 份到存储器中;及Start printing and obtain the number of lines corresponding to the current print position during the printing process, and prepare the number of lines Share to memory; and
    当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从所述当前打印位置对应的行数开始继续打印所述待打印数据。After the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  7. 根据权利要求6所述的打印机,其特征在于,所述处理器还用于执行:The printer according to claim 6, wherein said processor is further configured to:
    在打印机打印过程中按照预设时间间隔获取当前打印位置对应的行数,将所述行数备份到存储器中。During the printing process of the printer, the number of lines corresponding to the current printing position is obtained according to a preset time interval, and the number of lines is backed up into the memory.
  8. 根据权利要求6所述的打印机,其特征在于,所述处理器还用于执行:The printer according to claim 6, wherein said processor is further configured to:
    根据所述待打印数据判断所述当前打印位置对应的行数是否为最后一行,若是,则停止打印,否则继续打印。Determining, according to the data to be printed, whether the number of lines corresponding to the current print position is the last line, and if so, stopping printing, otherwise continuing printing.
  9. 根据权利要求8所述的打印机,其特征在于,所述处理器还用于执行:The printer according to claim 8, wherein said processor is further configured to:
    当判断到所述当前打印位置对应的行数为最后一行时,则不再将所述行数备份到存储器中。When it is determined that the number of lines corresponding to the current print position is the last line, the number of lines is no longer backed up into the memory.
  10. 根据权利要求8所述的打印机,其特征在于,所述处理器还用于执行:The printer according to claim 8, wherein said processor is further configured to:
    删除所述存储器中备份的待打印数据和当前打印位置对应的行数;及Deleting the number of lines corresponding to the data to be printed backed up in the memory and the current print position; and
    关闭打印机电源。Turn off the printer.
  11. 一个或多个存储有计算机可执行指令的非易失性可读存储介质,所述计算机可执行指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:One or more non-volatile readable storage media storing computer-executable instructions, when executed by one or more processors, cause the one or more processors to perform the following steps:
    获取待打印数据,将所述待打印数据备份到存储器中;Obtaining data to be printed, and backing up the data to be printed into a memory;
    开始打印并在打印过程中获取当前打印位置对应的行数,将所述行数备份到存储器中;及Start printing and obtain the number of lines corresponding to the current print position during printing, and back up the number of lines to the memory; and
    当打印机出现异常重启后,获取存储器中备份的当前打印位置对应的行数和待打印数据,从所述当前打印位置对应的行数开始继续打印所述待打印数据。After the abnormal restart of the printer occurs, the number of lines corresponding to the current print position backed up in the memory and the data to be printed are acquired, and the data to be printed is continuously printed starting from the number of lines corresponding to the current print position.
  12. 根据权利要求11所述的非易失性可读存储介质,其特征在于,所述 处理器还被用于执行以下步骤:A non-volatile readable storage medium according to claim 11, wherein said said The processor is also used to perform the following steps:
    在打印机打印过程中按照预设时间间隔获取当前打印位置对应的行数,将所述行数备份到存储器中。During the printing process of the printer, the number of lines corresponding to the current printing position is obtained according to a preset time interval, and the number of lines is backed up into the memory.
  13. 根据权利要求11所述的非易失性可读存储介质,其特征在于,所述处理器还被用于执行以下步骤:The non-volatile readable storage medium of claim 11, wherein the processor is further configured to perform the following steps:
    根据所述待打印数据判断所述当前打印位置对应的行数是否为最后一行,若是,则停止打印,否则继续打印。Determining, according to the data to be printed, whether the number of lines corresponding to the current print position is the last line, and if so, stopping printing, otherwise continuing printing.
  14. 根据权利要求13所述的非易失性可读存储介质,其特征在于,所述处理器还被用于执行以下步骤:The non-volatile readable storage medium of claim 13, wherein the processor is further configured to perform the following steps:
    当判断到所述当前打印位置对应的行数为最后一行时,则不再将所述行数备份到存储器中。When it is determined that the number of lines corresponding to the current print position is the last line, the number of lines is no longer backed up into the memory.
  15. 根据权利要求13所述的非易失性可读存储介质,其特征在于,所述处理器还被用于执行以下步骤:The non-volatile readable storage medium of claim 13, wherein the processor is further configured to perform the following steps:
    删除所述存储器中备份的待打印数据和当前打印位置对应的行数;及Deleting the number of lines corresponding to the data to be printed backed up in the memory and the current print position; and
    关闭打印机电源。 Turn off the printer.
PCT/CN2017/101624 2017-02-13 2017-09-13 Thermal printer print method, printer, and computer-readable storage medium WO2018145456A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710076960.X 2017-02-13
CN201710076960.XA CN106919350B (en) 2017-02-13 2017-02-13 Printing method and device of thermal printer

Publications (1)

Publication Number Publication Date
WO2018145456A1 true WO2018145456A1 (en) 2018-08-16

Family

ID=59454459

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/101624 WO2018145456A1 (en) 2017-02-13 2017-09-13 Thermal printer print method, printer, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN106919350B (en)
WO (1) WO2018145456A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106919350B (en) * 2017-02-13 2020-01-21 百富计算机技术(深圳)有限公司 Printing method and device of thermal printer
CN107264061A (en) * 2017-07-26 2017-10-20 珠海浩盛标签打印机有限公司 Thermal printer, thermal printing system and thermal-sensitive printer printing method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100220361A1 (en) * 2009-02-27 2010-09-02 Konica Minolta Business Technologies, Inc. Printing process system, a printing control apparatus, a terminal apparatus, and a printing process method
CN201816279U (en) * 2010-07-19 2011-05-04 山东新北洋信息技术股份有限公司 Printer
CN103144456A (en) * 2013-03-21 2013-06-12 无锡曼荼罗软件有限公司 Method and system for printing repeatedly and continuously on same piece of paper
CN104898993A (en) * 2014-03-05 2015-09-09 佳能(苏州)系统软件有限公司 Information processing device, image forming device and control device and method for system
CN106919350A (en) * 2017-02-13 2017-07-04 百富计算机技术(深圳)有限公司 The Method of printing and device of thermal printer

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5327183B2 (en) * 2010-10-19 2013-10-30 ブラザー工業株式会社 Printing device
CN104129169B (en) * 2014-07-29 2016-02-03 江门市得实计算机外部设备有限公司 Anti-invalidated ticket printer, anti-invalidated ticket print system and method for operating thereof
CN104309314B (en) * 2014-10-16 2016-08-31 深圳市理邦精密仪器股份有限公司 A kind of method and apparatus indicating thermal printer residue to print number

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100220361A1 (en) * 2009-02-27 2010-09-02 Konica Minolta Business Technologies, Inc. Printing process system, a printing control apparatus, a terminal apparatus, and a printing process method
CN201816279U (en) * 2010-07-19 2011-05-04 山东新北洋信息技术股份有限公司 Printer
CN103144456A (en) * 2013-03-21 2013-06-12 无锡曼荼罗软件有限公司 Method and system for printing repeatedly and continuously on same piece of paper
CN104898993A (en) * 2014-03-05 2015-09-09 佳能(苏州)系统软件有限公司 Information processing device, image forming device and control device and method for system
CN106919350A (en) * 2017-02-13 2017-07-04 百富计算机技术(深圳)有限公司 The Method of printing and device of thermal printer

Also Published As

Publication number Publication date
CN106919350B (en) 2020-01-21
CN106919350A (en) 2017-07-04

Similar Documents

Publication Publication Date Title
JP5460167B2 (en) Information processing apparatus, control method for information processing apparatus, and control program
US9277077B2 (en) Image forming apparatus having power save function, control method thereof, and storage medium
US20100082957A1 (en) Information processing device
JP2012155533A (en) Information processing apparatus, control method thereof, and control program
WO2018145456A1 (en) Thermal printer print method, printer, and computer-readable storage medium
US20160006895A1 (en) Image forming apparatus, control method for the image forming apparatus and medium
US8949816B2 (en) Firmware updating method, image forming apparatus, and storage medium
JP2019043029A (en) Image processing system, and control method for image processing system
US10530954B2 (en) Information processing apparatus, control method of information processing apparatus, and storage medium
US10582079B2 (en) Image forming apparatus, method for controlling image forming apparatus, and recording medium
JP6590722B2 (en) Electronic device, control method thereof, and program
JP6746095B2 (en) Print control device and program
JP2015032103A (en) Image forming apparatus, control method of image forming apparatus, and program
US10686964B2 (en) Information processing apparatus preventing risk of shortened lifetime of storage device and control method therefor
US10992825B2 (en) Image forming apparatus, method for controlling image forming apparatus, and storage medium
US20240106953A1 (en) Information processing apparatus, non-transitory computer readable medium, and method
JP2021089607A (en) Information processing apparatus
JP5800861B2 (en) Information processing apparatus, control method for information processing apparatus, and control program
US9798637B2 (en) Information processing apparatus and control method of information processing apparatus with access to storage device based on communication with storage device
EP3712745B1 (en) Image forming apparatus and power supply control method
US20210297549A1 (en) Information processing apparatus capable of resetting system, method of controlling same, and storage medium
JP6526111B2 (en) Printing apparatus and control method thereof
JP2009010756A (en) Image processing apparatus, self-diagnosis method, self-diagnosis program, and recording medium
JP5444698B2 (en) Data processing apparatus and program
JP2024035488A (en) Image forming apparatus, control method thereof, and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17896265

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17896265

Country of ref document: EP

Kind code of ref document: A1