WO2014000659A1 - Printing control method and printer - Google Patents

Printing control method and printer Download PDF

Info

Publication number
WO2014000659A1
WO2014000659A1 PCT/CN2013/078131 CN2013078131W WO2014000659A1 WO 2014000659 A1 WO2014000659 A1 WO 2014000659A1 CN 2013078131 W CN2013078131 W CN 2013078131W WO 2014000659 A1 WO2014000659 A1 WO 2014000659A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
horizontal compression
compressed
expression
compression ratio
Prior art date
Application number
PCT/CN2013/078131
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 WO2014000659A1 publication Critical patent/WO2014000659A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K15/00Arrangements for producing a permanent visual presentation of the output data, e.g. computer output printers
    • G06K15/02Arrangements for producing a permanent visual presentation of the output data, e.g. computer output printers using printers
    • G06K15/18Conditioning data for presenting it to the physical printing elements
    • G06K15/1894Outputting the image data to the printing elements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K15/00Arrangements for producing a permanent visual presentation of the output data, e.g. computer output printers
    • G06K15/02Arrangements for producing a permanent visual presentation of the output data, e.g. computer output printers using printers
    • G06K15/18Conditioning data for presenting it to the physical printing elements
    • G06K15/1894Outputting the image data to the printing elements
    • G06K15/1898Outputting the image data to the printing elements while adapting the order of the data to the printing elements' arrangement, e.g. row-to-column conversion

Definitions

  • the first data processing method is that a print information generating device (such as a computer) generates dot matrix data and sends it to a printer, and the dot matrix print data is directly printed by the printer;
  • the data processing method is that the print information generating device generates character print data including a text code and various typesetting instructions, and sends the character print data to the printer according to the typesetting instruction, such as line spacing, character spacing, etc., according to the text.
  • the code looks up the dot matrix data of the character corresponding to the text code stored in the non-volatile memory of the printer to convert the character print data into dot matrix print data.
  • the related art provides a print control method for processing original dot matrix data by an interpolation algorithm according to a compression ratio. Due to the compression printing by the interpolation algorithm, the higher the print quality requirement, the higher the calculation accuracy requirement for the interpolation algorithm.
  • a main object of the present invention is to provide a print control method and a printer to solve the problem in the related art that it is difficult to achieve both paper saving and printing speed when performing compression printing.
  • a print control method includes: Step S1, obtaining a horizontal compression expression according to a lateral compression ratio, acquiring a row microstep number m according to a vertical compression ratio; Step S2, acquiring original lattice data; Step S3, performing a raw point according to a horizontal compression expression Each line of data of the array data is compressed to generate compressed dot matrix data; and in step S4, the motor prints a point of data in the compressed dot matrix data every m microsteps.
  • obtaining the horizontal compression expression according to the lateral compression ratio in step S1 includes: calculating a horizontal compression expression according to the lateral compression ratio, or obtaining a horizontal compression expression according to the horizontal compression ratio table, wherein the table stores the Correspondence between multiple lateral compression ratios and multiple transverse compression expressions.
  • P1 is the number of items of the fixed operation term in the horizontal compression expression
  • P2 is the number of items of the OR operation term in the horizontal compression expression
  • ! ⁇ represents the amount of data after compression
  • r represents the amount of original data.
  • the horizontal compression expression obtained according to the horizontal compression ratio lookup table includes: determining whether the horizontal compression ratio can be found in the table; when the horizontal compression ratio can be found in the table, the horizontal compression ratio corresponding to the horizontal compression ratio obtained by the table lookup is further compressed.
  • the expression is used as a horizontal compression expression; and when the horizontal compression ratio cannot be found in the table, the horizontal compression expression corresponding to the lateral compression ratio of the table is similar to the horizontal compression ratio as the horizontal compression expression corresponding to the lateral compression ratio .
  • step S3 includes: grouping each dot row data of the original dot matrix data by a data length of the horizontal compression expression to obtain a plurality of data groups; and compressing the plurality of data groups according to the horizontal compression expression, Generating multiple compressed data sets; combining multiple compressed data sets to generate one-line compressed data; and combining compressed data of all dot rows to generate compressed dot matrix data.
  • step S3 includes: partitioning each point row data in the original dot matrix data according to a type to obtain a plurality of data regions; and compressing the plurality of data regions according to the horizontal compression expression to generate a plurality of compressed data regions; Multiple compressed data regions are combined to generate compressed data for a single row; and compressed data for all dot rows is combined to generate compressed dot matrix data.
  • a printer includes: a first obtaining unit, configured to obtain a horizontal compression expression according to a lateral compression ratio, obtain a row microstep number m according to a vertical compression ratio; a second acquiring unit, obtain original lattice data; and generate a unit, according to horizontal compression expression
  • the method compresses each dot row data of the original dot matrix data to generate compressed dot matrix data; and a printing unit for printing a dot row data in the compressed dot matrix data every m microsteps of the motor.
  • the first obtaining unit obtains the horizontal compression expression according to the horizontal compression ratio lookup table, including: determining whether the horizontal compression ratio can be found in the table; and when the horizontal compression ratio can be found in the table, the horizontal compression ratio obtained by the table is obtained.
  • the corresponding horizontal compression expression is used as a horizontal compression expression; and when the horizontal compression ratio cannot be found in the table, the horizontal compression expression corresponding to the lateral compression ratio of the table is similar to the horizontal compression ratio as the horizontal compression ratio Horizontal compression expression.
  • the generating unit is configured to generate compressed dot matrix data according to the following manner: grouping each dot row data of the original dot matrix data by a data length of the horizontal compression expression to obtain a plurality of data groups; Compressing multiple data sets to generate multiple compressed data sets; combining multiple compressed data sets to generate one-line compressed data; and combining compressed data of all dot rows to generate compressed dot matrix data.
  • the generating unit is configured to generate compressed dot matrix data according to the following manner: partitioning each dot row data in the original dot matrix data by type to obtain a plurality of data regions; compressing the plurality of data regions according to the horizontal compression expression , generating a plurality of compressed data areas; combining a plurality of compressed data areas to generate compressed data of one line; and combining compressed data of all point lines to generate compressed dot matrix data.
  • a printer is provided.
  • the printer comprises: a stepping motor; a printing mechanism; and a controller, respectively connected to the stepping motor and the printing mechanism, configured to obtain a transverse compression expression according to a lateral compression ratio, and obtain a row microstep number m according to a longitudinal compression ratio; Raw dot matrix data; compresses each dot row data of the original dot matrix data according to the horizontal compression expression to generate compressed dot matrix data; and controls the printing mechanism to print a point in the compressed dot matrix data every m microsteps of the stepping motor Row data.
  • each dot row data of the original lattice data is compressed according to the transverse compression expression to generate compressed dot matrix data, And controlling the rotation of the motor in a micro-step manner, and printing each dot row data of the compressed dot matrix data in a row mode according to the microstep number, thereby solving the problem that the paper saving and the printing speed are difficult to be achieved in the related art in the compression printing.
  • the problem in turn, achieves the effect of speed and significant paper saving when performing compression printing.
  • FIG. 1 is a schematic diagram of a composition of a first embodiment of a printer according to the present invention
  • FIG. 2 is a flow chart of a printing control method according to a first embodiment of the present invention
  • FIG. 3 is a first embodiment of the present invention.
  • FIG. 4 is a flow chart of horizontally compressing a little line of data according to a second embodiment of the present invention
  • FIG. 4 is a flow chart for printing lateral line data according to a second embodiment of the present invention
  • FIG. FIG. 6 is a schematic diagram of a dot-line data compression process of horizontally compressed dot line data according to a print control method according to a first embodiment of the present invention
  • FIG. 7 is a print according to a second embodiment of the present invention.
  • FIG. 8 is a schematic diagram of the composition of a second embodiment of the printer according to the present invention.
  • DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. The invention will be described in detail below with reference to the drawings in conjunction with the embodiments.
  • 1 is a schematic diagram of the composition of a first embodiment of a printer according to the present invention.
  • the printer 30 includes a controller 31, a communication interface 32, a RAM memory 33, a FLASH memory 34, a motor driver 35, a stepper motor 36, and Printing mechanism 37.
  • the controller 31 controls each module to perform work.
  • the controller 31 controls the communication interface 32 to receive print data and a compression ratio setting command sent by a print requesting device (such as a computer or a network device), and the print data may be dot matrix print data. It can print data for characters including text codes and various typesetting instructions, and can also be print data defined by graphic instructions (referred to as graphic print data).
  • the compression ratio setting command is used to set the horizontal compression ratio and vertical direction of the printer.
  • the compression ratio when the print data is character print data or graphic print data, the controller 31 also converts the character print data and the graphic print data into dot matrix print data, and the controller 31 also controls the printing mechanism 37 to perform data printing on the medium, etc. .
  • the controller 31 includes a data compression unit 311 for compressing the original dot matrix print data in a bit manner according to the horizontal compression expression to generate compressed dot matrix data, which is a dot matrix print sent by the print requesting device to the printer.
  • the communication interface 32 receives the print data and the compression ratio setting command sent by the print requesting device, and stores the received print data and the compression ratio setting command in the RAM memory 33.
  • the commonly used communication interface is a USB interface, an Ethernet interface, or the like.
  • the RAM memory 33 includes a receive buffer 331 for holding print data received by the communication interface 32 and a compression ratio setting instruction, and a print buffer 332 for saving to be printed.
  • a FLASH memory (ie, a non-volatile memory) 34 configured to store a font database 341, the font database 341 includes an index data area and a font data area, wherein the index data area includes a data amount of the font data of the character (referred to as a data amount), The font address of the character in the font data area is stored in the font data area (referred to as the address offset).
  • the font data area stores the font data of each character.
  • the character code is first indexed according to the character.
  • the data amount of the font data of the character and its address offset in the font data area are obtained in the data area, and then the font data corresponding to the data amount is read in the font data area according to the address offset.
  • the text code 0x30 corresponds to the character "0”
  • the data amount and address offset of the character code 0x30 are searched in the index data area, such as the data amount is 6 (bytes) and the address offset is 0x1000, then the font data is A total of 6 bytes of data from the address 0x1000 0x1005 in the area is the font data of the character "0".
  • the FLASH memory 34 is also used to store a correspondence table between the preferred horizontal compression ratio and the preferred horizontal compression expression, such as a horizontal compression ratio of /r and a character font data of a WxH lattice, wherein, ! ⁇ represents the amount of data after compression, r represents the original amount of data, r is in units of bits, W represents the number of points in the width direction of the font data, and H represents the number of points in the height direction of the font data.
  • the lateral compression ratio is a preferred lateral compression ratio.
  • lateral compression ratios such as lateral compression ratios 2/3, 3/4, 5/6, 7/12, etc.
  • transverse compression expressions are polynomials, including two kinds of operation items, respectively fixed An operation term and an OR operation term, wherein the fixed operation term indicates that the bit corresponding to the operation term is unchanged, and the OR operation term indicates that the adjacent two-bit data corresponding to the operation item is ORed, such as horizontal
  • the compression expression is 1 ⁇ +13 ⁇ 4
  • the number of data bits in the horizontal compression expression that is, the number of bits, which is the data length of the horizontal compression expression, usually expressed as L.
  • the horizontal compression expression is 1 ⁇ +13 ⁇ 4
  • 13 ⁇ 4, then 1 ⁇ to 13 ⁇ 4 a total of 3 bits of data to perform the operation, that is, the horizontal compression expression data length L 3, and for example, the horizontal compression expression is bi + + bs + + bslbs, then!
  • the motor driver 35 is configured to supply a driving current to the stepping motor 36 to rotate the stepping motor.
  • the driving method of the stepping motor includes a full step mode and a micro step mode, wherein the full step mode is the initial step of the motor according to the initial step
  • the working mode when the rotation is performed the micro step method is the working mode when the motor rotates according to the microstep length, wherein the initial step length is the motor step length when the longitudinal compression is not performed, and the micro step size is to divide the initial step size equally.
  • the motor step size after n equal parts, that is, the micro step size is l/n of the initial step size.
  • the motor step angle (abbreviated as the initial step angle) of the initial step is equally divided, such as 2 equal parts. It is further divided into equal parts on the basis of two equal parts.
  • n is preferably a multiple of two, that is, a multiple of two squares of the initial step angle.
  • the stepping motor 36 is used for driving the movement of the medium.
  • the moving distance of the motor is dl for each microstep medium.
  • the printing mechanism 37 includes a printhead for printing the converted compressed dot matrix data on a medium to generate text and images on the medium.
  • the print head is a line print head, which prints a line of data at a time.
  • the commonly used line print head is a thermal print head, which includes a plurality of heat generating units, and a plurality of heat generating units are arranged equidistantly in a row, a heat generating unit and a dot row data.
  • One point of data (ie, 1 bit) corresponds.
  • the point data is the first setting data, such as "1”
  • the corresponding heat generating unit generates heat, thereby forming a dot on the printing medium
  • the point data is the second setting.
  • data such as "0”
  • its corresponding heat-generating unit does not heat up, and there is no printout on the print medium.
  • the embodiment of the present invention further provides a print control method.
  • the print control method of the embodiment of the present invention can be executed by the controller 31 in the printer of the embodiment of the present invention, or used to control the printer of the embodiment of the present invention.
  • the printer of the embodiment of the present invention can also be used in the print control method of the embodiment of the present invention.
  • 2 is a flowchart of a printing control method according to an embodiment of the present invention.
  • the specific processing procedure is as follows: Step S1, obtaining a horizontal compression expression according to a lateral compression ratio, and obtaining a microstep number m according to a vertical compression ratio
  • the controller 31 analyzes the compression ratio setting command stored in the reception buffer 331 to obtain a lateral compression ratio!
  • the horizontal compression expression can be obtained by operation, or the horizontal compression expression can be obtained by looking up the table.
  • the process of obtaining the horizontal compression expression by the operation according to the lateral compression ratio iVr is as follows: The number of items of the fixed operation term and the OR operation term in the horizontal compression expression is calculated according to the following Expression 1 and Expression 2.
  • the process of obtaining the horizontal compression expression by looking up the table according to the lateral compression ratio iVr is as follows: According to the lateral compression ratio / the correspondence table of the preferred lateral compression ratio and the preferred lateral compression expression stored in the FLASH memory 34, the table is looked up, Preferably, the lateral compression ratio "in the column finds a preferred lateral compression expression corresponding to the lateral compression ratio iVr.
  • Table 1 Find the 5/6 item in the "Preferred Lateral Compression Ratio” column in Table 1, which is located on the third line, and the expression corresponding to the "Preferred Horizontal Compression Expression” column in the third line: bi+ +bs+ +bslbs is the horizontal compression expression to look for.
  • the items close to the value of 7/10 are found.
  • any one of them may be selected; preferably, a preferred lateral compression ratio with a smaller value is selected, such as 2/3 is selected, so that a lateral compression ratio of 7/10 can be obtained.
  • the horizontal compression expression is 1 ⁇ +1) 2
  • the controller 31 parses the compression ratio setting command stored in the receiving buffer 331 to obtain a vertical compression ratio of 3 1 /3, where Sl and s are positive integers, and s> S1 , for example, the original printing length is 80 mm.
  • the lateral compression ratio is usually equal to the vertical compression ratio.
  • the integer processing of m is required to be an integer; preferably, m is the rounded value.
  • m is equal to 5, that is, the longitudinal compression ratio is changed from 7/10 of a larger value.
  • the original dot matrix data controller 31 processes the print data stored in the receive buffer 331.
  • the received print data is dot matrix print data
  • the received dot matrix print data is the original dot matrix data.
  • the data amount and the address offset of the font data of the character are queried in the index data area of the font database 341 according to the character code of the character, according to the address offset in the font database.
  • Step S3 compressing each dot row data of the original dot matrix data according to the horizontal compression expression, and generating a compressed dot matrix data controller 31 according to the printing order of the original dot matrix data, as shown in FIG.
  • the first dot row data 64 of the original dot matrix print data 60 is first compressed to generate first dot row compressed data 84, and then the second dot row data is compressed to generate a second dot row compression.
  • the data is processed in sequence until the i-th (i is equal to 24 in FIG. 5) dot row data is compressed into the i-th row row compressed data, and then the first dot row compressed data, the second dot row compressed data, ..., the 24th are generated.
  • the compressed dot matrix data 80 composed of compressed data is dot-lined, and the generated compressed dot matrix data is stored in the print buffer 332 of the RAM memory 33.
  • the motor rotates m microsteps, prints a little line of data in the compressed dot matrix data to control the motor rotation in a microstep manner, and the motor prints a little line of compressed data every m microsteps.
  • the first dot row compressed data, the second dot row compressed data, the third dot row compressed data, ... of the compressed dot matrix data are sequentially printed, until the last point of the compressed dot matrix data is printed, and the data is compressed due to
  • the number of microsteps of the initial step of the motor is n, so the print height of each dot row data is m/n when the stepper motor works in full step mode.
  • Step S311 grouping a bit of row data of the original dot matrix data by the original dot matrix data
  • the dot row data is composed, and each row of data is composed of a plurality of dot data, and each point of data corresponds to one bit of data.
  • the point data in the one-line data of the original dot matrix data (referred to as the original dot row data) is grouped according to the data length L of the horizontal compression expression.
  • the point data of the original point row data is grouped by the data length L of the horizontal compression expression, and is divided into N/L data groups, where N is the original point.
  • the original dot row data 95 shown is grouped. Since the horizontal compression expression is 1 ⁇ +13 ⁇ 4
  • the first data group and the second data group are performed according to the horizontal compression expression bi+ lbs.
  • the fourth data group is compressed, and respectively generates a first compressed data group, a second compressed data group, ..., a fourth compressed data group as shown in (c) of FIG. 6, as shown in (b) of FIG.
  • the first data group is "110", and is compressed by the horizontal compression expression bi+b 2
  • the "perform” or “calculation” yields a one-bit "1", and the first data set "110" is compressed into the first compressed data set "11" as shown in (c) of FIG.
  • Step S313 combining the compressed data groups, generating the point row compressed data according to the grouping order of the original point row data, combining the compressed data groups, and generating the point row compressed data, as shown in FIG. 6(c),
  • a compressed data set, a second compressed data set, ..., a fourth compressed data set are combined to generate dot-line compressed data 96 as shown in (d) of FIG. 6, and thus, 95 of FIG. 6(a) is used.
  • the original dot line data "110110011000" is compressed to the dot line compressed data "11110100" as shown by 96 in Fig. 6(d).
  • 4 is a flow chart of laterally compressing a bit of row data according to a second embodiment of the present invention.
  • Step S321 Partitioning a row of data in the original dot matrix data according to type, and obtaining a plurality of data regions
  • the point data in the point data of the original dot matrix data is classified according to the data attribute, such as the point data generated by the font data of the character is a character class, the point data generated by the graphic command is a graphic class, ...,
  • the dot data formed by the character interval is an interval class or the like.
  • the dot data of the original dot row data 67 shown in FIG. 7(a) is divided into two types of data, which are character class data 91, respectively. And interval class data 92.
  • each data area can only include one Type of data
  • each character class data area may include point data generated by dot matrix data of one character, or dot data generated by dot matrix data composed of a plurality of consecutive characters
  • each The graphics class data area can include
  • a graphic dot matrix data may also include dot matrix data composed of a plurality of consecutive graphics.
  • the original dot row data 67 is divided into eight data regions, which are respectively a first data region, and a first data region.
  • Step S322 compressing each data area according to the horizontal compression expression, and generating a corresponding compressed data area according to the horizontal compression expression, to the first data area, the second data area, ..., shown in FIG. 7(c)
  • the eighth data area is compressed to generate a first compressed data area, a second compressed data area, and an eighth compressed data area as shown in FIG. 7(d), respectively.
  • Step S323 combining the compressed data regions, generating the point row compressed data according to the partition order of the original dot row data, combining the compressed data regions, and generating the dot row compressed data, as shown in FIG. 7(d), for the first compression
  • the data area, the second compressed data area, ..., the eighth compressed data area are combined to generate the dot line compressed data 87 as shown in Fig. 7(e), and thus the original shown in Fig. 7(a) 67 is obtained.
  • the dot row data is compressed into the dot row compressed data shown in 87 of Fig. 7(e).
  • the mutual interference between different types of data during horizontal compression is reduced, and the integrity of each type of data is maintained, thereby improving the horizontal compression printing effect.
  • the embodiment of the present invention further provides a printer.
  • the printer includes a first obtaining unit 301, a second obtaining unit 302, a generating unit 303, and a printing unit 304.
  • the first obtaining unit 301 is configured to obtain a horizontal compression expression according to the lateral compression ratio, and acquire the row microstep number m according to the vertical compression ratio.
  • the first obtaining unit 301 can be implemented by the controller 31 and the communication interface 32 described above.
  • the second acquisition unit 302 acquires the original lattice data.
  • the second obtaining unit 302 can be implemented by the communication interface 32 described above, or by the communication interface 32 that is separately provided, or converted by the controller 31 to the character print data acquired by the printer.
  • the generating unit 303 compresses each dot row data of the original dot matrix data according to the horizontal compression expression to generate compressed dot matrix data.
  • the generating unit 303 can also be implemented by the controller 31 described above.
  • the printing unit 304 is configured to print a little line of data in the compressed dot matrix data every m microsteps of the motor.
  • the printing unit 304 can be realized by the controller 31, the stepping motor 36, and the printing mechanism 37 described above. It should be noted that the print control method of the embodiment of the present invention may be performed by, but not limited to, the printer provided by the embodiment of the present invention.
  • the printer of the embodiment of the present invention may be used to execute the print control method provided by the embodiment of the present invention. .
  • the printer of the embodiment of the present invention can be used in conjunction with the print control method provided by the embodiment of the present invention, and thus can also be used to perform the preferred print control method of the embodiment of the present invention.
  • the first acquisition unit is no longer used. 301.
  • the second acquisition unit 302, the generation unit 303, and the printing unit 304 perform a more preferable description.
  • the print control method or printer provided by the embodiment of the present invention obtains a horizontal compression expression according to a lateral compression ratio, wherein the horizontal compression expression includes a fixed operation term and an OR operation term, and the row microstep number is obtained according to the vertical compression ratio, and the horizontal direction is used.
  • the compression expression laterally compresses the dot line data and then prints, reducing the width of the character line, thereby reducing the width of the used medium; controlling the paper feeding motor to perform dot line data printing in a microstep manner according to the number of microsteps of the line, thereby Longitudinal compression of print data reduces the length of media used. Since the horizontal compression expression includes a fixed operation item and an "or" operation item, the shape of the text font is preserved by the fixed operation item, the influence of the horizontal compression on the text font is reduced, and the horizontal data is effectively reduced by the "or" operation item.
  • the volume is compressed to realize the horizontal compression of the print data, and the motor movement is controlled in a micro-step manner to realize the longitudinal compression of the print data, and the print data is not required to be compressed in the longitudinal direction, thereby ensuring the print quality of the text and the like in the vertical direction. Therefore, the compressed printing effect of the original print data in the horizontal and vertical directions can be realized by a simple operation. According to the print control method provided by the embodiment of the present invention, since the amount of processing of the compressed data is small, the printing speed of the printer is not affected in the case of ensuring the print quality.
  • the point data in the point row data is partitioned and compressed according to the type of the point data, thereby ensuring the compression consistency of different types of data, eliminating the mutual influence on the continuous compression of different types of point data, and ensuring the text. , image, etc. integrity.

