CN116198242A - Method for printing label based on ESC/POS instruction - Google Patents

Method for printing label based on ESC/POS instruction Download PDF

Info

Publication number
CN116198242A
CN116198242A CN202111457170.9A CN202111457170A CN116198242A CN 116198242 A CN116198242 A CN 116198242A CN 202111457170 A CN202111457170 A CN 202111457170A CN 116198242 A CN116198242 A CN 116198242A
Authority
CN
China
Prior art keywords
printing
instruction
label
paper
print
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
Application number
CN202111457170.9A
Other languages
Chinese (zh)
Inventor
郭晋鹏
罗建邦
樊志坚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Seal Interest Technology Co Ltd
Original Assignee
Zhuhai Seal Interest Technology Co Ltd
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 Zhuhai Seal Interest Technology Co Ltd filed Critical Zhuhai Seal Interest Technology Co Ltd
Priority to CN202111457170.9A priority Critical patent/CN116198242A/en
Publication of CN116198242A publication Critical patent/CN116198242A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • BPERFORMING OPERATIONS; TRANSPORTING
    • B41PRINTING; LINING MACHINES; TYPEWRITERS; STAMPS
    • B41MPRINTING, DUPLICATING, MARKING, OR COPYING PROCESSES; COLOUR PRINTING
    • B41M5/00Duplicating or marking methods; Sheet materials for use therein
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B41PRINTING; LINING MACHINES; TYPEWRITERS; STAMPS
    • B41JTYPEWRITERS; SELECTIVE PRINTING MECHANISMS, i.e. MECHANISMS PRINTING OTHERWISE THAN FROM A FORME; CORRECTION OF TYPOGRAPHICAL ERRORS
    • B41J29/00Details of, or accessories for, typewriters or selective printing mechanisms not otherwise provided for
    • B41J29/38Drives, motors, controls or automatic cut-off devices for the entire printing mechanism
    • B41J29/393Devices for controlling or analysing the entire machine ; Controlling or analysing mechanical parameters involving printing of test patterns

Landscapes

  • Accessory Devices And Overall Control Thereof (AREA)

Abstract

The invention provides a method for printing labels based on ESC/POS instructions, which realizes preparation work and printing tasks by autonomously distinguishing different printing requirements and adopting corresponding mechanism control, if the printing is a receipt, directly waits for the instruction of a user to be sequentially executed according to the paper feeding instruction and the printing instruction of the user, if the printing requirement is label printing, generates prompt information output according to printing use record information, and reminds the user of completing the preparation work; further detecting a printing execution instruction, judging a matched instruction execution mode according to the parameter content in the printing instruction, and implementing printing according to a corresponding strategy; after the execution of the print execution instruction is completed, a paper feed instruction is automatically generated based on the end instruction, and a paper feed operation is executed. By adopting the printing mechanism, the limitations of large memory and high cost required by the existing label printing method are effectively overcome, the labels can be printed under the ESC/POS instruction, and the common receipt printer can print the receipt and the label based on concise operation.

Description

