Disclosure of Invention
In view of the above, an object of the present invention is to provide a method for controlling printing of a label paper and a printer, which can solve the problem of the related art that the label paper may be wasted when printing the label paper.
In order to achieve the purpose, the invention adopts the following technical scheme:
provided is a label paper printing control method, characterized by comprising: receiving print data; acquiring the length of a page to be printed and the actual page length of the marking paper; judging whether the length of the page to be printed is matched with the actual page length of the marking paper or not; when the length of the page to be printed is not matched with the actual page length of the marking paper, outputting prompt information; when the length of the page to be printed matches the actual page length of the marking paper, the print data is printed.
Preferably, the acquiring the length of the page to be printed includes: inquiring a control instruction in the printing data to obtain the length of a page to be printed; or, calculating the length of the page to be printed according to the printing data.
Preferably, the obtaining of the actual face length of the marking paper comprises: reading the actual ticket face length of the pre-stored marking paper; alternatively, the actual page length of the marking paper is acquired by performing automatic calibration of the page length of the marking paper.
Preferably, the judging whether the length of the page to be printed matches the actual page length of the marking paper comprises: and when the length of the page to be printed is greater than the actual page length of the marking paper, judging that the length of the page to be printed is not matched with the actual page length of the marking paper.
Preferably, the judging whether the length of the page to be printed matches the actual page length of the marking paper comprises: and when the length of the page to be printed is less than or equal to the actual page length of the marking paper, judging that the length of the page to be printed is matched with the actual page length of the marking paper.
Preferably, when the length of the page to be printed does not match the actual page length of the marking paper, outputting the prompt information includes: printing prompt information for indicating that the page length of the printing data does not match with the actual page length of the marking paper on the first page of marking paper; or outputs sound or light or voice information indicating that the page length of the print data does not match the actual page length of the marking paper.
There is also provided a printer including a communication unit for receiving print data; a printing unit configured to print data; the indicating unit is used for outputting prompt information; the control unit is used for acquiring the length of the page to be printed and the actual page length of the marking paper, judging whether the length of the page to be printed is matched with the actual page length of the marking paper, controlling the indicating unit or the printing unit to output prompt information when judging that the length of the page to be printed is not matched with the actual page length of the marking paper, and controlling the printing unit to print the printing data when judging that the length of the page to be printed is matched with the actual page length of the marking paper.
Preferably, the control unit obtains the length of the page to be printed by querying a control instruction in the print data, or calculates the length of the page to be printed according to the print data.
Preferably, the printer further comprises a memory for storing the actual page length of the label sheet.
Preferably, the control unit determines that the length of the page to be printed does not match the actual page length of the marking paper when the length of the page to be printed is greater than the actual page length of the marking paper.
Preferably, the control unit determines that the length of the page to be printed matches the actual page length of the marking paper when the length of the page to be printed is equal to or less than the actual page length of the marking paper.
Preferably, when the length of the page to be printed does not match the actual page length of the marking paper, the control unit controls the printing unit to print, on the first page of marking paper, indication information indicating that the page length of the print data does not match the actual page length of the marking paper; or the control unit controls the instructing unit to output sound or light or voice information indicating that the page length of the print data does not match the actual page length of the marking paper.
According to the marking paper printing control method provided by the embodiment of the invention, before printing, whether the length of the page to be printed is matched with the actual page length of the marking paper is judged, the page to be printed is printed only when the length of the page to be printed is matched with the actual page length of the marking paper, and when the length of the page to be printed is not matched with the actual page length of the marking paper, prompt information is sent to remind a user of replacing proper marking paper, so that the problem that the marking paper is possibly wasted during printing of the marking paper in the prior art can be effectively solved.
Detailed Description
The technical scheme of the invention is further explained by the specific implementation mode in combination with the attached drawings.
Fig. 3 is a schematic block composition diagram of a printer according to a first embodiment of the present invention, and as shown in the drawing, the printer 1 includes acontrol unit 10, acommunication unit 11, aRAM memory 12, aFlash memory 13, aprinting unit 14, afeeding unit 15, asensor 16, and an indicatingunit 17.
Thecontrol unit 10 is used for controlling other modules to perform work and perform data calculation and processing, for example, controlling thecommunication unit 11 to perform data transmission between the printer 1 and the print request device, controlling theprinting unit 14 to perform image printing, and the like.
Thecommunication unit 11 is configured to perform data transmission between the printer 1 and the print request device, for example, thecommunication unit 11 receives print data sent by the print request device, where the print data includes a control instruction, graphics data, or character data, the control instruction is used to indicate a line number of a page, a position of the graphics data, a height and a width of the character data, and the like, where the line number may be a dot line (dot line) number or a pixel line (pixel line).
TheRAM memory 12 includes areception buffer 121, aprint buffer 122, and atemporary buffer 123. Wherein thereception buffer 121 is used to store the print data received by thecommunication unit 11; theprint buffer 122 is used to store dot matrix data sent to theprint head 141 of theprinting unit 14; thetemporary buffer 123 is used to store data and variables generated during the program running process.
The Flashmemory 13 is used to store a control program of the printer 1 and a fixed value required during the program operation, wherein the fixed value includes the actual page length of the label paper. The actual page length of the marking paper is stored in the memory by performing automatic calibration of the page length, or is set in the memory by the user according to the specification of the marking paper used by the printer. Further, the fixed value also comprises a first preset distance for automatically calibrating the page length of the marking paper and a preset threshold value for judging whether the length of the page to be printed is matched with the actual nominal length of the marking paper.
Theprinting unit 14 is configured to print preset patterns or characters on a label paper according to a control signal output by thecontrol unit 10, where theprinting unit 14 may be a stylus printing unit, a thermal transfer printing unit, an inkjet printing unit, and the like, in this embodiment, theprinting unit 14 is a thermal printing unit and includes aprinting head 141 and aprinting roller 142, when the printer 1 performs printing, the label paper passes through between theprinting head 141 and theprinting roller 142, a thermal layer of the label paper contacts theprinting head 141, theprinting head 141 includes a plurality of heating elements arranged in a row at equal intervals in a width direction of the label paper, and when performing printing, the heating elements of theprinting head 141 generate heat to chemically change and develop the thermal layer of the label paper, so as to form the preset patterns or characters on the label paper.
Theconveying unit 15 includes amotor driver 151, amotor 152 and aconveying roller assembly 153, themotor driver 151 is used for providing working current to themotor 152 according to a control signal output by thecontrol unit 10 so as to drive an output shaft of themotor 152 to rotate, the output shaft of themotor 152 is in transmission connection with theprinting roller 142 arranged in the conveying channel and the conveying roller of theconveying roller assembly 153, and when the output shaft of themotor 152 rotates, theprinting roller 142 and the conveying roller of theconveying roller assembly 153 rotate along with the output shaft, so that the marking paper is driven to move in the conveying channel.
Thesensor 16 is used for detecting marks and non-marks of the marking paper, thesensor 16 comprises alight generator 161 and alight receiver 162, thelight generator 161 and thelight receiver 162 are arranged in the conveying channel and are respectively electrically connected with thecontrol unit 10, thelight generator 161 emits light with certain intensity under the action of driving current provided by thecontrol unit 10 and irradiates on the marking paper, the light irradiating on the marking paper is received by thelight receiver 162 after being reflected (when thesensor 16 is a reflection sensor) or transmitted (when thesensor 16 is a transmission sensor) by the marking paper, and thelight receiver 162 converts received light signals into electric signals and transmits the electric signals to thecontrol unit 10. Since the marks and the non-marks of the marking paper have different reflectances and transmittances, thesensor 16 outputs a first signal (e.g., high level) when the non-marks of the marking paper are located at the detection position of thesensor 16, and thesensor 16 outputs a second signal (e.g., low level) when the marks of the marking paper are located at the detection position of thesensor 16. Thecontrol unit 10 can determine whether the marking paper located at the detection position of thesensor 16 is marked or unmarked by detecting the output value of thesensor 16.
And an indicatingunit 17 for sending out prompt information in a light, sound or other mode according to the requirement of thecontrol unit 10, wherein the prompt information indicates that the length of the page to be printed does not match with the actual page length of the marking paper, and the indicatingunit 17 can be an indicator lamp, a liquid crystal display screen, a buzzer, a voice device and the like.
Fig. 4 is a flowchart of a marking paper printing control method according to a first embodiment of the present invention, as shown, the method includes the steps of:
step S101, receiving printing data
Thecommunication unit 11 receives print data transmitted by the print request apparatus. The print data includes control instructions, bitmap data, or character data. The print data may be print data for a single page or print data for a plurality of pages.
Step S102, obtaining the length of the page to be printed and the actual page length of the marking paper
Thecontrol unit 10 parses the received print data to obtain the length of a page to be printed, where the page length is specifically the number of lines of the image printed in the paper feeding direction. The acquisition method comprises any one of the following steps:
the first method is to inquire a control instruction for expressing the number of page lines and determine the length of a page to be printed.
And secondly, calculating the page length. The calculation method is as follows: when the print data received by thecontrol unit 10 includes graphic data, the graphic data of the received print page is stored in the memory first, and then the number of lines of the image to be printed in the paper feeding direction is calculated; when the print data received by thecontrol unit 10 includes character data, the character data is first converted into graphics data, and then the number of lines of the graphics data is calculated.
Thecontrol unit 10 reads the actual page length of the marking paper stored in the Flashmemory 13 to acquire the actual page length of the marking paper. The actual page length of the label paper is stored in the Flashmemory 13 after automatic calibration of the page length is executed, or is set in the Flashmemory 13 by a user according to the specification of the label paper used by the printer.
It should be noted that, in other embodiments of the present invention, the actual page length of the marking paper may also be obtained by performing automatic calibration of the page length of the marking paper, where the automatic calibration method of the page length of the marking paper includes the following steps:
step S21, paper is fed for a first predetermined distance
The conveyingunit 15 drives the marking sheet to advance by a first predetermined distance that is at least greater than a distance between two adjacent marks of the marking sheet.
Step S22, calculating the actual page length of the label paper by detecting the output value of the sensor
In the paper feeding process, the output value of thesensor 16 is recorded once every time the label paper moves a unit distance, and the distance between two adjacent labels, namely the actual page length of the label paper, is calculated according to the change rule of the output value and the corresponding relation between the distance moved by the label paper.
Preferably, the method for automatically calibrating the page length of the label paper further comprises:
step S23, ejecting the paper for a first predetermined distance
The conveyingunit 15 drives the marking paper to retreat by a first predetermined distance to retreat the marking paper to an initial position to avoid wasting unused marking paper.
Preferably, thecontrol unit 10 obtains the actual page length of the tag paper by performing automatic calibration of the page length of the tag paper only when the first printing is performed after power-on, and stores the obtained actual page length of the tag paper in theFLASH memory 13, and obtains the actual page length of the tag paper by reading theFLASH memory 13 when the non-first printing is performed after power-on. Therefore, the accuracy of the actual page length of the marking paper can be ensured, the automatic calibration of the page length of the marking paper can be avoided being executed during each printing, and the printing speed is improved.
Step S103, judging whether the length of the page to be printed is matched with the actual page length of the marking paper or not
The control unit compares the acquired length of the page to be printed with the actual page length of the marking paper, and when the length of the page to be printed is less than or equal to the actual page length of the marking paper, the length of the page to be printed is matched with the actual page length of the marking paper, otherwise, the length of the page to be printed is not matched with the actual page length of the marking paper.
It should be noted that, the criterion for determining whether the length of the page to be printed is matched with the actual page length of the marking paper may be set according to actual needs, in other embodiments of the present invention, when the difference between the actual page length of the marking paper and the length of the page to be printed is greater than zero and smaller than a set threshold, thecontrol unit 10 determines that the actual page length of the marking paper and the length of the page to be printed are matched with each other, and when the difference between the actual page length of the marking paper and the length of the page to be printed is smaller than zero or greater than the set threshold, thecontrol unit 10 determines that the actual. The judgment principle can avoid the problem of marking paper waste caused by the fact that the length of the page to be printed is too small relative to the actual page length of the marking paper.
When the length of the page to be printed matches the actual page length of the marking paper, step S104 is executed, otherwise, step S105 is executed.
Step S104, printing the page to be printed
Thecontrol unit 10 controls the conveyingunit 15 to drive the label paper to move in the channel, meanwhile, the printing data is sent to theprinting head 141 of theprinting unit 14, and when the printing start position of the current page of the label paper moves to the printing position of theprinting head 141, thecontrol unit 10 controls theprinting head 141 to print preset images and characters on the surface of the label paper.
Step S105, outputting the prompt information
Thecontrol unit 10 controls the instructingunit 17 or theprinting unit 14 to output prompt information indicating that the page length of a single piece of print data does not match the actual page length of the marking paper, to prompt the user to replace the appropriate marking paper.
The method for controlling the prompt information output by the indicatingunit 17 by thecontrol unit 10 includes: thecontrol instruction unit 17 outputs sound, light or text information, and thus, the prompt information includes one or a combination of more of the following information:
1) the indicator light flickers according to a set frequency;
2) text information displayed by the liquid crystal display screen, such as 'paper type is not matched, please change paper';
3) the buzzer buzzes according to a set frequency;
4) voice information sent by the voice device, such as "paper type does not match, please change paper";
the prompt message method for controlling theprinting unit 14 to output by thecontrol unit 10 comprises the following steps: prompt information indicating that the page length of a single piece of print data does not match the actual page length of the marking paper is printed on the first piece of marking paper, for example, the print head prints "paper type does not match, please change paper" on the marking paper.
According to the marking paper printing control method provided by the embodiment of the invention, before printing, whether the length of the page to be printed is matched with the actual page length of the marking paper is judged, printing is executed only when the length of the page to be printed is matched with the actual page length of the marking paper, and when the length of the page to be printed is not matched with the actual page length of the marking paper, prompt information is sent out to remind a user of replacing proper marking paper, so that the problem that the marking paper is possibly wasted during printing of the marking paper in the prior art can be effectively solved.
The technical principle of the present invention is described above in connection with specific embodiments. The description is made for the purpose of illustrating the principles of the invention and should not be construed in any way as limiting the scope of the invention. Based on the explanations herein, those skilled in the art will be able to conceive of other embodiments of the present invention without inventive effort, which would fall within the scope of the present invention.