Abstract

Disclosed is a printing control method. The printing control method comprises: S1, acquiring a lateral compression expression according to the lateral compression ratio, and acquiring the number m of microsteps in a line according to the longitudinal compression ratio; S2, acquiring original dot matrix data; S3, compressing each dot-line data of the original dot matrix data according to the lateral compression expression to generate compressed dot matrix data; S4, each time a motor moves m microsteps, the motor prints a dot-line data of the compressed dot matrix data. Also disclosed is a printer using the above printing control method, providing fast printing speed and saving paper during compressed printing.

Description

打印控制方法及打印机  Print control method and printer
本申请要求 2012 年 6 月 29 日提交至中国知识产权局的, 申请号为 201210222146.1 , 名称为 "打印控制方法及打印机" 的中国发明专利申请的优先权, 其全部公开内容结合于此作为参考。 技术领域 本发明涉及打印领域, 具体而言, 涉及一种打印控制方法及打印机。 背景技术 传统的打印系统通常采用两种数据处理方式进行打印, 第一种数据处理方式为打 印信息生成设备 (如计算机) 生成点阵数据发送给打印机, 由打印机直接打印点阵打 印数据; 第二种数据处理方式为由打印信息生成设备生成包括文字代码和各种排版指 令在内的字符打印数据发送给打印机, 打印机根据排版指令, 如行间距、 字符间距等 对字符打印数据进行排版, 按照文字代码查找保存在打印机非易失性存储器内的与文 字代码对应的字符的点阵数据从而把字符打印数据转换成点阵打印数据。 近年来, 随着节约环保意识的提高, 用户要求打印机具有省纸功能, 从而减少打 印介质的消耗量。 比如, 减小打印介质的宽度, 如把宽度为 80mm的打印介质替换为 宽度为 56mm的打印介质,或者缩短打印介质的使用长度,如把原始打印长度为 150mm 打印数据打印在 100mm长的打印介质上,或者同时减小打印介质的宽度和长度,如把 原始打印宽度为 80mm、 打印长度为 150mm的打印数据打印在实际宽度为 56mm、 长 度为 100mm的打印介质上。 为了实现上述目的, 相关技术提供了一种打印控制方法, 根据压缩比例, 利用插 值算法对原始点阵数据进行处理后打印。 由于通过插值算法进行压缩打印, 对打印质 量要求越高, 则对插值算法的计算精度要求就越高。但是, 插值算法的计算精度越高, 数据处理计算量越大, 造成数据处理速度缓慢, 从而影响打印速度。 为了实现上述目的, 相关技术提供了一种打印控制方法, 通过压缩字符的行间距 或者字符的字间距节省打印纸。 但是, 该方法能够节约利用的长度和宽度有限, 无法 达到预期的省纸要求。 针对相关技术中在进行压缩打印时难以兼顾省纸和打印速度的问题, 目前尚未提 出有效的解决方案。 发明内容 本发明的主要目的在于提供一种打印控制方法及打印机, 以解决相关技术中在进 行压缩打印时难以兼顾省纸和打印速度的问题。 为了实现上述目的, 根据本发明的一个方面, 提供了一种打印控制方法。 该打印 控制方法包括: 步骤 Sl, 根据横向压缩比获取横向压缩表达式, 根据纵向压缩比获取 行微步数 m; 步骤 S2, 获取原始点阵数据; 步骤 S3, 按照横向压缩表达式对原始点 阵数据的每一点行数据进行压缩,生成压缩点阵数据;以及步骤 S4,电机每走 m微步, 打印压缩点阵数据中的一点行数据。 进一步地,步骤 S1中的根据横向压缩比获取横向压缩表达式包括:根据横向压缩 比计算得到横向压缩表达式, 或者, 根据横向压缩比查表得到横向压缩表达式, 其中, 在表中存储有多个横向压缩比与多个横向压缩表达式的对应关系。 进一步地, 根据横向压缩比运算得到横向压缩表达式包括根据以下公式计算横向 压缩表达式中固定运算项和 "或"运算项的项数: pi + 2*p2 = r
Figure imgf000004_0001
其中, Pl为横向压缩表达式中固定运算项的项数, P2为横向压缩表达式中 "或"运 算项的项数, !^表示压缩后的数据量, r表示原始的数据量。 进一步地, 根据横向压缩比查表得到横向压缩表达式包括: 判断表中是否能够查 找到横向压缩比; 当表中能够查找到横向压缩比时, 将查表得到的横向压缩比对应的 横向压缩表达式作为横向压缩表达式; 以及当表中无法查找到横向压缩比时, 将表中 与横向压缩比的数值相近的横向压缩比对应的横向压缩表达式作为横向压缩比对应的 横向压缩表达式。 进一步地,步骤 S3包括: 以横向压缩表达式的数据长度为单位对原始点阵数据的 每一点行数据进行分组, 得到多个数据组; 按照横向压缩表达式, 对多个数据组进行 压缩, 生成多个压缩数据组; 对多个压缩数据组进行组合, 生成一点行的压缩数据; 以及对所有点行的压缩数据进行组合, 生成压缩点阵数据。 进一步地, 步骤 S3包括: 对原始点阵数据中每一点行数据按照类型分区, 得到多 个数据区; 按照横向压缩表达式, 分别对多个数据区进行压缩, 生成多个压缩数据区; 对多个压缩数据区进行组合, 生成一点行的压缩数据; 以及对所有点行的压缩数据进 行组合, 生成压缩点阵数据。 为了实现上述目的, 根据本发明的另一方面, 提供了一种打印机。该打印机包括: 第一获取单元, 用于根据横向压缩比获取横向压缩表达式, 根据纵向压缩比获取行微 步数 m; 第二获取单元, 获取原始点阵数据; 生成单元, 按照横向压缩表达式对原始 点阵数据的每一点行数据进行压缩, 生成压缩点阵数据; 以及打印单元, 用于在电机 每走 m微步, 打印压缩点阵数据中的一点行数据。 进一步地, 第一获取单元用于通过以下方式获取横向压缩表达式: 根据横向压缩 比计算得到横向压缩表达式, 或者, 根据横向压缩比查表得到横向压缩表达式, 其中, 在表中存储有多个横向压缩比与多个横向压缩表达式的对应关系。 进一步地, 第一获取单元还用于根据以下表达式计算横向压缩表达式中固定运算 项和"或"运算项的项数: pi + 2*p2 = r
This application claims the priority of the Chinese Patent Application Serial No. 201210222146.1, entitled "Print Control Method and Printer", filed on June 29, 2012, the entire disclosure of which is hereby incorporated by reference. TECHNICAL FIELD The present invention relates to the field of printing, and in particular to a print control method and a printer. BACKGROUND OF THE INVENTION A conventional printing system generally uses two data processing methods for printing. The first data processing method is that a print information generating device (such as a computer) generates dot matrix data and sends it to a printer, and the dot matrix print data is directly printed by the printer; The data processing method is that the print information generating device generates character print data including a text code and various typesetting instructions, and sends the character print data to the printer according to the typesetting instruction, such as line spacing, character spacing, etc., according to the text. The code looks up the dot matrix data of the character corresponding to the text code stored in the non-volatile memory of the printer to convert the character print data into dot matrix print data. In recent years, with the increase in environmental awareness, users have demanded that printers have a paper saving function, thereby reducing the consumption of printing media. For example, reduce the width of the print medium, such as replacing the print medium with a width of 80 mm with a print medium with a width of 56 mm, or shorten the length of the print medium, such as printing the original print length of 150 mm on 100 mm long print media. The printing medium having the original printing width of 80 mm and the printing length of 150 mm is printed on a printing medium having an actual width of 56 mm and a length of 100 mm. In order to achieve the above object, the related art provides a print control method for processing original dot matrix data by an interpolation algorithm according to a compression ratio. Due to the compression printing by the interpolation algorithm, the higher the print quality requirement, the higher the calculation accuracy requirement for the interpolation algorithm. However, the higher the calculation accuracy of the interpolation algorithm, the larger the amount of data processing calculation, resulting in slow data processing speed, which affects the printing speed. In order to achieve the above object, the related art provides a print control method for saving printing paper by compressing the line pitch of characters or the word pitch of characters. However, this method is limited in the length and width of the available use and does not meet the expected paper saving requirements. In view of the problem that it is difficult to balance paper saving and printing speed in compression printing in the related art, an effective solution has not been proposed yet. SUMMARY OF THE INVENTION A main object of the present invention is to provide a print control method and a printer to solve the problem in the related art that it is difficult to achieve both paper saving and printing speed when performing compression printing. In order to achieve the above object, according to an aspect of the present invention, a print control method is provided. The printing control method includes: Step S1, obtaining a horizontal compression expression according to a lateral compression ratio, acquiring a row microstep number m according to a vertical compression ratio; Step S2, acquiring original lattice data; Step S3, performing a raw point according to a horizontal compression expression Each line of data of the array data is compressed to generate compressed dot matrix data; and in step S4, the motor prints a point of data in the compressed dot matrix data every m microsteps. Further, obtaining the horizontal compression expression according to the lateral compression ratio in step S1 includes: calculating a horizontal compression expression according to the lateral compression ratio, or obtaining a horizontal compression expression according to the horizontal compression ratio table, wherein the table stores the Correspondence between multiple lateral compression ratios and multiple transverse compression expressions. Further, obtaining the lateral compression expression according to the lateral compression ratio operation includes calculating the number of the fixed operation term and the OR operation term in the horizontal compression expression according to the following formula: pi + 2*p 2 = r
Figure imgf000004_0001
Where P1 is the number of items of the fixed operation term in the horizontal compression expression, and P2 is the number of items of the OR operation term in the horizontal compression expression, ! ^ represents the amount of data after compression, and r represents the amount of original data. Further, the horizontal compression expression obtained according to the horizontal compression ratio lookup table includes: determining whether the horizontal compression ratio can be found in the table; when the horizontal compression ratio can be found in the table, the horizontal compression ratio corresponding to the horizontal compression ratio obtained by the table lookup is further compressed. The expression is used as a horizontal compression expression; and when the horizontal compression ratio cannot be found in the table, the horizontal compression expression corresponding to the lateral compression ratio of the table is similar to the horizontal compression ratio as the horizontal compression expression corresponding to the lateral compression ratio . Further, step S3 includes: grouping each dot row data of the original dot matrix data by a data length of the horizontal compression expression to obtain a plurality of data groups; and compressing the plurality of data groups according to the horizontal compression expression, Generating multiple compressed data sets; combining multiple compressed data sets to generate one-line compressed data; and combining compressed data of all dot rows to generate compressed dot matrix data. Further, step S3 includes: partitioning each point row data in the original dot matrix data according to a type to obtain a plurality of data regions; and compressing the plurality of data regions according to the horizontal compression expression to generate a plurality of compressed data regions; Multiple compressed data regions are combined to generate compressed data for a single row; and compressed data for all dot rows is combined to generate compressed dot matrix data. In order to achieve the above object, according to another aspect of the present invention, a printer is provided. The printer includes: a first obtaining unit, configured to obtain a horizontal compression expression according to a lateral compression ratio, obtain a row microstep number m according to a vertical compression ratio; a second acquiring unit, obtain original lattice data; and generate a unit, according to horizontal compression expression The method compresses each dot row data of the original dot matrix data to generate compressed dot matrix data; and a printing unit for printing a dot row data in the compressed dot matrix data every m microsteps of the motor. Further, the first obtaining unit is configured to obtain a horizontal compression expression by: calculating a horizontal compression expression according to the lateral compression ratio, or obtaining a horizontal compression expression according to the horizontal compression ratio table, where the table stores Correspondence between multiple lateral compression ratios and multiple transverse compression expressions. Further, the first obtaining unit is further configured to calculate the number of items of the fixed operation item and the OR operation item in the horizontal compression expression according to the following expression: pi + 2*p 2 = r
Figure imgf000005_0001
其中, Pl为横向压缩表达式中固定运算项的项数, P2为横向压缩表达式中 "或"运 算项的项数, !^表示压缩后的数据量, r表示原始的数据量。 进一步地, 第一获取单元根据横向压缩比查表得到横向压缩表达式包括: 判断表 中是否能够查找到横向压缩比; 当表中能够查找到横向压缩比时, 将查表得到的横向 压缩比对应的横向压缩表达式作为横向压缩表达式; 以及当表中无法查找到横向压缩 比时, 将表中与横向压缩比的数值相近的横向压缩比对应的横向压缩表达式作为横向 压缩比对应的横向压缩表达式。 进一步地, 生成单元用于按照以下方式生成压缩点阵数据: 以横向压缩表达式的 数据长度为单位对原始点阵数据的每一点行数据进行分组, 得到多个数据组; 按照横 向压缩表达式, 对多个数据组进行压缩, 生成多个压缩数据组; 对多个压缩数据组进 行组合, 生成一点行的压缩数据; 以及对所有点行的压缩数据进行组合, 生成压缩点 阵数据。 进一步地, 生成单元用于按照以下方式生成压缩点阵数据: 对原始点阵数据中每 一点行数据按照类型分区, 得到多个数据区; 按照横向压缩表达式, 分别对多个数据 区进行压缩, 生成多个压缩数据区; 对多个压缩数据区进行组合, 生成一点行的压缩 数据; 以及对所有点行的压缩数据进行组合, 生成压缩点阵数据。 为了实现上述目的, 根据本发明的另一方面, 提供了一种打印机。该打印机包括: 步进电机; 打印机构; 以及控制器, 与步进电机和打印机构分别相连接, 用于根据横 向压缩比获取横向压缩表达式,根据纵向压缩比获取行微步数 m; 获取原始点阵数据; 按照横向压缩表达式对原始点阵数据的每一点行数据进行压缩, 生成压缩点阵数据; 以及步进电机每走 m微步, 控制打印机构打印压缩点阵数据中的一点行数据。 通过本发明的打印控制方法或者打印机,由于先获取横向压缩表达式和行微步数, 然后按照所述横向压缩表达式对原始点阵数据的每一点行数据进行压缩, 生成压缩点 阵数据, 以及以微步长方式控制电机旋转, 并根据行微步数以行模式打印所述压缩点 阵数据的每一点行数据, 解决了相关技术中在进行压缩打印时难以兼顾省纸和打印速 度的问题, 进而达到了使得在进行压缩打印时, 既速度快、 又显著省纸的效果。 附图说明 构成本申请的一部分的附图用来提供对本发明的进一步理解, 本发明的示意性实 施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在附图中: 图 1是根据本发明的打印机的第一实施例的组成示意图; 图 2是根据本发明第一实施例的打印控制方法的流程图; 图 3是根据本发明第一实施例的打印控制方法的横向压缩一点行数据的流程图; 图 4是根据本发明第二实施例的打印控制方法的横向压缩一点行数据的流程图; 图 5是根据本发明一实施例的打印控制方法的点阵数据横向压缩过程示意图; 图 6是根据本发明第一实施例的打印控制方法的横向压缩点行数据的点行数据压 缩过程示意图; 图 7是根据本发明第二实施例的打印控制方法的横向压缩点行数据的点行数据压 缩过程示意图; 以及 图 8是根据本发明的打印机的第二实施例的组成示意图。 具体实施方式 需要说明的是, 在不冲突的情况下, 本申请中的实施例及实施例中的特征可以相 互组合。 下面将参考附图并结合实施例来详细说明本发明。 图 1 是根据本发明的打印机的第一实施例的组成示意图, 如图所示, 打印机 30 包括控制器 31、 通信接口 32、 RAM存储器 33、 FLASH存储器 34、 电机驱动器 35、 步进电机 36和打印机构 37。 控制器 31控制各模块执行工作, 比如, 控制器 31控制 通信接口 32接收打印请求装置(如计算机或网络设备)发送的打印数据和压缩比设定 指令, 打印数据可以为点阵打印数据, 也可以为包括文字代码和各种排版指令在内的 字符打印数据, 还可以为由图形指令定义的打印数据(简称图形打印数据), 压缩比设 定指令用于设定打印机的横向压缩比和纵向压缩比, 当打印数据为字符打印数据或图 形打印数据时,控制器 31还把字符打印数据和图形打印数据转换为点阵打印数据,控 制器 31还控制打印机构 37在介质上进行数据打印等。 控制器 31包括数据压缩单元 311, 用于根据横向压缩表达式以比特方式对原始点阵打印数据进行压缩, 生成压缩点 阵数据, 原始点阵打印数据是打印请求装置发送给打印机的点阵打印数据或由打印请 求装置发送给打印机的字符打印数据转换成的点阵打印数据。 通信接口 32, 接收打印 请求装置发送的打印数据和压缩比设定指令, 并把接收的打印数据和压缩比设定指令 保存在 RAM存储器 33中, 常用的通信接口为 USB接口、 以太网接口等。 RAM存储 器 33, 包括接收缓冲区 331和打印缓冲区 332, 其中, 接收缓冲区 331用于保存通信 接口 32所接收的打印数据和压缩比设定指令,打印缓冲区 332用于保存要发送到打印 机构 37的压缩点阵数据。 FLASH存储器 (即非易失性存储器) 34, 用于保存字体数 据库 341, 字体数据库 341包括索引数据区和字体数据区, 其中, 索引数据区包括字 符的字体数据的数据量(简称数据量)、字符的字体数据在字体数据区中的存储地址偏 移量 (简称地址偏移量) 等, 字体数据区存储有各个字符的字体数据, 获取字符的字 体数据时, 首先根据字符的文字代码在索引数据区中获取该字符的字体数据的数据量 及其在字体数据区中的地址偏移量, 然后根据地址偏移量在字体数据区中读取与该数 据量对应的字体数据。 比如, 文字代码 0x30对应字符 "0", 在索引数据区中查找文字 代码 0x30的数据量和地址偏移量, 如数据量为 6 (字节)、 地址偏移量为 0x1000, 则 在字体数据区中从地址 0x1000 0x1005共 6字节的数据为字符 "0"的字体数据。 FLASH 存储器 34还用于保存优选横向压缩比与优选横向压缩表达式的对应关系表,如横向压 缩比为 /r、 字符字体数据为 WxH点阵, 其中, !^表示压缩后的数据量, r表示原始 的数据量, 、 r的单位为比特, W表示字体数据宽度方向的点数, H表示字体数据高 度方向的点数。 当 r为 W的约数时的横向压缩比为优选横向压缩比, 如字符的字体数 据为 12x24点阵, 即 W=12, 则当 r为 12的约数, 如 r=3、 4、 6或 12时的横向压缩比 均为优选横向压缩比, 如横向压缩比 2/3、 3/4、 5/6、 7/12等均为优选横向压缩比; 横 向压缩表达式为多项式, 包括两种运算项, 分别是固定运算项和 "或"运算项, 其中, 固定运算项表示与该运算项对应的比特不变, "或"运算项表示与该运算项对应的相邻 两比特数据进行"或"运算, 如横向压缩表达式为 1^+1¾|1¾, 其中, bi、 b2、 b3为按顺序 排列的比特数据, 则!^为固定运算项, 即第一比特数据不变, b2|b3为 "或"运算项, "|"表示"或"运算符, 即第二比特数据和第三比特数据进行"或"运算, 横向压缩表达式 中的进行运算的数据位的数量, 即比特数, 为横向压缩表达式的数据长度, 通常以 L 表示, 如横向压缩表达式为 1^+1¾|1¾, 则对 1^至1¾共 3位数据进行运算, 即该横向压 缩表达式的数据长度 L=3, 再比如, 横向压缩表达式为 bi+ +bs+ +bslbs, 则对!^至 b6共 6位数据进行运算, 因此该横向压缩表达式的数据长度 L=6, 与优选横向压缩比 对应的横向压缩表达式为优选横向压缩表达式,如优选横向压缩比为 2/3,则与优选横 向压缩比 2/3对应的横向压缩表达式 bi+b2|b3为优选横向压缩表达式。 电机驱动器 35, 用于给步进电机 36提供驱动电流以使步进电机旋转,步进电机的驱动方式包括全步长 方式和微步长方式, 其中, 全步长方式为电机按照初始步长进行转动时的工作方式, 微步长方式为电机按照微步长进行转动时的工作方式, 其中, 初始步长是未进行纵向 压缩时的电机步长, 微步长是把初始步长均分为 n等份之后的电机步长, 也就是微步 长是初始步长的 l/n, 通常对初始步长的电机步进角 (简称初始步进角)进行等分, 如 2等分, 在 2等分基础上再进行等分等, 因此, 优选地, n为 2的多次方, 即对初始步 进角进行 2的多次方等分。 步进电机 36, 用于驱动介质运动, 设步进电机以微步长方 式工作时电机每走一个微步介质移动距离为 dl, 步进电机以全步长方式工作时电机每 走一步介质移动距离为 d2, 则 dl=d2/n。 打印机构 37包括打印头, 打印头用于把转换 后的压缩点阵数据打印在介质上, 从而在介质上生成文字和图像。 打印头为行式打印 头, 一次打印一点行数据, 常用的行式打印头为热打印头, 包括多个发热单元, 多个 发热单元等距排列成一行, 一个发热单元与点行数据中的一点数据 (即 1 比特) 相对 应, 当点数据为第一设定数据时, 如 "1", 其对应的发热单元发热, 从而在打印介质上 形成一个点, 当点数据为第二设定数据时, 如" 0", 其对应的发热单元不发热, 在打印 介质上没有打印输出。 本发明实施例还提供了一种打印控制方法, 本发明实施例的打印控制方法可以通 过本发明实施例的打印机中的控制器 31 来执行, 或者用于控制本发明实施例的打印 机。 本发明实施例的打印机也可以用于本发明实施例的打印控制方法。 图 2是根据本发明实施例的打印控制方法的流程图, 具体处理过程如下: 步骤 Sl, 根据横向压缩比获取横向压缩表达式, 根据纵向压缩比获取行微步数 m 控制器 31对保存在接收缓冲区 331中的压缩比设定指令进行解析,得到横向压缩 比!^ , 其中, 、 r均为正整数, 并且 r> >r/2, 如原始打印宽度为 80mm, 压缩后打 印宽度为 56 mm, 则横向压缩比 ri/r=7/10 (即 56/80)。 得到横向压缩比 iVr后, 可以通过运算得到横向压缩表达式, 也可以通过查表得 到横向压缩表达式。 其中, 根据横向压缩比 iVr通过运算得到横向压缩表达式的过程 如下: 根据下面的表达式一和表达式二计算横向压缩表达式中固定运算项和 "或"运算 项的项数。 pi + 2*p2 = r (表达式一) pi + P2 = Γι (表达式二) 通过对以上两个等式进行处理, 得到: pi Z - r; p2 = r - ri。 其中, Pl为横向压缩表达式中固定运算项的项数, p2为横向压缩表达式中 "或" 运算项的项数。 如把使用的打印介质从 80mm宽变为 56mm宽, 即打印宽度由原始打印宽度 80 变为压缩后的打印宽度 56, 则横向压缩比 ri/r=7/10 (即 56/80), 也就是需要在横向上 把原始数据中的 10个点压缩为 7个点; 根据表达式一和表达式二, 计算得到 1=4, p2=3 , 即横向压缩表达式中固定运算项的项数为 4、 "或"运算项的项数为 3, 对应原始 数据 bl至 bl0, 其横向压缩表达式可以是
Figure imgf000009_0001
其中, bi、 b2、 b3、 b4为固定运算项, b5|b6、 b7|b8、 b9|bio为"或"运算项; 优选地, 横向压缩表达 式中的固定运算项和 "或"运算项相间隔, 并且均匀分布, 则得到优化的横向压缩表 达式, 如!^+!^!^+!^+!^!^+!^+!^!^+!^。, 其中, !^、 b4、 b7、 b1()为固定运算项, b2|b3、 b5|b6、 b8|b9为"或"运算项。 根据横向压缩比 iVr通过查表得到横向压缩表达式的过程如下: 根据横向压缩比 / 对保存在 FLASH存储器 34中的优选横向压缩比与优选横 向压缩表达式的对应关系表进行查表, 在 "优选横向压缩比"列中查找与横向压缩比 iVr相对应的优选横向压缩表达式。 表 1为 W=12 (字符的点阵数据为 12 X 24) 时的优选横向压缩比和优选横向压缩 表示式的对应关系表, 下面以横向压缩比为 5/6和 7/10分别为例说明查表过程。
Figure imgf000010_0001
表 1 在表 1中的 "优选横向压缩比"列中查找到 5/6项, 其位于第三行, 则在第三行 中 "优选横向压缩表达式"列对应的表达式: bi+ +bs+ +bslbs就是要查找的横向压 缩表达式。 在表 1中的 "优选横向压缩比"列中查找到 7/10项时, 在 "优选横向压缩比"列 中未查找到 7/10项, 则查找与 7/10的数值相近的项, 如项 2/3和项 3/4, 可以选择其 中的任意一项; 优选地, 选择数值更小的优选横向压缩比, 如选择 2/3, 从而可以得到 横向压缩比为 7/10时的横向压缩表达式为 1^+1)2|1¾。 控制器 31对保存在接收缓冲区 331中的压缩比设定指令进行解析,得到纵向压缩 比 31/3, 其中, Sl、 s均为正整数, 并且 s>Sl, 如原始打印长度为 80mm, 压缩后的打 印长度为 56mm, 则纵向压缩比 Sl/s=7/10 (即 56/80)。 需要说明的是, 为了避免打印 文字或图像比例失调, 通常情况下横向压缩比与纵向压缩比相等。 根据纵向压缩比 Sl/s及初始步长的微步数量 n, 计算纵向压缩打印时打印一点行 压缩数据时电机所走的微步数 m, 其中, m=(n* Sl)/S, 如一个初始步长步等分为 16个 微步, 则初始步长的微步数量 n=16, 如一个初始步长步等分为 8个微步, 则初始步长 的微步数量 n=8。 当 m不为整数时, 由于电机的步进数只能为整数, 即 m不能为小数, 则需要对 m 进行整数化处理使其变为整数; 优选地, m为其取整后的数值,相对于纵向压缩比 Sl/s 新的压缩比 m/n的数值变小了, 从而提高了纵向的数据压缩率。 以51/5为 7/10, n等于 8为例说明, 如何求得 m的数值。 由于 m=C8*7)/10, 即 m 为小数 5.6, 则 m既可以为整数 5也可以为整数 6, 优选地, m等于 5, 即纵向压缩比 从较大数值的 7/10变为较小数值的 5/8, 从而提高了纵向压缩率, 减小了所使用介质 的长度, 从而减少了介质的使用量。 步骤 S2, 获取原始点阵数据 控制器 31对保存在接收缓冲区 331中的打印数据进行处理,当接收的打印数据为 点阵打印数据时, 则接收的点阵打印数据即为原始点阵数据; 当接收的打印数据为字 符打印数据时, 则根据字符的文字代码在字体数据库 341的索引数据区中查询该字符 的字体数据的数据量和地址偏移量, 根据地址偏移量在字体数据库 341的字体数据区 中读取与该数据量对应的字体数据, 按照字符的接收顺序对字符的相应字体数据进行 排列后生成原始点阵打印数据; 当接收的打印数据为图形打印数据时, 则解析图形打 印数据中的图形指令并得到点阵方式的原始点阵数据。 步骤 S3, 按照横向压缩表达式对原始点阵数据的每一点行数据进行压缩, 生成压 缩点阵数据 控制器 31按照原始点阵数据的打印顺序, 如图 5所示, 按照方向 63所示的从上 到下的顺序, 首先对原始点阵打印数据 60的第一点行数据 64进行压缩, 生成第一点 行压缩数据 84, 然后, 对第二点行数据进行压缩生成第二点行压缩数据, 依次处理, 直到把第 i (图 5中 i等于 24) 点行数据压缩成第 i点行压缩数据, 则生成由第一点行 压缩数据、 第二点行压缩数据、 …、 第 24点行压缩数据组成的压缩点阵数据 80, 并 把生成的压缩点阵数据保存在 RAM存储器 33的打印缓冲区 332中。 每一点行数据的压缩过程可以参考下面对图 3或图 4所示流程图的详细说明。
Figure imgf000005_0001
Where P1 is the number of items of the fixed operation term in the horizontal compression expression, and P2 is the number of items of the OR operation term in the horizontal compression expression, ! ^ represents the amount of data after compression, and r represents the amount of original data. Further, the first obtaining unit obtains the horizontal compression expression according to the horizontal compression ratio lookup table, including: determining whether the horizontal compression ratio can be found in the table; and when the horizontal compression ratio can be found in the table, the horizontal compression ratio obtained by the table is obtained. The corresponding horizontal compression expression is used as a horizontal compression expression; and when the horizontal compression ratio cannot be found in the table, the horizontal compression expression corresponding to the lateral compression ratio of the table is similar to the horizontal compression ratio as the horizontal compression ratio Horizontal compression expression. Further, the generating unit is configured to generate compressed dot matrix data according to the following manner: grouping each dot row data of the original dot matrix data by a data length of the horizontal compression expression to obtain a plurality of data groups; Compressing multiple data sets to generate multiple compressed data sets; combining multiple compressed data sets to generate one-line compressed data; and combining compressed data of all dot rows to generate compressed dot matrix data. Further, the generating unit is configured to generate compressed dot matrix data according to the following manner: partitioning each dot row data in the original dot matrix data by type to obtain a plurality of data regions; compressing the plurality of data regions according to the horizontal compression expression , generating a plurality of compressed data areas; combining a plurality of compressed data areas to generate compressed data of one line; and combining compressed data of all point lines to generate compressed dot matrix data. In order to achieve the above object, according to another aspect of the present invention, a printer is provided. The printer comprises: a stepping motor; a printing mechanism; and a controller, respectively connected to the stepping motor and the printing mechanism, configured to obtain a transverse compression expression according to a lateral compression ratio, and obtain a row microstep number m according to a longitudinal compression ratio; Raw dot matrix data; compresses each dot row data of the original dot matrix data according to the horizontal compression expression to generate compressed dot matrix data; and controls the printing mechanism to print a point in the compressed dot matrix data every m microsteps of the stepping motor Row data. With the print control method or printer of the present invention, since the horizontal compression expression and the row microstep number are first acquired, then each dot row data of the original lattice data is compressed according to the transverse compression expression to generate compressed dot matrix data, And controlling the rotation of the motor in a micro-step manner, and printing each dot row data of the compressed dot matrix data in a row mode according to the microstep number, thereby solving the problem that the paper saving and the printing speed are difficult to be achieved in the related art in the compression printing. The problem, in turn, achieves the effect of speed and significant paper saving when performing compression printing. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are incorporated in FIG. 1 is a schematic diagram of a composition of a first embodiment of a printer according to the present invention; FIG. 2 is a flow chart of a printing control method according to a first embodiment of the present invention; FIG. 3 is a first embodiment of the present invention. FIG. 4 is a flow chart of horizontally compressing a little line of data according to a second embodiment of the present invention; FIG. 4 is a flow chart for printing lateral line data according to a second embodiment of the present invention; FIG. FIG. 6 is a schematic diagram of a dot-line data compression process of horizontally compressed dot line data according to a print control method according to a first embodiment of the present invention; FIG. 7 is a print according to a second embodiment of the present invention. A schematic diagram of a dot-line data compression process for horizontally compressing point line data of a control method; and FIG. 8 is a schematic diagram of the composition of a second embodiment of the printer according to the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. 1 is a schematic diagram of the composition of a first embodiment of a printer according to the present invention. As shown, the printer 30 includes a controller 31, a communication interface 32, a RAM memory 33, a FLASH memory 34, a motor driver 35, a stepper motor 36, and Printing mechanism 37. The controller 31 controls each module to perform work. For example, the controller 31 controls the communication interface 32 to receive print data and a compression ratio setting command sent by a print requesting device (such as a computer or a network device), and the print data may be dot matrix print data. It can print data for characters including text codes and various typesetting instructions, and can also be print data defined by graphic instructions (referred to as graphic print data). The compression ratio setting command is used to set the horizontal compression ratio and vertical direction of the printer. The compression ratio, when the print data is character print data or graphic print data, the controller 31 also converts the character print data and the graphic print data into dot matrix print data, and the controller 31 also controls the printing mechanism 37 to perform data printing on the medium, etc. . The controller 31 includes a data compression unit 311 for compressing the original dot matrix print data in a bit manner according to the horizontal compression expression to generate compressed dot matrix data, which is a dot matrix print sent by the print requesting device to the printer. The data or the dot print data converted into the character print data sent to the printer by the print requesting device. The communication interface 32 receives the print data and the compression ratio setting command sent by the print requesting device, and stores the received print data and the compression ratio setting command in the RAM memory 33. The commonly used communication interface is a USB interface, an Ethernet interface, or the like. . The RAM memory 33 includes a receive buffer 331 for holding print data received by the communication interface 32 and a compression ratio setting instruction, and a print buffer 332 for saving to be printed. The compressed lattice data of the mechanism 37. a FLASH memory (ie, a non-volatile memory) 34, configured to store a font database 341, the font database 341 includes an index data area and a font data area, wherein the index data area includes a data amount of the font data of the character (referred to as a data amount), The font address of the character in the font data area is stored in the font data area (referred to as the address offset). The font data area stores the font data of each character. When the font data of the character is obtained, the character code is first indexed according to the character. The data amount of the font data of the character and its address offset in the font data area are obtained in the data area, and then the font data corresponding to the data amount is read in the font data area according to the address offset. For example, the text code 0x30 corresponds to the character "0", and the data amount and address offset of the character code 0x30 are searched in the index data area, such as the data amount is 6 (bytes) and the address offset is 0x1000, then the font data is A total of 6 bytes of data from the address 0x1000 0x1005 in the area is the font data of the character "0". The FLASH memory 34 is also used to store a correspondence table between the preferred horizontal compression ratio and the preferred horizontal compression expression, such as a horizontal compression ratio of /r and a character font data of a WxH lattice, wherein, ! ^ represents the amount of data after compression, r represents the original amount of data, r is in units of bits, W represents the number of points in the width direction of the font data, and H represents the number of points in the height direction of the font data. When r is a divisor of W, the lateral compression ratio is a preferred lateral compression ratio. If the font data of the character is 12x24 lattice, that is, W=12, then when r is a divisor of 12, such as r=3, 4, 6 Or horizontal compression ratio at 12 o'clock Both are preferred lateral compression ratios, such as lateral compression ratios 2/3, 3/4, 5/6, 7/12, etc. are preferred lateral compression ratios; transverse compression expressions are polynomials, including two kinds of operation items, respectively fixed An operation term and an OR operation term, wherein the fixed operation term indicates that the bit corresponding to the operation term is unchanged, and the OR operation term indicates that the adjacent two-bit data corresponding to the operation item is ORed, such as horizontal The compression expression is 1^+13⁄4|13⁄4, where bi, b 2 , and b 3 are bit data arranged in order, then! ^ is a fixed operation item, that is, the first bit data is unchanged, b 2 | b 3 is an "or" operation item, and "|" means an "or" operator, that is, the second bit data and the third bit data are "or". The number of data bits in the horizontal compression expression, that is, the number of bits, which is the data length of the horizontal compression expression, usually expressed as L. For example, the horizontal compression expression is 1^+13⁄4|13⁄4, then 1 ^ to 13⁄4 a total of 3 bits of data to perform the operation, that is, the horizontal compression expression data length L = 3, and for example, the horizontal compression expression is bi + + bs + + bslbs, then! ^to b 6 total 6-bit data is operated, so the data length of the horizontal compression expression is L=6, and the horizontal compression expression corresponding to the preferred lateral compression ratio is a preferred lateral compression expression, such as a preferred lateral compression ratio of 2/ 3, then the transverse compression expression bi+b 2 |b 3 corresponding to the preferred lateral compression ratio 2/3 is a preferred lateral compression expression. The motor driver 35 is configured to supply a driving current to the stepping motor 36 to rotate the stepping motor. The driving method of the stepping motor includes a full step mode and a micro step mode, wherein the full step mode is the initial step of the motor according to the initial step The working mode when the rotation is performed, the micro step method is the working mode when the motor rotates according to the microstep length, wherein the initial step length is the motor step length when the longitudinal compression is not performed, and the micro step size is to divide the initial step size equally. The motor step size after n equal parts, that is, the micro step size is l/n of the initial step size. Usually, the motor step angle (abbreviated as the initial step angle) of the initial step is equally divided, such as 2 equal parts. It is further divided into equal parts on the basis of two equal parts. Therefore, n is preferably a multiple of two, that is, a multiple of two squares of the initial step angle. The stepping motor 36 is used for driving the movement of the medium. When the stepping motor works in the micro step mode, the moving distance of the motor is dl for each microstep medium. When the stepping motor works in the full step mode, the motor moves every step of the medium. The distance is d2, then dl=d2/n. The printing mechanism 37 includes a printhead for printing the converted compressed dot matrix data on a medium to generate text and images on the medium. The print head is a line print head, which prints a line of data at a time. The commonly used line print head is a thermal print head, which includes a plurality of heat generating units, and a plurality of heat generating units are arranged equidistantly in a row, a heat generating unit and a dot row data. One point of data (ie, 1 bit) corresponds. When the point data is the first setting data, such as "1", the corresponding heat generating unit generates heat, thereby forming a dot on the printing medium, and the point data is the second setting. When data is used, such as "0", its corresponding heat-generating unit does not heat up, and there is no printout on the print medium. The embodiment of the present invention further provides a print control method. The print control method of the embodiment of the present invention can be executed by the controller 31 in the printer of the embodiment of the present invention, or used to control the printer of the embodiment of the present invention. The printer of the embodiment of the present invention can also be used in the print control method of the embodiment of the present invention. 2 is a flowchart of a printing control method according to an embodiment of the present invention. The specific processing procedure is as follows: Step S1, obtaining a horizontal compression expression according to a lateral compression ratio, and obtaining a microstep number m according to a vertical compression ratio The controller 31 analyzes the compression ratio setting command stored in the reception buffer 331 to obtain a lateral compression ratio! ^ , where , , r are positive integers, and r>>r/2, such as the original print width of 80mm, and the print width after compression is 56 mm, then the lateral compression ratio ri /r=7/10 (ie 56/80 ). After obtaining the lateral compression ratio iVr, the horizontal compression expression can be obtained by operation, or the horizontal compression expression can be obtained by looking up the table. The process of obtaining the horizontal compression expression by the operation according to the lateral compression ratio iVr is as follows: The number of items of the fixed operation term and the OR operation term in the horizontal compression expression is calculated according to the following Expression 1 and Expression 2. Pi + 2*p 2 = r (Expression 1) pi + P2 = Γι (Expression 2) By processing the above two equations, we get: pi Z - r; p 2 = r - ri . Where P1 is the number of items of the fixed operation term in the horizontal compression expression, and p 2 is the number of items of the OR operation term in the horizontal compression expression. If the printing medium used is changed from 80mm width to 56mm width, that is, the printing width is changed from the original printing width 80 to the compressed printing width 56, the lateral compression ratio ri /r = 7/10 (ie 56/80), It is necessary to compress 10 points in the original data into 7 points in the horizontal direction; according to Expression 1 and Expression 2, 1 = 4, p 2 = 3 is calculated, that is, the term of the fixed operation term in the horizontal compression expression The number of items with a number of 4 or "or" is 3, corresponding to the original data bl to bl0, and the horizontal compression expression can be
Figure imgf000009_0001
Where bi, b 2 , b 3 , b 4 are fixed operations, b 5 |b 6 , b 7 |b 8 , b 9 |bio are "or"operations; preferably, fixed in the horizontal compression expression When the operation term is separated from the OR operation term and evenly distributed, an optimized horizontal compression expression is obtained, such as! ^+! ^! ^+! ^+! ^! ^+! ^+! ^! ^+! ^. , among them, ! ^, b 4 , b 7 , b 1() are fixed operations, and b 2 |b 3 , b 5 |b 6 , b 8 |b 9 are OR operations. The process of obtaining the horizontal compression expression by looking up the table according to the lateral compression ratio iVr is as follows: According to the lateral compression ratio / the correspondence table of the preferred lateral compression ratio and the preferred lateral compression expression stored in the FLASH memory 34, the table is looked up, Preferably, the lateral compression ratio "in the column finds a preferred lateral compression expression corresponding to the lateral compression ratio iVr. Table 1 is a table showing the correspondence between the preferred lateral compression ratio and the preferred lateral compression expression when W = 12 (the dot matrix data of the character is 12 X 24), and the lateral compression ratios are 5/6 and 7/10, respectively. Explain the process of checking the table.
Figure imgf000010_0001
Table 1 Find the 5/6 item in the "Preferred Lateral Compression Ratio" column in Table 1, which is located on the third line, and the expression corresponding to the "Preferred Horizontal Compression Expression" column in the third line: bi+ +bs+ +bslbs is the horizontal compression expression to look for. When 7/10 items are found in the "Preferred Lateral Compression Ratio" column in Table 1, if 7/10 items are not found in the "Preferred Lateral Compression Ratio" column, the items close to the value of 7/10 are found. For item 2/3 and item 3/4, any one of them may be selected; preferably, a preferred lateral compression ratio with a smaller value is selected, such as 2/3 is selected, so that a lateral compression ratio of 7/10 can be obtained. The horizontal compression expression is 1^+1) 2 |13⁄4. The controller 31 parses the compression ratio setting command stored in the receiving buffer 331 to obtain a vertical compression ratio of 3 1 /3, where Sl and s are positive integers, and s> S1 , for example, the original printing length is 80 mm. The compressed print length is 56 mm, and the longitudinal compression ratio is Sl / s = 7/10 (ie 56/80). It should be noted that, in order to avoid the offset of the printed text or the image, the lateral compression ratio is usually equal to the vertical compression ratio. According to the longitudinal compression ratio S1 /s and the number of microsteps n of the initial step size, the number of microsteps m taken by the motor when printing a line of compressed data during longitudinal compression printing is calculated, where m=(n* S1 )/ s , such as An initial step step is equally divided into 16 microsteps, and the number of microsteps of the initial step size is n=16. If an initial step step is equally divided into 8 microsteps, the number of microsteps of the initial step size is n=8. . When m is not an integer, since the number of steps of the motor can only be an integer, that is, m cannot be a decimal, the integer processing of m is required to be an integer; preferably, m is the rounded value. The value of the new compression ratio m/n becomes smaller with respect to the longitudinal compression ratio S1 /s, thereby increasing the longitudinal data compression ratio. Taking 51 /5 as 7/10 and n equal to 8 as an example, how to find the value of m. Since m=C8*7)/10, that is, m is a fraction 5.6, m can be either an integer 5 or an integer 6. Preferably, m is equal to 5, that is, the longitudinal compression ratio is changed from 7/10 of a larger value. The smaller value is 5/8, which increases the longitudinal compression ratio and reduces the length of the medium used, thus reducing the amount of media used. Step S2, the original dot matrix data controller 31 processes the print data stored in the receive buffer 331. When the received print data is dot matrix print data, the received dot matrix print data is the original dot matrix data. When the received print data is character print data, the data amount and the address offset of the font data of the character are queried in the index data area of the font database 341 according to the character code of the character, according to the address offset in the font database. Reading the font data corresponding to the data amount in the font data area of 341, and arranging the corresponding font data of the characters according to the order of receiving the characters to generate original dot matrix print data; when the received print data is graphic print data, Analyze the graphics commands in the graphics print data and get the original dot matrix data in dot matrix mode. Step S3, compressing each dot row data of the original dot matrix data according to the horizontal compression expression, and generating a compressed dot matrix data controller 31 according to the printing order of the original dot matrix data, as shown in FIG. 5, according to the direction 63 From the top to the bottom, the first dot row data 64 of the original dot matrix print data 60 is first compressed to generate first dot row compressed data 84, and then the second dot row data is compressed to generate a second dot row compression. The data is processed in sequence until the i-th (i is equal to 24 in FIG. 5) dot row data is compressed into the i-th row row compressed data, and then the first dot row compressed data, the second dot row compressed data, ..., the 24th are generated. The compressed dot matrix data 80 composed of compressed data is dot-lined, and the generated compressed dot matrix data is stored in the print buffer 332 of the RAM memory 33. For the compression process of each line of data, reference may be made to the detailed description of the flowchart shown in FIG. 3 or FIG. 4 below.
S4, 电机每走 m微步, 打印压缩点阵数据中的一点行数据 以微步长方式控制电机旋转, 电机每走 m微步, 打印一点行压缩数据。 按照该种 方式, 依次打印压缩点阵数据的第一点行压缩数据、 第二点行压缩数据、 第三点行压 缩数据, …, 直到打印完压缩点阵数据的最后一点行压缩数据, 由于电机初始步长的 微步数量为 n, 因此, 每点行数据的打印高度为步进电机以全步长方式工作时的 m/n。 图 3 是根据本发明的第一实施例的打印控制方法的横向压缩一点行数据的流程 图, 具体处理过程如下: 步骤 S311 , 对原始点阵数据的一点行数据进行分组 原始点阵数据由多点行数据组成, 每一点行数据又由多个点数据组成, 每一点数 据对应一比特数据。 根据横向压缩表达式的数据长度 L, 对原始点阵数据的一点行数 据 (简称为原始点行数据) 中的点数据进行分组。 以横向压缩表达式的数据长度 L为 单位对原始点行数据的点数据进行分组, 共划分为 N/L个数据组, 其中, N为原始点 行数据的比特数, 依次生成第一数据组、 第二数据组、 …、 第 k数据组 (k = N/L), 如图 6中的 (b)所示, 对图 6中的 (a)所示的一原始点行数据 95进行分组, 由于横 向压缩表达式为 1^+1¾|1¾, 即 L等于 3, 则把数据量为 12比特的一行原始点行数据 95 共划分为 4个 (即 12/3 ) 数据组, 分别为第一数据组、 第二数据组、 第三数据组和第 四数据组。 步骤 S312, 按照横向压缩表达式, 对每一个数据组进行压缩, 生成相应的压缩数 据组 如图 6中(b)所示,按照横向压缩表达式 bi+ lbs对第一数据组、第二数据组、一、 第四数据组进行压缩, 分别生成如图 6中 (c)所示的第一压缩数据组、 第二压缩数据 组、 …、 第四压缩数据组, 如图 6中 (b)所示, 第一数据组为 " 110", 以横向压缩表 达式 bi+b2|b3对其进行压缩, 则第 1比特 " 1 "不变, 第 2比特 " 1 "和第 3比特 "0" 进行 "或"运算得到一比特的 " 1 ", 则把第一数据组 " 110"压缩为如图 6中 (c) 所 示的第一压缩数据组 " 11 "。 步骤 S313 , 对压缩数据组进行组合, 生成点行压缩数据 按照原始点行数据的分组顺序, 对压缩数据组进行组合, 生成点行压缩数据, 如 如图 6中 (c)所示, 对第一压缩数据组、 第二压缩数据组、 …、 第四压缩数据组进行 组合, 生成如图 6中 (d)所示的点行压缩数据 96, 至此, 则把图 6 (a) 中 95所示的 原始点行数据 " 110110011000"压缩为如图 6(d)中 96所示的点行压缩数据 " 11110100"。 图 4是根据本发明第二实施例的打印控制方法的横向压缩一点行数据的流程图, 具体处理过程如下: 步骤 S321 , 对原始点阵数据中一点行数据按照类型分区, 得到多个数据区 按照数据属性的不同对原始点阵数据中的一点行数据中的点数据进行分类, 如由 字符的字体数据生成的点数据为字符类、 由图形命令生成的点数据为图形类、 …、 由 字符间隔形成的点数据为间隔类等, 如图 7 (b)所示, 将图 7 (a)所示的一行原始点 行数据 67的点数据划分为两类数据, 分别为字符类数据 91和间隔类数据 92。 按照点数据的类型, 以确定的顺序, 如从左向右的顺序, 对原始点行数据中的相 邻点数据进行分区, 划分为多个数据区, 其中, 每个数据区只能包括一种类型的数据, 每个字符类数据区既可以包括由一个字符的点阵数据生成的点数据, 也可以包括由多 个连续的字符组成的点阵数据生成的点数据, 同样地, 每个图形类数据区既可以包括 一个图形的点阵数据, 也可以包括连续的多个图形组成的点阵数据, 如图 7 ( c)所示, 原始点行数据 67划分为八个数据区, 分别为第一数据区、 第二数据区、 …、 第八数据 区, 其中, 第一数据区、 第三数据区、 第五数据区、 第七数据区为字符类, 第二数据 区、 第四数据区、 第六数据区、 第八数据区为间隔类。 步骤 S322, 按照横向压缩表达式, 对每一个数据区进行压缩, 生成相应的压缩数 据区 按照横向压缩表达式, 对图 7 ( c) 所示的第一数据区、 第二数据区、 …、 第八数 据区进行压缩, 分别生成如图 7 ( d) 所示的第一压缩数据区、 第二压缩数据区、 一、 第八压缩数据区。 步骤 S323 , 对压缩数据区进行组合, 生成点行压缩数据 按照原始点行数据的分区顺序, 对压缩数据区进行组合, 生成点行压缩数据, 如 图 7 ( d)所示, 对第一压缩数据区、第二压缩数据区、 …、第八压缩数据区进行组合, 生成如图 7 ( e) 所示的点行压缩数据 87, 至此, 则把图 7 ( a) 中 67所示的原始点行 数据压缩为图 7 ( e) 中 87所示的点行压缩数据。 本实施例通过对点行数据进行分类压缩, 减小了横向压缩时不同类型数据之间的 相互干扰, 保持了每类数据的完整性, 从而提高了横向压缩的打印效果。 本发明实施例还提供了一种打印机,如图 8所示,该打印机包括第一获取单元 301、 第二获取单元 302、 生成单元 303和打印单元 304。 第一获取单元 301用于根据横向压缩比获取横向压缩表达式, 根据纵向压缩比获 取行微步数 m。 该第一获取单元 301可以通过上述的控制器 31和通信接口 32来实现。 第二获取单元 302获取原始点阵数据。 该第二获取单元 302可以通过上述的通信接口 32来实现,也可以通过单独设置的 通信接口 32来实现, 或者, 通过控制器 31对打印机获取的字符打印数据转换得到。 生成单元 303按照所述横向压缩表达式对所述原始点阵数据的每一点行数据进行 压缩, 生成压缩点阵数据。 该生成单元 303也可以通过上述的控制器 31来实现。 打印单元 304用于在电机每走 m微步, 打印压缩点阵数据中的一点行数据。 该打印单元 304可以通过上述的控制器 31、 步进电机 36和打印机构 37来实现。 需要说明的是, 本发明实施例的打印控制方法可以通过但不限于通过本发明实施 例所提供的打印机来执行, 本发明实施例的打印机可以用于执行本发明实施例所提供 的打印控制方法。 本发明实施例的打印机可以结合本发明实施例所提供的打印控制方 法来理解, 因而也可以用于执行本发明实施例的优选打印控制方法, 在本实施例中, 不再对第一获取单元 301、第二获取单元 302、生成单元 303和打印单元 304进行更优 选的描述。 本发明实施例提供的打印控制方法或者打印机, 根据横向压缩比得到横向压缩表 达式, 其中横向压缩表达式包括固定运算项和 "或"运算项, 根据纵向压缩比得到行 微步数, 利用横向压缩表达式对点行数据进行横向压缩后再打印, 减少了字符行的宽 度, 从而减小使用介质的宽度; 根据行微步数控制进纸电机以微步长方式进行点行数 据打印, 从而实现打印数据的纵向压缩, 缩短了使用介质的长度。 由于横向压缩表达 式包括固定运算项和 "或"运算项, 通过固定运算项保留了文字字体的形状, 减小了 横向压缩对文字字体的影响, 通过 "或"运算项, 有效减少了横向数据量, 从而实现 打印数据的横向压缩, 以微步长方式控制电机移动来实现对打印数据的纵向压缩, 不 需要对打印数据在纵向上进行压缩, 从而保证了文字等信息在纵向上的打印质量, 因 此, 通过简单的运算就可以实现原始打印数据在横向和纵向上的压缩打印效果。 本发 明实施例提供的打印控制方法, 由于压缩数据的处理量少, 因此, 在保证打印质量的 情况下不会影响打印机的打印速度。 进一步地, 按照点数据的类型对点行数据中的点 数据进行分区、 压缩, 保证了不同类型数据的压缩一致性, 消除了对不同类型的点数 据进行连续压缩时的相互影响, 保证了文字、 图像等的完整性。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。 S4, the motor rotates m microsteps, prints a little line of data in the compressed dot matrix data to control the motor rotation in a microstep manner, and the motor prints a little line of compressed data every m microsteps. According to this manner, the first dot row compressed data, the second dot row compressed data, the third dot row compressed data, ... of the compressed dot matrix data are sequentially printed, until the last point of the compressed dot matrix data is printed, and the data is compressed due to The number of microsteps of the initial step of the motor is n, so the print height of each dot row data is m/n when the stepper motor works in full step mode. 3 is a flow chart of laterally compressing a bit of row data according to the printing control method according to the first embodiment of the present invention, and the specific processing procedure is as follows: Step S311: grouping a bit of row data of the original dot matrix data by the original dot matrix data The dot row data is composed, and each row of data is composed of a plurality of dot data, and each point of data corresponds to one bit of data. The point data in the one-line data of the original dot matrix data (referred to as the original dot row data) is grouped according to the data length L of the horizontal compression expression. The point data of the original point row data is grouped by the data length L of the horizontal compression expression, and is divided into N/L data groups, where N is the original point. The number of bits of the row data sequentially generates the first data group, the second data group, ..., the kth data group (k = N/L), as shown in (b) of FIG. 6, for (a in FIG. 6) The original dot row data 95 shown is grouped. Since the horizontal compression expression is 1^+13⁄4|13⁄4, that is, L is equal to 3, a row of original dot row data 95 having a data amount of 12 bits is divided into four. (ie 12/3) data groups, which are the first data group, the second data group, the third data group and the fourth data group, respectively. Step S312, compressing each data group according to the horizontal compression expression, and generating a corresponding compressed data group. As shown in (b) of FIG. 6, the first data group and the second data group are performed according to the horizontal compression expression bi+ lbs. First, the fourth data group is compressed, and respectively generates a first compressed data group, a second compressed data group, ..., a fourth compressed data group as shown in (c) of FIG. 6, as shown in (b) of FIG. The first data group is "110", and is compressed by the horizontal compression expression bi+b 2 |b 3 , then the first bit "1" is unchanged, the second bit "1" and the third bit "0" The "perform" or "calculation" yields a one-bit "1", and the first data set "110" is compressed into the first compressed data set "11" as shown in (c) of FIG. Step S313, combining the compressed data groups, generating the point row compressed data according to the grouping order of the original point row data, combining the compressed data groups, and generating the point row compressed data, as shown in FIG. 6(c), A compressed data set, a second compressed data set, ..., a fourth compressed data set are combined to generate dot-line compressed data 96 as shown in (d) of FIG. 6, and thus, 95 of FIG. 6(a) is used. The original dot line data "110110011000" is compressed to the dot line compressed data "11110100" as shown by 96 in Fig. 6(d). 4 is a flow chart of laterally compressing a bit of row data according to a second embodiment of the present invention. The specific processing procedure is as follows: Step S321: Partitioning a row of data in the original dot matrix data according to type, and obtaining a plurality of data regions The point data in the point data of the original dot matrix data is classified according to the data attribute, such as the point data generated by the font data of the character is a character class, the point data generated by the graphic command is a graphic class, ..., The dot data formed by the character interval is an interval class or the like. As shown in FIG. 7(b), the dot data of the original dot row data 67 shown in FIG. 7(a) is divided into two types of data, which are character class data 91, respectively. And interval class data 92. According to the type of the point data, in a determined order, such as from left to right, the adjacent point data in the original point line data is partitioned into a plurality of data areas, wherein each data area can only include one Type of data, each character class data area may include point data generated by dot matrix data of one character, or dot data generated by dot matrix data composed of a plurality of consecutive characters, and similarly, each The graphics class data area can include A graphic dot matrix data may also include dot matrix data composed of a plurality of consecutive graphics. As shown in FIG. 7(c), the original dot row data 67 is divided into eight data regions, which are respectively a first data region, and a first data region. a second data area, ..., an eighth data area, wherein the first data area, the third data area, the fifth data area, and the seventh data area are character classes, the second data area, the fourth data area, and the sixth data area The eighth data area is an interval class. Step S322, compressing each data area according to the horizontal compression expression, and generating a corresponding compressed data area according to the horizontal compression expression, to the first data area, the second data area, ..., shown in FIG. 7(c) The eighth data area is compressed to generate a first compressed data area, a second compressed data area, and an eighth compressed data area as shown in FIG. 7(d), respectively. Step S323, combining the compressed data regions, generating the point row compressed data according to the partition order of the original dot row data, combining the compressed data regions, and generating the dot row compressed data, as shown in FIG. 7(d), for the first compression The data area, the second compressed data area, ..., the eighth compressed data area are combined to generate the dot line compressed data 87 as shown in Fig. 7(e), and thus the original shown in Fig. 7(a) 67 is obtained. The dot row data is compressed into the dot row compressed data shown in 87 of Fig. 7(e). In this embodiment, by classifying the point line data, the mutual interference between different types of data during horizontal compression is reduced, and the integrity of each type of data is maintained, thereby improving the horizontal compression printing effect. The embodiment of the present invention further provides a printer. As shown in FIG. 8, the printer includes a first obtaining unit 301, a second obtaining unit 302, a generating unit 303, and a printing unit 304. The first obtaining unit 301 is configured to obtain a horizontal compression expression according to the lateral compression ratio, and acquire the row microstep number m according to the vertical compression ratio. The first obtaining unit 301 can be implemented by the controller 31 and the communication interface 32 described above. The second acquisition unit 302 acquires the original lattice data. The second obtaining unit 302 can be implemented by the communication interface 32 described above, or by the communication interface 32 that is separately provided, or converted by the controller 31 to the character print data acquired by the printer. The generating unit 303 compresses each dot row data of the original dot matrix data according to the horizontal compression expression to generate compressed dot matrix data. The generating unit 303 can also be implemented by the controller 31 described above. The printing unit 304 is configured to print a little line of data in the compressed dot matrix data every m microsteps of the motor. The printing unit 304 can be realized by the controller 31, the stepping motor 36, and the printing mechanism 37 described above. It should be noted that the print control method of the embodiment of the present invention may be performed by, but not limited to, the printer provided by the embodiment of the present invention. The printer of the embodiment of the present invention may be used to execute the print control method provided by the embodiment of the present invention. . The printer of the embodiment of the present invention can be used in conjunction with the print control method provided by the embodiment of the present invention, and thus can also be used to perform the preferred print control method of the embodiment of the present invention. In this embodiment, the first acquisition unit is no longer used. 301. The second acquisition unit 302, the generation unit 303, and the printing unit 304 perform a more preferable description. The print control method or printer provided by the embodiment of the present invention obtains a horizontal compression expression according to a lateral compression ratio, wherein the horizontal compression expression includes a fixed operation term and an OR operation term, and the row microstep number is obtained according to the vertical compression ratio, and the horizontal direction is used. The compression expression laterally compresses the dot line data and then prints, reducing the width of the character line, thereby reducing the width of the used medium; controlling the paper feeding motor to perform dot line data printing in a microstep manner according to the number of microsteps of the line, thereby Longitudinal compression of print data reduces the length of media used. Since the horizontal compression expression includes a fixed operation item and an "or" operation item, the shape of the text font is preserved by the fixed operation item, the influence of the horizontal compression on the text font is reduced, and the horizontal data is effectively reduced by the "or" operation item. The volume is compressed to realize the horizontal compression of the print data, and the motor movement is controlled in a micro-step manner to realize the longitudinal compression of the print data, and the print data is not required to be compressed in the longitudinal direction, thereby ensuring the print quality of the text and the like in the vertical direction. Therefore, the compressed printing effect of the original print data in the horizontal and vertical directions can be realized by a simple operation. According to the print control method provided by the embodiment of the present invention, since the amount of processing of the compressed data is small, the printing speed of the printer is not affected in the case of ensuring the print quality. Further, the point data in the point row data is partitioned and compressed according to the type of the point data, thereby ensuring the compression consistency of different types of data, eliminating the mutual influence on the continuous compression of different types of point data, and ensuring the text. , image, etc. integrity. The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