Method for printing label based on ESC/POS instruction
Technical Field
The invention relates to the technical field of information printing application and optimization, in particular to a method for printing labels based on ESC/POS instructions, which is applied to a thermal printer.
Background
Currently the thermal printer industry operates mainly based on several instruction sets: 1. ESC/POS instructions, commonly used in ticket printers; 2. TSPL instructions, commonly used in label printers; 3. CPCL, ZPL, etc. instructions are commonly used in mobile label printers. In practical application, when instruction sets such as TSPL, ZPL and the like are adopted to print label information, because a printing canvas is required to be defined in advance, a memory with the canvas size is required at least, and the required memory is large, which means that the cost is increased;
the researchers of the invention consider that when ESC/POS instructions are used for printing the ticket data, the work mode of sending data while printing is adopted, and the memory required by the ESC/POS instructions is smaller because the printing data is not stored. However, the prior research lacks technical guidance for realizing the receipt information and the label information printing based on the ESC/POS instruction on the same hardware structure.
The information disclosed in the background section of the invention is only for enhancement of understanding of the general background of the invention and should not be taken as an acknowledgement or any form of suggestion that this information forms the prior art already known to a person skilled in the art.
Disclosure of Invention
To solve the above problems, the present invention provides a method for printing a label based on ESC/POS instructions, which in one embodiment includes:
step S1, after starting up, judging whether the printing requirement is receipt printing or label printing, if the printing requirement is receipt printing, directly waiting for a user command to execute paper feeding according to a paper feeding command of the user, further realizing receipt printing, and if the printing requirement is label printing, generating prompt information according to printing use record information, outputting and reminding the user of completing preparation work;
step S2, after the preparation work is finished, detecting whether a printing execution instruction is received, if so, judging a matched instruction execution mode according to the parameter content in the printing execution instruction, and implementing printing based on a strategy corresponding to the instruction execution mode;
and step S3, after the execution of each printing execution instruction is finished, generating a printing end instruction, automatically generating a paper feeding instruction and executing paper feeding operation.
Preferably, in the step S1, the print request is determined according to a print related instruction of the user, where the print related instruction includes a request selection instruction, a paper feeding instruction, or a print execution instruction;
the demand selection instruction is activated through a set key;
aiming at the condition that a user directly activates a paper feeding instruction or a printing execution instruction, the printing record of the last time is automatically acquired, and the printing requirement is used.
Further, in one embodiment, in step S1, for the case where the user directly activates the paper feeding instruction or the print execution instruction, the method further includes:
when the last printing record is automatically acquired, the demand confirmation information is output to the user, if confirmation feedback of the user is received, the follow-up operation is confirmed to be continuously executed according to the current printing demand, and otherwise, another printing demand is selected.
Specifically, in one embodiment, a prompt message output is generated from the print usage record information by prompting a user to complete a preparation job by:
judging whether the previous printing mode is label printing or not, if not, directly generating a paper feed prompt to remind a user to operate paper feed or automatically generate a paper feed instruction, if yes, further judging whether a paper bin is opened before the last printing is finished, if not, generating a prompt capable of directly printing, otherwise, generating a paper feed prompt or automatically generating a paper feed instruction.
In an alternative embodiment, specific paper feeding is automatically realized by identifying the position of the label paper according to the generated paper feeding instruction, so that the printing starting position is positioned at the position corresponding to the nearest next label paper, and the preparation work is finished after completion;
the position of the label paper can be detected in real time through the paper detection sensor, so that the accurate positioning of paper feeding operation in the printing process is realized.
In practical application, in one embodiment, the print execution instruction includes a command code, a print mode selection parameter, and print content data; the print content data includes: single line byte print parameters, print line number parameters, and specific content portions.
Further, in one embodiment, after the print execution instruction is determined to be received, the matched instruction execution mode is determined according to the parameter content in the print execution instruction according to the following operations:
and identifying a printing line number parameter in the instruction, determining to adopt a first instruction execution mode if the printing line number parameter meets a first setting condition, and adopting a second instruction execution mode if the printing line number parameter meets a second setting condition.
When a first instruction execution mode is adopted, the printing data quantity and the limit data quantity of a single label are calculated in real time, each time the continuous printing data quantity reaches the limit data quantity of the single label, a connection instruction and an interruption instruction are automatically generated, the paper feeding operation is activated, and the instruction is continuously executed after the paper feeding is finished until all the data quantities in the instruction are printed;
and when the second instruction execution mode is adopted, directly executing the printing execution instruction at one time until the printing execution instruction is completed.
Optionally, in one embodiment, the method further includes, during the printing implementation, identifying a type of the printing paper in the paper slot, if the type of the printing paper does not match the current printing requirement, stopping printing and outputting the reminding information;
and after confirming that the printing paper is matched, re-executing the current printing execution instruction.
Based on other aspects of the method described in any one or more of the embodiments above, the present invention also provides a storage medium having stored thereon program code that can implement the method described in any one or more of the embodiments above.
Compared with the closest prior art, the invention has the following beneficial effects:
according to the method for printing the label based on the ESC/POS instruction, the preparation work and the printing task are realized by autonomously distinguishing different printing requirements and adopting corresponding mechanism control, if the printing is the receipt printing, the instruction of the user is directly waited to be sequentially executed according to the paper feeding instruction and the printing instruction of the user, if the printing requirement is the label printing, prompt information output is generated according to the printing use record information, and the user is reminded of finishing the preparation work; different printing strategies are started according to different printing requirements, so that a common receipt printer can print the receipt and the label based on concise operation;
judging a matched instruction execution mode according to the parameter content in the printing instruction, and implementing printing according to a corresponding strategy; after the execution of the print execution instruction is completed, a paper feed instruction is automatically generated based on the end instruction, and a paper feed operation is executed. The processing details in the label printing process are fully considered, and under the premise of ensuring that the running memory is small, matched execution strategies are designed according to different printing instruction forms, so that the accuracy and the flexibility of label content printing are ensured, and the practicability and the reliability of multiple functions are ensured while the function diversification of the printing equipment is realized.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Drawings
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate the invention and together with the embodiments of the invention, serve to explain the invention, without limitation to the invention. In the drawings:
FIG. 1 is a schematic operation flow diagram of a method for printing labels based on ESC/POS instructions according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of paper searching in a method for printing labels based on ESC/POS instructions according to another embodiment of the present invention.
Detailed Description
The following will explain the embodiments of the present invention in detail with reference to the drawings and examples, so that the practitioner of the present invention can fully understand how to apply the technical means to solve the technical problems, achieve the implementation process of the technical effects, and implement the present invention according to the implementation process. It should be noted that, as long as no conflict is formed, each embodiment of the present invention and each feature of each embodiment may be combined with each other, and the formed technical solutions are all within the protection scope of the present invention.
Although a flowchart depicts operations as a sequential process, many of the operations can be performed in parallel, concurrently, or at the same time. The order of the operations may be rearranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The terms "first," "second," and the like may be used herein to describe various elements, but these elements should not be limited by these terms, and these terms are used merely to distinguish one element from another. The term "and/or" as used herein includes any and all combinations of one or more of the associated listed items. When an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used herein, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Currently the thermal printer industry operates mainly based on several instruction sets: 1. ESC/POS instructions, commonly used in ticket printers; 2. TSPL instructions, commonly used in label printers; 3. CPCL, ZPL, etc. instructions are commonly used in mobile label printers. In practical application, when instruction sets such as TSPL, ZPL and the like are adopted to print label information, because a printing canvas is required to be defined in advance, a memory with the canvas size is required at least, and the required memory is large, which means that the cost is increased;
the researchers of the invention consider that when ESC/POS instructions are used for printing the ticket data, the work mode of sending data while printing is adopted, and the memory required by the ESC/POS instructions is smaller because the printing data is not stored. However, the prior research lacks technical guidance for realizing the receipt information and the label information printing based on the ESC/POS instruction on the same hardware structure.
The invention provides a label printing method based on an ESC/POS instruction, which is characterized in that label printing realization logic is designed in a receipt printer based on the ESC/POS instruction, and the label can be printed under the ESC/POS instruction without using a printer with high cost and large memory, so that a common receipt printer can print not only the receipt, but also the label, the cost is saved, the efficiency is improved, and the market competitiveness of a product is effectively improved.
The detailed flow of the method of embodiments of the present invention is described in detail below based on the attached drawing figures, where the steps shown in the flowchart of the figures may be performed in a computer system containing, for example, a set of computer executable instructions. Although a logical order of steps is depicted in the flowchart, in some cases the steps shown or described may be performed in a different order than presented.
Example 1
When the printer is actually applied, the required memory is smaller when the receipt printing is realized, the printer prints while receiving the printing data, and in the printing process, the printer automatically positions the starting position and the ending position of the printing content, and automatically performs paper searching to the starting position of the receipt paper information content printing when the printer is on paper, and automatically searches to the ending of the information content and the starting position of the next receipt information after the printing is finished. In the receipt printing, after a print instruction is executed, the printer only needs to stop, and at most, a paper feeding instruction (for example, 1B 64) is executed at the end of the printing content.
However, when label printing is realized, since the automatic paper feeding to the specific starting position of the next label is required after the printing is finished, the label printing cannot be realized by directly executing the paper feeding instruction sent by the upper computer, otherwise, the printing position is deviated. When the label printing is realized, the paper feeding requirement is different from that of the paper feeding of the receipt printing, the paper feeding of the receipt printing is at any position, but the paper feeding unit of the label must be a sheet. For example, the paper feed key is pressed, and in the receipt printing mode, the receipt paper is fed, the paper feed key is released, and the receipt paper stops feeding. In the label mode, the paper feed key needs to be pressed, the printer stops just after one label is moved, and stops at the printing position of the next label, and the manual control is difficult to realize, so that a corresponding control mechanism needs to be arranged.
Fig. 1 is a flowchart of a method for printing a label based on an ESC/POS instruction according to an embodiment of the present invention, and referring to fig. 1, it can be appreciated that, based on the above consideration, in one embodiment, the method of the present invention includes the following steps.
Step S1, after starting up, judging whether the printing requirement is receipt printing or label printing, if the printing requirement is receipt printing, directly waiting for a user command to execute paper feeding according to a paper feeding command of the user, further realizing receipt printing, and if the printing requirement is label printing, generating prompt information according to printing use record information, outputting and reminding the user of completing preparation work;
step S2, after the preparation work is finished, detecting whether a printing execution instruction is received, if so, judging a matched instruction execution mode according to the parameter content in the printing execution instruction, and implementing printing based on a strategy corresponding to the instruction execution mode;
and step S3, after the execution of each printing execution instruction is finished, generating a printing end instruction, automatically generating a paper feeding instruction and executing paper feeding operation.
When the method is actually applied, the printer is started, and a label can be automatically moved according to the situation, so that the position of the label can be determined. (the label gap can be automatically learned), but if the printer is started up, the printer can be started up through the activation of a paper feeding key or the opening and closing of the printer if not necessary. Even if the paper bin is not opened in the last shutdown state, the automatic paper feeding after startup is not necessary.
Thus, in one embodiment, further, the user is prompted to complete the preparation by generating a reminder output from the print usage record information by:
judging whether the previous printing mode is label printing or not, if not, directly generating a paper feed prompt to remind a user to operate paper feed or automatically generate a paper feed instruction, if yes, further judging whether a paper bin is opened before the last printing is finished, if not, generating a prompt capable of directly printing, otherwise, generating a paper feed prompt or automatically generating a paper feed instruction.
When the label is printed, the paper feeding requirement is different from that of the paper feeding of the receipt printing, the paper feeding of the receipt printing is at any position, but the paper feeding unit of the label is required to be a sheet. For example, the paper feed key is pressed, and in the receipt printing mode, the receipt paper is fed, the paper feed key is released, and the receipt paper stops feeding. In the label mode, the paper feeding key is pressed, the printer stops after one label is fed, and stops at the printing position of the next label, so in one embodiment, specific paper feeding is automatically realized by identifying the position of the label paper according to the generated paper feeding instruction, the printing starting position is positioned at the position corresponding to the nearest next label paper, and the preparation work is finished after the completion of the printing.
Specifically, in one embodiment, the position of the label paper is detected in real time by the paper detection sensor, so that accurate positioning of paper feeding operation in the printing process is realized.
In order to enable both the ordered realization of receipt printing and the realization of label printing on the same printing device, it is necessary to accurately identify the type of printing to be performed by the user, i.e. the printing requirement, preferably, in step S1, the printing requirement is determined according to the printing related instruction of the user;
considering that it is possible that the user directly controls to start the print activation paper feed instruction or the print execution instruction without operating the print type selection button after operating the printing apparatus, in one embodiment, the print-related instruction includes a demand selection instruction or a paper feed instruction;
the demand selection instruction is activated through a set key;
aiming at the condition that a user directly activates a paper feeding instruction or a printing execution instruction, the printing record of the last time is automatically acquired, and the printing requirement is used.
Further, considering that the previous printing requirement is directly used, when the operator changes or faces different working scenes, there may be a situation that the adjacent printing requirements are inconsistent, which may cause the requirement selection information to be wrong, in order to ensure the reliability of the printing requirement, in one embodiment, in step S1, for the case that the user directly activates the paper feeding instruction or the printing execution instruction, the method further includes:
when the last printing record is automatically acquired, the demand confirmation information is output to the user, if confirmation feedback of the user is received, the follow-up operation is confirmed to be continuously executed according to the current printing demand, and otherwise, another printing demand is selected.
Specifically, in one embodiment, the print execution instruction includes a command code, a print mode selection parameter, and print content data; the print content data includes: single line byte print parameters, print line number parameters, and specific content portions.
In practical application, the host computer sends a print command, and a generally valid print command is used in esc\pos using 1d 76: the specific commands are as follows:
1D 76 30m[xL xH yL yH d1.....dk]
wherein:
1D 76 is a command code, and the format is fixed;
m is: a mode selection parameter of multiple width and multiple height;
[ xlxhyl yH d1...dk ] is specific print data in which:
xL, xH: indicating how many bytes of data are needed to print a line, xL is low byte, xH is high byte,
the number of bytes required to print a line= (xH. 256) + (xL)
yL, yH: indicating how many lines of printing can be supported by the data in the command, yL is a low byte, yH is a high byte,
line number of data supportable for printing= (yH. 256) + (yL)
d1...dk: for specific data, d1 is the first byte and dk is the last byte;
k is the number of total bytes in the command, and the calculation method is as follows:
k= [ number of bytes required for single-line printing ] [ number of lines that can support printing ]
=[(xH*256)+(xL)]*[(yH*256)+(yL)]
Further, according to the above printing instruction, but the upper computer has two instruction sending modes, in practical application, which instruction sending method is adopted specifically generally depends on the configuration of the upper computer, when a PC is generally used for printing at present, more first modes are used, more second modes are used for printing by a mobile phone, and accordingly, two printing instruction executing modes are designed in the invention:
the first is the usual way for USB drives: the printing instruction acts as a single instruction at 3mm, namely 24 points, and a whole label task is distributed by dividing the whole label task into multiple instructions of 3 mm. Assuming that a tag is rated for print data of 48 x 100mm, printing a tag will send 34 print instructions in total (100 mm/3mm, which is divided into 34 pieces of distribution data, with a data amount of 1mm being sent the last time). If, in a conventional manner, the next label is fed after each print command, it is clearly unpaired, and therefore, it is necessary to execute one splice command after each unit print command (1 d 76 print command, corresponding to the print content in a single command) is sent: 1 F0 03 00. After printing of the entire label is completed, executing an end command: 1 F0 f 05 00; after the printer executes the end command, the printer can automatically feed paper to the next label; the method can reduce the memory required by the upper computer during the conversion of the printing content as much as possible.
The second mode is to directly send the content to be printed of the whole label through the whole 1D 76 printing instruction at one time, 1 F0 05 00 is not needed to be connected, even 1 F0 03 00 finishing command is not needed, the label is directly and automatically fed to be printed after the printing execution instruction is implemented, wherein the instruction sent by data is 1D 76 30m[xL xH yL yH d1.
Based on the above analysis, in one embodiment, after determining that a print execution instruction is received, an instruction execution mode is designed to determine matching according to the content of parameters in the print execution instruction according to the following operations:
and identifying a printing line number parameter in the instruction, determining to adopt a first instruction execution mode if the printing line number parameter meets a first setting condition, and adopting a second instruction execution mode if the printing line number parameter meets a second setting condition.
Specifically, in one embodiment, when a first instruction execution mode is adopted, the printing data quantity and the limit data quantity of a single label are calculated in real time, each time the continuous printing data quantity reaches the limit data quantity of the single label, a connection instruction and an interruption instruction are automatically generated, the paper feeding operation is activated, and after paper feeding is completed, the instruction is continuously executed until all the data quantities in the instruction are printed;
and when the second instruction execution mode is adopted, directly executing the printing execution instruction at one time until the printing execution instruction is completed.
In practical applications, in the first mode, both commands are possible, so the printer needs to automatically adapt to 2 modes. In addition, the 1 F0 f 03 00 and 1 F0 f 05 00 commands are either standard ESC/POS commands, which belong to a data end flag, or the host computer tells the printer that one piece of data is ended or one piece of label is printed, and if the 2 pieces of data are not available, the printer cannot autonomously locate the printing position progress relative to the label. Before each printing instruction is implemented, the starting point of the label needs to be stopped at the position of a printing line, and after the label is printed, the label needs to be automatically fed to the position of a paper tearing knife.
In actual printing, the first instruction sending mode or the second instruction sending mode can be distinguished according to the YI YH value of the unit printing instruction, if the value is 24, the first instruction sending mode is adopted, and if the value is greater than 24, the second instruction sending mode is adopted.
If the data is transmitted in the first mode, the amount of data of a single instruction transmitted is usually 3mm, so that whether the data is transmitted in the first mode or the second mode can be automatically distinguished by judging whether the amount of data in the instruction is 3mm, and if the data is transmitted in the first mode, the 2 instructions are necessary.
The specific mode can be seen according to the actual situation of the upper computer, if the operation speed of the upper computer is low and the memory is small, the first mode can be adopted, otherwise, the second mode can also be adopted. The second approach is simpler to control and does not require complex calculations and image segmentation.
During printing, the paper detection sensor needs to detect the label position in real time. So as to locate the label position in real time and strengthen the locating precision of the label position. When the printing is finished, if the label positioning is still located in the label, the paper feeding is continued to the tail of the label, and the next label is stopped at the starting position. If the label has reached the end position during printing, two schemes are adopted, one scheme is to end printing, the content which is not printed is discarded, the printer is still stopped at the start position of the next label, the other scheme is to continue printing, the rest printing content is printed on the second label, after printing, paper feeding is continued to the end of the second label, and the printer is stopped at the start position of the third label.
In particular, how to realize label positioning, mainly according to the type of the label, the labels which are widely used at present mainly comprise a die-cut label, a black label, a positioning hole label and the like. Therefore, in practical application, the photoelectric sensor can be arranged on the printer to determine the position of the label according to the mark on the label; fig. 2 shows an operation flow of realizing automatic paper feeding (paper searching) after printing is completed in the embodiment of the present invention.
Further, since the receipt information and the label information are to be printed on the same printing apparatus at the same time, and the types of printing papers required for the two printing demands are different, but the printing demands and the printing paper are not corresponding, although the printing action can be realized, the result of the printing is invalid, not only the printing consumables are wasted, but also the printing apparatus performs redundant work, resulting in double waste of resources and time. Therefore, in order to ensure that when the printing requirement and the condition that the printing paper distribution is not matched with the starvation exist, the printing paper distribution can be timely found and processed by an operator, preferably, in one embodiment, the method further comprises the steps of identifying the type of the printing paper in the paper slot in real time in the printing process, and if the type of the printing paper is not matched with the current printing requirement, stopping printing and outputting reminding information;
and after confirming that the printing paper is matched, re-executing the current printing execution instruction.
Based on the label printing mechanism based on the ESC/POS instruction provided by the embodiment of the invention, the label can be printed under the ESC/POS instruction without using a printer with high cost and large memory, so that the common receipt printer can print not only the receipt, but also the label, the limitations of high memory and high cost required by the conventional label printing mechanism are overcome, the market competitiveness of the product is effectively improved, and the function diversification of printing equipment is expanded.
In addition, in combination with the actual demand, the technician can also set two label printing mechanisms of ESC/POS instruction and TSPL instruction on the synonymous printing equipment according to the demand; when applied to a printed label, the two instruction sets of the ESC/POS instruction and the TSPL instruction are different, the ESC/POS instruction is usually started by a 16-ary command such as 1F, 1B, etc., and the TSPL instruction is started by a character, for example, a printed text instruction is: TEXT 5,80, "0, 1," producer ". In the ESC/POS instruction, the text is printed as what you see is what you get, and the characters in the word stock can be printed directly, so if the instruction is set as the ESC/POS instruction, the instruction cannot be compatible with the TSPL instruction, and the instruction can be output as the text to the printing paper, but when the instruction is set as the TSPL instruction, the instruction can be compatible with all instructions of the ESC/POS except the text. When two instructions coexist, the TSPL instruction can be set as default, and most of the two instructions can be compatible. No manual intervention by personnel is required.
For the foregoing method embodiments, for simplicity of explanation, the methodologies are shown as a series of acts, but one of ordinary skill in the art will appreciate that the present invention is not limited by the order of acts, as some steps may, in accordance with the present invention, occur in other orders or concurrently. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
It should be noted that in other embodiments of the present invention, the method may also be combined with any one or more of the above embodiments to obtain a new label printing method.
It should be noted that, based on the method in any one or more of the foregoing embodiments of the present invention, the present invention further provides a storage medium, where a program code capable of implementing the method in any one or more of the foregoing embodiments is stored, where the code, when executed by an operating system, can implement the method for printing a label based on the ESC/POS instruction as described above.
It is to be understood that the disclosed embodiments are not limited to the specific structures, process steps, or materials disclosed herein, but are intended to extend to equivalents of these features as would be understood by one of ordinary skill in the relevant arts. It is also to be understood that the terminology used herein is for the purpose of describing particular embodiments only, and is not intended to be limiting.
Reference in the specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. Thus, the appearances of the phrase "one embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment.
Although the embodiments of the present invention are described above, the embodiments are only used for facilitating understanding of the present invention, and are not intended to limit the present invention. Any person skilled in the art can make any modification and variation in form and detail without departing from the spirit and scope of the present disclosure, but the scope of the present disclosure is still subject to the scope of the appended claims.

Claims (10)

1. A method of printing a label based on ESC/POS instructions, the method comprising:
step S1, after starting up, judging whether the printing requirement is receipt printing or label printing, if the printing requirement is receipt printing, directly waiting for a user command to execute paper feeding according to a paper feeding command of the user, further realizing receipt printing, and if the printing requirement is label printing, generating prompt information according to printing use record information, outputting and reminding the user of completing preparation work;
step S2, after the preparation work is finished, detecting whether a printing execution instruction is received, if so, judging a matched instruction execution mode according to the parameter content in the printing execution instruction, and implementing printing based on a strategy corresponding to the instruction execution mode;
and step S3, after the execution of each printing execution instruction is finished, generating a printing end instruction, automatically generating a paper feeding instruction and executing paper feeding operation.
2. The method according to claim 1, wherein in the step S1, the print request is determined according to a print-related instruction of the user, the print-related instruction including a request selection instruction, a paper feed instruction, or a print execution instruction;
the demand selection instruction is activated through a set key;
aiming at the condition that a user directly activates a paper feeding instruction or a printing execution instruction, the printing record of the last time is automatically acquired, and the printing requirement is used.
3. The method according to claim 1, wherein in step S1, for the case where the user directly activates the paper feed instruction or the print execution instruction, further comprising:
when the last printing record is automatically acquired, the demand confirmation information is output to the user, if confirmation feedback of the user is received, the follow-up operation is confirmed to be continuously executed according to the current printing demand, and otherwise, another printing demand is selected.
4. The method of claim 1, wherein the user is alerted to the completion of the preparation by generating a reminder output based on the print usage record information by:
judging whether the previous printing mode is label printing or not, if not, directly generating a paper feed prompt to remind a user to operate paper feed or automatically generate a paper feed instruction, if yes, further judging whether a paper bin is opened before the last printing is finished, if not, generating a prompt capable of directly printing, otherwise, generating a paper feed prompt or automatically generating a paper feed instruction.
5. The method according to claim 1, wherein for the generated paper feed instruction, specific paper feed is automatically realized by identifying the position of the label paper, so that the printing start position is positioned at the position corresponding to the nearest next label paper, and the preparation work is finished after completion;
the position of the label paper is detected in real time through the paper detection sensor, so that accurate positioning of paper feeding operation in the printing process is realized.
6. The method of claim 1, wherein the print execution instructions include a command code, a print mode selection parameter, and print content data; the print content data includes: single line byte print parameters, print line number parameters, and specific content portions.
7. The method according to claim 1, wherein after determining that the print execution instruction is received, determining a matching instruction execution mode according to the parameter content in the print execution instruction is performed according to:
and identifying a printing line number parameter in the instruction, determining to adopt a first instruction execution mode if the printing line number parameter meets a first setting condition, and adopting a second instruction execution mode if the printing line number parameter meets a second setting condition.
8. The method of claim 7, wherein when the first instruction execution mode is adopted, the printing data amount and the single label limit data amount are calculated in real time, each time the continuous printing data amount reaches the single label limit data amount, a connection instruction and an interruption instruction are automatically generated, the paper feeding operation is activated, and the instruction is continuously executed after the paper feeding is finished until all the data amounts in the instruction are printed;
and when the second instruction execution mode is adopted, directly executing the printing execution instruction at one time until the printing execution instruction is completed.
9. The method of claim 1, further comprising, during the printing, identifying a type of the printing paper in the paper slot, and if the type of the printing paper does not match the current printing requirement, stopping printing and outputting the reminding information;
and after confirming that the printing paper is matched, re-executing the current printing execution instruction.
10. A storage medium having stored thereon program code for implementing the method of any of claims 1 to 9.
CN202111457170.9A 2021-12-01 2021-12-01 Method for printing label based on ESC/POS instruction Pending CN116198242A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111457170.9A CN116198242A (en) 2021-12-01 2021-12-01 Method for printing label based on ESC/POS instruction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111457170.9A CN116198242A (en) 2021-12-01 2021-12-01 Method for printing label based on ESC/POS instruction

Publications (1)

Publication Number Publication Date
CN116198242A true CN116198242A (en) 2023-06-02

Family

ID=86510058

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111457170.9A Pending CN116198242A (en) 2021-12-01 2021-12-01 Method for printing label based on ESC/POS instruction

Country Status (1)

Country Link
CN (1) CN116198242A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002205872A (en) * 2001-01-05 2002-07-23 Seiko Epson Corp Printer, its control method, and information storage medium
JP2003246129A (en) * 2002-02-27 2003-09-02 Seiko Epson Corp Printer, computer program, computer system and printing method
JP2007015373A (en) * 2005-06-10 2007-01-25 Seiko Epson Corp Printer, printing control method and program
JP2008126648A (en) * 2006-11-27 2008-06-05 Sato Corp Printer and printing method
JP2016081320A (en) * 2014-10-17 2016-05-16 セイコーエプソン株式会社 Print setting method of printing system, program and printing system
CN106462368A (en) * 2014-06-05 2017-02-22 精工爱普生株式会社 Printing control device, printing system, and printing control method
CN111823736A (en) * 2020-07-02 2020-10-27 西安富立叶微电子有限责任公司 Label paper identification and positioning method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2002205872A (en) * 2001-01-05 2002-07-23 Seiko Epson Corp Printer, its control method, and information storage medium
JP2003246129A (en) * 2002-02-27 2003-09-02 Seiko Epson Corp Printer, computer program, computer system and printing method
JP2007015373A (en) * 2005-06-10 2007-01-25 Seiko Epson Corp Printer, printing control method and program
JP2008126648A (en) * 2006-11-27 2008-06-05 Sato Corp Printer and printing method
CN106462368A (en) * 2014-06-05 2017-02-22 精工爱普生株式会社 Printing control device, printing system, and printing control method
JP2016081320A (en) * 2014-10-17 2016-05-16 セイコーエプソン株式会社 Print setting method of printing system, program and printing system
CN111823736A (en) * 2020-07-02 2020-10-27 西安富立叶微电子有限责任公司 Label paper identification and positioning method

Similar Documents

Publication Publication Date Title
US7503712B2 (en) Printing apparatus for selecting the appropriate error state mode according to the application type and user desired print results
US7230730B2 (en) Selective printing after consumable exhaustion
US7515284B2 (en) Printing device using two printing parts and a reading sensor for continuous printing
JP4416801B2 (en) Information processing apparatus and information processing method
EP2305479A1 (en) Control of printing mechanisms
JP3440575B2 (en) POS system and control method thereof
US6752548B2 (en) Printer and print system
WO2006038374A1 (en) Printer and printing method
US7255501B2 (en) Printing device
CN116198242A (en) Method for printing label based on ESC/POS instruction
JPS62197821A (en) Word processor
EP3103645B1 (en) Printer, and printing method and memory therefor
JP6094651B2 (en) Print media
CN116594573A (en) Printing consumable identification method and device, printing equipment and storage medium
US7532351B2 (en) Apparatus, method and program for producing small prints
JPH07214828A (en) Tape printing device
JP2008142899A (en) Printer, method of detecting paper width of printer, and control program of printer
EP3373128A1 (en) Method and printing system for processing a printjob
JP4307770B2 (en) Label printer
JP2000020274A (en) Printer, print instruction generating device, and print system
JP2007018127A (en) Printing system, control method therefor and program
JP2005047087A (en) Label printer
JPH01128857A (en) Label printer
JP2001282394A (en) Communication terminal equipment, its control method and its recording medium
JP2003072180A (en) Print processing method

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