Claims

权 利 要 求 书 Claim
1. 一种打印控制方法, 其特征在于, 包括: A print control method, comprising:
步骤 Sl, 根据横向压缩比获取横向压缩表达式, 根据纵向压缩比获取行微 步数 m;  Step Sl, obtaining a horizontal compression expression according to the lateral compression ratio, and obtaining a row microstep number m according to the vertical compression ratio;
步骤 S2, 获取原始点阵数据;  Step S2, acquiring original dot matrix data;
步骤 S3,按照所述横向压缩表达式对所述原始点阵数据的每一点行数据进 行压缩, 生成压缩点阵数据; 以及  Step S3, compressing each point row data of the original dot matrix data according to the horizontal compression expression to generate compressed dot matrix data;
步骤 S4, 电机每走所述 m微步, 打印所述压缩点阵数据中的一点行数据。  Step S4: The motor prints a bit of row data in the compressed dot matrix data every time the motor moves by the m microstep.
2. 根据权利要求 1所述的打印控制方法, 其特征在于, 所述步骤 S1 中的根据横 向压缩比获取横向压缩表达式包括: The print control method according to claim 1, wherein the obtaining the horizontal compression expression according to the lateral compression ratio in the step S1 comprises:
根据所述横向压缩比计算得到所述横向压缩表达式, 或者,  Calculating the transverse compression expression according to the lateral compression ratio, or
根据所述横向压缩比查表得到所述横向压缩表达式, 其中, 在所述表中存 储有多个横向压缩比与多个横向压缩表达式的对应关系。  The horizontal compression expression is obtained based on the lateral compression ratio look-up table, wherein a correspondence relationship between a plurality of lateral compression ratios and a plurality of lateral compression expressions is stored in the table.
3. 根据权利要求 2所述的打印控制方法, 其特征在于, 在根据所述横向压缩比运 算得到所述横向压缩表达式时根据以下公式计算所述横向压缩表达式中固定运 算项和 "或"运算项的项数: 3. The printing control method according to claim 2, wherein when the horizontal compression expression is obtained according to the lateral compression ratio operation, a fixed operation term and "or" in the horizontal compression expression are calculated according to the following formula "Number of items in the operation item:
pi + 2*p2 = rPi + 2*p 2 = r
Figure imgf000015_0001
Figure imgf000015_0001
其中, Pl为所述横向压缩表达式中固定运算项的项数, P2为所述横向压缩 表达式中"或"运算项的项数, !^表示压缩后的数据量, r表示原始的数据量。 Wherein P1 is the number of items of the fixed operation item in the horizontal compression expression, and P2 is the number of items of the OR operation item in the horizontal compression expression, ^ represents the amount of data after compression, and r represents the amount of original data.
4. 根据权利要求 2所述的打印控制方法, 其特征在于, 根据所述横向压缩比查表 得到所述横向压缩表达式包括: 4. The printing control method according to claim 2, wherein the obtaining the horizontal compression expression according to the horizontal compression ratio lookup table comprises:
判断所述表中是否能够查找到所述横向压缩比;  Determining whether the horizontal compression ratio can be found in the table;
当所述表中能够查找到所述横向压缩比时, 将查表得到的横向压缩比对应 的横向压缩表达式作为所述横向压缩表达式; 以及 当所述表中无法查找到所述横向压缩比时, 将所述表中与所述横向压缩比 的数值相近的横向压缩比对应的横向压缩表达式作为所述横向压缩比对应的横 向压缩表达式。 When the horizontal compression ratio can be found in the table, a horizontal compression expression corresponding to the horizontal compression ratio obtained by looking up the table is used as the horizontal compression expression; When the horizontal compression ratio cannot be found in the table, a horizontal compression expression corresponding to a lateral compression ratio similar to the value of the lateral compression ratio in the table is used as a horizontal compression expression corresponding to the horizontal compression ratio. formula.
5. 根据权利要求 1所述的打印控制方法, 其特征在于, 所述步骤 S3包括: The printing control method according to claim 1, wherein the step S3 comprises:
以所述横向压缩表达式的数据长度为单位对所述原始点阵数据的每一点行 数据进行分组, 得到多个数据组;  And grouping each dot row data of the original dot matrix data in units of data lengths of the horizontal compression expression to obtain a plurality of data groups;
按照所述横向压缩表达式, 对所述多个数据组进行压缩, 生成多个压缩数 据组;  And compressing the plurality of data groups according to the horizontal compression expression to generate a plurality of compressed data groups;
对所述多个压缩数据组进行组合, 生成一点行的压缩数据; 以及 对所有点行的压缩数据进行组合, 生成所述压缩点阵数据。  Combining the plurality of compressed data sets to generate compressed data of a little line; and combining the compressed data of all the dot lines to generate the compressed dot matrix data.
6. 根据权利要求 1所述的打印控制方法, 其特征在于, 所述步骤 S3包括: The printing control method according to claim 1, wherein the step S3 comprises:
对所述原始点阵数据中每一点行数据按照类型分区, 得到多个数据区; 按照所述横向压缩表达式, 分别对所述多个数据区进行压缩, 生成多个压 缩数据区;  And arranging each point row data in the original dot matrix data according to a type to obtain a plurality of data regions; and compressing the plurality of data regions according to the horizontal compression expression to generate a plurality of compressed data regions;
对所述多个压缩数据区进行组合, 生成一点行的压缩数据; 以及 对所有点行的压缩数据进行组合, 生成所述压缩点阵数据。  Combining the plurality of compressed data regions to generate compressed data of one line; and combining the compressed data of all the dot lines to generate the compressed dot matrix data.
7. 一种打印机, 其特征在于, 包括: 7. A printer, comprising:
第一获取单元, 用于根据横向压缩比获取横向压缩表达式, 根据纵向压缩 比获取行微步数 m;  a first obtaining unit, configured to obtain a horizontal compression expression according to a lateral compression ratio, and obtain a row microstep number m according to a longitudinal compression ratio;
第二获取单元, 获取原始点阵数据;  a second acquiring unit, acquiring original dot matrix data;
生成单元, 按照所述横向压缩表达式对所述原始点阵数据的每一点行数据 进行压缩, 生成压缩点阵数据; 以及  Generating unit, compressing each point row data of the original lattice data according to the horizontal compression expression to generate compressed dot matrix data;
打印单元, 用于在电机每走所述 m微步, 打印所述压缩点阵数据中的一点 行数据。  a printing unit, configured to print a line of data in the compressed dot matrix data every time the motor moves by the m microstep.
8. 根据权利要求 7所述的打印机, 其特征在于, 所述第一获取单元用于通过以下 方式获取所述横向压缩表达式: The printer according to claim 7, wherein the first obtaining unit is configured to obtain the horizontal compression expression by:
根据所述横向压缩比计算得到所述横向压缩表达式, 或者, 根据所述横向压缩比查表得到所述横向压缩表达式, 其中, 在所述表中存 储有多个横向压缩比与多个横向压缩表达式的对应关系。 Calculating the transverse compression expression according to the lateral compression ratio, or The horizontal compression expression is obtained according to the horizontal compression ratio lookup table, wherein a correspondence relationship between the plurality of horizontal compression ratios and the plurality of horizontal compression expressions is stored in the table.
9. 根据权利要求 8所述的打印机, 其特征在于, 所述第一获取单元还用于在根据 所述横向压缩比计算得到所述横向压缩表达式时根据以下表达式计算所述横向 压缩表达式中固定运算项和 "或"运算项的项数: The printer according to claim 8, wherein the first acquiring unit is further configured to calculate the horizontal compressed expression according to the following expression when calculating the horizontal compression expression according to the horizontal compression ratio The number of items in the fixed and "or" operands:
pi + 2*p2 = rPi + 2*p 2 = r
Figure imgf000017_0001
Figure imgf000017_0001
其中, Pl为所述横向压缩表达式中固定运算项的项数, P2为所述横向压缩 表达式中"或"运算项的项数, !^表示压缩后的数据量, r表示原始的数据量。 Wherein P1 is the number of items of the fixed operation item in the horizontal compression expression, and P2 is the number of items of the OR operation item in the horizontal compression expression, ^ represents the amount of data after compression, and r represents the amount of original data.
10. 根据权利要求 8所述的打印机, 其特征在于, 所述第一获取单元根据所述横向 压缩比查表得到所述横向压缩表达式包括: The printer according to claim 8, wherein the first obtaining unit obtains the horizontal compression expression according to the horizontal compression ratio table:
判断所述表中是否能够查找到所述横向压缩比;  Determining whether the horizontal compression ratio can be found in the table;
当所述表中能够查找到所述横向压缩比时, 将查表得到的横向压缩比对应 的横向压缩表达式作为所述横向压缩表达式; 以及  When the lateral compression ratio can be found in the table, a horizontal compression expression corresponding to the lateral compression ratio obtained by looking up the table is used as the horizontal compression expression;
当所述表中无法查找到所述横向压缩比时, 将所述表中与所述横向压缩比 的数值相近的横向压缩比对应的横向压缩表达式作为所述横向压缩比对应的横 向压缩表达式。  When the horizontal compression ratio cannot be found in the table, a horizontal compression expression corresponding to a lateral compression ratio similar to the value of the lateral compression ratio in the table is used as a horizontal compression expression corresponding to the horizontal compression ratio. formula.
11. 根据权利要求 7所述的打印机, 其特征在于, 所述生成单元用于按照以下方式 生成所述压缩点阵数据: The printer according to claim 7, wherein the generating unit is configured to generate the compressed dot matrix data in the following manner:
以所述横向压缩表达式的数据长度为单位对所述原始点阵数据的每一点行 数据进行分组, 得到多个数据组;  And grouping each dot row data of the original dot matrix data in units of data lengths of the horizontal compression expression to obtain a plurality of data groups;
按照所述横向压缩表达式, 对所述多个数据组进行压缩, 生成相应的压缩 数据组;  And compressing the plurality of data groups according to the horizontal compression expression to generate a corresponding compressed data group;
对所述多个压缩数据组进行组合, 生成一点行的压缩数据; 以及 对所有点行的压缩数据进行组合, 生成所述压缩点阵数据。  Combining the plurality of compressed data sets to generate compressed data of a little line; and combining the compressed data of all the dot lines to generate the compressed dot matrix data.
12. 根据权利要求 7所述的打印机, 其特征在于, 所述生成单元用于按照以下方式 生成所述压缩点阵数据: The printer according to claim 7, wherein the generating unit is configured to generate the compressed dot matrix data in the following manner:
对所述原始点阵数据中每一点行数据按照类型分区, 得到多个数据区; 按照所述横向压缩表达式, 分别对所述多个数据区进行压缩, 生成多个压 缩数据区; Each row of data in the original dot matrix data is partitioned by type to obtain a plurality of data regions; And compressing the plurality of data regions according to the horizontal compression expression to generate a plurality of compressed data regions;
对所述多个压缩数据区进行组合, 生成一点行的压缩数据; 以及 所有点行的压缩数据进行组合, 生成所述压缩点阵数据。  Combining the plurality of compressed data regions to generate compressed data of a little line; and compressing the compressed data of all the dot lines to generate the compressed dot matrix data.
13. 一种打印机, 其特征在于, 包括: 13. A printer, comprising:
步进电机 (36);  Stepper motor (36);
打印机构 (37); 以及  Printing mechanism (37);
控制器 (31 ), 与所述步进电机 (36) 和所述打印机构 (37) 分别相连接, 用于根据横向压缩比获取横向压缩表达式, 根据纵向压缩比获取行微步数 m; 获取原始点阵数据; 按照所述横向压缩表达式对所述原始点阵数据的每一点行 数据进行压缩, 生成压缩点阵数据; 以及步进电机(36)每走所述 m微步, 控 制所述打印机构 (37) 打印所述压缩点阵数据中的一点行数据。 a controller (31) is respectively connected to the stepping motor (36) and the printing mechanism (37) for acquiring a transverse compression expression according to a lateral compression ratio, and obtaining a row microstep number m according to a longitudinal compression ratio ; Acquiring original dot matrix data; compressing each dot row data of the original dot matrix data according to the horizontal compression expression to generate compressed dot matrix data; and controlling the stepper motor (36) every m microsteps The printing mechanism (37) prints a point of line data in the compressed dot matrix data.
14. 根据权利要求 13所述的打印机, 其特征在于, 所述控制器(31 )用于采用以下 方式获取所述横向压缩表达式: 14. The printer according to claim 13, wherein the controller (31) is configured to acquire the horizontal compression expression in the following manner:
根据所述横向压缩比计算得到所述横向压缩表达式, 或者,  Calculating the transverse compression expression according to the lateral compression ratio, or
根据所述横向压缩比查表得到所述横向压缩表达式, 其中, 在所述表中存 储有多个横向压缩比与多个横向压缩表达式的对应关系。  The horizontal compression expression is obtained based on the lateral compression ratio look-up table, wherein a correspondence relationship between a plurality of lateral compression ratios and a plurality of lateral compression expressions is stored in the table.
15. 根据权利要求 14所述的打印机, 其特征在于, 所述控制器(31 )用于在根据所 述横向压缩比运算得到所述横向压缩表达式时根据以下公式计算所述横向压缩 表达式中固定运算项和 "或"运算项的项数: The printer according to claim 14, wherein the controller (31) is configured to calculate the horizontal compression expression according to the following formula when the transverse compression expression is obtained according to the lateral compression ratio operation The number of items in the fixed and "or" operands:
pi + 2*p2 = rPi + 2*p 2 = r
Figure imgf000018_0001
Figure imgf000018_0001
其中, Pl为所述横向压缩表达式中固定运算项的项数, P2为所述横向压缩 表达式中"或"运算项的项数, !^表示压缩后的数据量, r表示原始的数据量。 Wherein P1 is the number of items of the fixed operation item in the horizontal compression expression, and P2 is the number of items of the OR operation item in the horizontal compression expression, ^ represents the amount of data after compression, and r represents the amount of original data.
16. 根据权利要求 14所述的打印机, 其特征在于, 所述控制器(31 )用于采用以下 方式根据所述横向压缩比查表得到所述横向压缩表达式: 16. The printer according to claim 14, wherein the controller (31) is configured to obtain the horizontal compression expression according to the transverse compression ratio look-up table in the following manner:
判断所述表中是否能够查找到所述横向压缩比; 当所述表中能够查找到所述横向压缩比时, 将查表得到的横向压缩比对应 的横向压缩表达式作为所述横向压缩表达式; 以及 Determining whether the horizontal compression ratio can be found in the table; When the horizontal compression ratio can be found in the table, a horizontal compression expression corresponding to the horizontal compression ratio obtained by looking up the table is used as the horizontal compression expression;
当所述表中无法查找到所述横向压缩比时, 将所述表中与所述横向压缩比 的数值相近的横向压缩比对应的横向压缩表达式作为所述横向压缩比对应的横 向压缩表达式。  When the horizontal compression ratio cannot be found in the table, a horizontal compression expression corresponding to a lateral compression ratio similar to the value of the lateral compression ratio in the table is used as a horizontal compression expression corresponding to the horizontal compression ratio. formula.
17. 根据权利要求 13所述的打印机, 其特征在于, 所述控制器(31 )用于采用以下 方式生成所述压缩点阵数据: 17. The printer according to claim 13, wherein the controller (31) is configured to generate the compressed dot matrix data in the following manner:
以所述横向压缩表达式的数据长度为单位对所述原始点阵数据的每一点行 数据进行分组, 得到多个数据组;  And grouping each dot row data of the original dot matrix data in units of data lengths of the horizontal compression expression to obtain a plurality of data groups;
按照所述横向压缩表达式, 对所述多个数据组进行压缩, 生成多个压缩数 据组;  And compressing the plurality of data groups according to the horizontal compression expression to generate a plurality of compressed data groups;
对所述多个压缩数据组进行组合, 生成一点行的压缩数据; 以及 对所有点行的压缩数据进行组合, 生成所述压缩点阵数据。  Combining the plurality of compressed data sets to generate compressed data of a little line; and combining the compressed data of all the dot lines to generate the compressed dot matrix data.
18. 根据权利要求 13所述的打印机, 其特征在于, 所述控制器(31 )用于采用以下 方式生成所述压缩点阵数据: 18. The printer according to claim 13, wherein the controller (31) is configured to generate the compressed dot matrix data in the following manner:
对所述原始点阵数据中每一点行数据按照类型分区, 得到多个数据区; 按照所述横向压缩表达式, 分别对所述多个数据区进行压缩, 生成多个压 缩数据区;  And arranging each point row data in the original dot matrix data according to a type to obtain a plurality of data regions; and compressing the plurality of data regions according to the horizontal compression expression to generate a plurality of compressed data regions;
对所述多个压缩数据区进行组合, 生成一点行的压缩数据; 以及 对所有点行的压缩数据进行组合, 生成所述压缩点阵数据。  Combining the plurality of compressed data regions to generate compressed data of one line; and combining the compressed data of all the dot lines to generate the compressed dot matrix data.
PCT/CN2013/078131 2012-06-29 2013-06-27 Printing control method and printer WO2014000659A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210222146.1 2012-06-29
CN201210222146.1A CN103507448B (en) 2012-06-29 2012-06-29 Print control program and printer

Publications (1)

Publication Number Publication Date
WO2014000659A1 true WO2014000659A1 (en) 2014-01-03

Family

ID=49782257

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/078131 WO2014000659A1 (en) 2012-06-29 2013-06-27 Printing control method and printer

Country Status (2)

Country Link
CN (1) CN103507448B (en)
WO (1) WO2014000659A1 (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199625B (en) * 2014-09-17 2017-04-26 贵州京洲电子发展有限公司 Method, device and system for converting and outputting print data
CN104924793B (en) * 2015-06-16 2017-09-19 深圳市新国都支付技术有限公司 The method of the compatible all kinds of cash register receipt information printings of POS terminal
CN106610802B (en) * 2016-12-15 2019-08-09 国网江苏省电力公司淮安供电公司 The dot chart image file of protective device virtual printer constructs and storage method
CN110879513A (en) * 2019-12-17 2020-03-13 珠海奔图电子有限公司 Sheet conveyance control method, sheet conveyance control apparatus, image forming system, and electronic device
CN111352595B (en) * 2020-02-20 2022-11-08 容大合众(厦门)科技集团股份公司 Dot line compression method of thermal printer
CN111923599B (en) * 2020-09-18 2021-02-26 季华实验室 Method and equipment for calculating step length of spray head module, storage medium and ink-jet printer
CN112130782A (en) * 2020-09-22 2020-12-25 上海汉图科技有限公司 Printing method and device and printing client
WO2022226960A1 (en) * 2021-04-30 2022-11-03 深圳市博思得科技发展有限公司 Paper feeding precision calibration method and calibration system
CN113535099B (en) * 2021-05-08 2024-01-02 南京富士通电子信息科技股份有限公司 Print head driving method and apparatus, storage medium, and electronic apparatus

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4365273A (en) * 1979-11-05 1982-12-21 Dainippon Screen Seizo Kabushiki Kaisha Picture data compressing method
US6081277A (en) * 1995-09-28 2000-06-27 Sony Corporation Apparatus and method for controlling image display
CN1967569A (en) * 2006-11-27 2007-05-23 中外合资南京富士通计算机设备有限公司 Stylus printer pages compression processing method
CN102407683A (en) * 2010-09-26 2012-04-11 江门市得实计算机外部设备有限公司 Stepless zooming printing control method and device of printer
CN102452233A (en) * 2010-10-25 2012-05-16 山东新北洋信息技术股份有限公司 Printing control method and device, and printing device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE69535836D1 (en) * 1994-11-29 2008-10-23 Seiko Epson Corp Tape printing device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4365273A (en) * 1979-11-05 1982-12-21 Dainippon Screen Seizo Kabushiki Kaisha Picture data compressing method
US6081277A (en) * 1995-09-28 2000-06-27 Sony Corporation Apparatus and method for controlling image display
CN1967569A (en) * 2006-11-27 2007-05-23 中外合资南京富士通计算机设备有限公司 Stylus printer pages compression processing method
CN102407683A (en) * 2010-09-26 2012-04-11 江门市得实计算机外部设备有限公司 Stepless zooming printing control method and device of printer
CN102452233A (en) * 2010-10-25 2012-05-16 山东新北洋信息技术股份有限公司 Printing control method and device, and printing device

Also Published As

Publication number Publication date
CN103507448B (en) 2016-08-03
CN103507448A (en) 2014-01-15

Similar Documents

Publication Publication Date Title
WO2014000659A1 (en) Printing control method and printer
US20090153892A1 (en) Image processing device, image forming system, image forming method and computer readable medium storing program
US20130222857A1 (en) Printer control apparatus
JP2009241524A (en) Image output apparatus
JP2011054147A (en) Information processing apparatus, control method for the same and computer program
CN103019631A (en) Print data processing system, print data processing method, and non-transitory computer readable medium
JPH08221354A (en) Direct memory access controller,printer and data transfer method
WO2012083887A1 (en) Bi-color duplex printing method and device
JP2002209097A (en) Image rendering method and image rendering apparatus
CN1803460A (en) Transverse typeset printing technology of minitype printer
CN1106624C (en) Image recording apparatus and control method thereof
US20100079811A1 (en) Systems and Methods for Efficient Halftone Screening
CN102848737A (en) Printer and printing control method
CN104461406B (en) A kind of print-out method and device
CN105745912A (en) Image processing device
KR101682817B1 (en) Print control apparatus, method for controlling print control apparatus, and recording medium
US20100157333A1 (en) Printing apparatus and printing method
JP5786394B2 (en) Printing apparatus, printing system, printing method, and program
US20170091599A1 (en) Printer, method, and program for printing arabic characters
KR100524013B1 (en) formatting apparutus of printing data and method thereof
JP2007175980A5 (en)
JP2010181999A (en) Printing system, printer, and print control program
JP2003211739A (en) Recorder and recording control method
JP4079958B2 (en) Thermal history control device, operation method thereof, and thermal printer
JP3055738B2 (en) Dot matrix pattern printing method and apparatus

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: 13810464

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: 13810464

Country of ref document: EP

Kind code of ref document: A1