A printing control method for thermal printers at different resolutions
By calculating the least common divisor of different resolutions of thermal printers, the gear precision and graphic splitting are designed, solving the multi-resolution adaptability problem, reducing costs and maintaining high-precision printing results.
Patent Information
- Application Number
- CN202310799115.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-06-30
AI Technical Summary
Existing thermal printers, due to their uniform structural design, cannot adapt to the printing needs of various resolutions, resulting in limited adjustment of printing accuracy and high design and management costs.
By calculating the least common divisor between different resolutions, the gearbox gear precision is designed so that pixel units have different resolutions. Furthermore, by adjusting the number of vertical and horizontal rows through graphic splitting, adaptation to different resolutions is achieved.
It reduces manufacturing and maintenance costs, improves printer adaptability, and ensures that graphics remain distorted at different resolutions while maintaining high precision.
Smart Images

Figure CN117041444B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of printer technology, and in particular to a printing control method for thermal printers with different resolutions. Background Technology
[0002] Currently, conventional thermal printers, when designed to support a printhead resolution of 203 DPI (8.0 dots / mm), typically employ a fixed gear ratio for the stepper motor, gearbox, and roller. This results in one motor pulse moving the thermal paper 0.125 mm (one dot) per pulse at 203 DPI. For 304 DPI (11.8 dots / mm) resolution, the same gear ratio is used, resulting in one dot movement per pulse. Based on these two designs, the software calculates distances based on a one-pulse-one-dot distance to control the stepper motor and achieve the specified precision.
[0003] However, the control methods described above, due to the use of the same structural design, result in a fixed resolution and limited adjustment of printing precision. If multiple resolutions need to be supported, the thermal printer requires multiple gearboxes to adapt to different printing precisions, which leads to high design costs. At the same time, multiple gearboxes increase management and production costs. Furthermore, the software control methods described above are relatively simple and cannot adapt to high-precision scenarios. Summary of the Invention
[0004] To achieve the above objectives, the present invention provides a printing control method for thermal printers with different resolutions. This printing control method for thermal printers with different resolutions can adapt to different printing accuracy requirements and can effectively reduce manufacturing costs.
[0005] A method for controlling printing at different resolutions in a thermal printer, comprising the following steps:
[0006] Obtain information on all resolutions of the thermal printer, find the least common divisor N among all resolutions, where the least common divisor N is a value of the same order of magnitude as the resolution or is an order of magnitude greater than the resolution;
[0007] Select a gear inside the gearbox of the thermal printer. The tooth pitch ΔL between two adjacent teeth of this gear has the following relationship with the least common divisor N: ΔL=n1N; n1 is a natural number; and construct pixel units with a square with a side length of ΔL.
[0008] Identify the vertical length 'a' and horizontal length 'b' of the printed image, and the host computer or controller will divide the vertical length 'a' and horizontal length 'b' of the printed image into integer pixel units respectively;
[0009] The following relationships exist between ΔL and a and b, respectively:
[0010] a=n2ΔL+Δε1; b=n3ΔL+Δε2;
[0011] Where n2 and n3 represent the number of rows divided by the vertical length a and horizontal length b of the printed image, and both n2 and n3 are natural numbers;
[0012] Δε1 and Δε2 are the remaining quantities after splitting, and both |Δε1| and |Δε2| are less than ΔL;
[0013] If both Δε1 and Δε2 are positive, the host computer or controller sets the length a and width b of the printed image as: a = (n2+1)ΔL; b = (n3+1)ΔL. The host computer or controller controls the print head in the thermal printer to print according to this splitting method. If both Δε1 and Δε2 are negative, the host computer or controller sets the length a and width b of the printed image as: a = n2ΔL; b = n3ΔL. The host computer or controller controls the print head in the thermal printer to print according to this splitting method. The desired image precision can then be obtained.
[0014] In some possible implementations, the steps of obtaining information on all resolutions of the thermal printer and finding the least common divisor N of all resolutions specifically include the following steps:
[0015] Obtain information on all resolutions of the thermal printer, and denote each resolution as S. i , where i is a natural number; each resolution S i Both include horizontal and vertical resolution;
[0016] The horizontal and vertical resolutions of each resolution are converted into the spacing between each pixel unit. The horizontal spacing between two adjacent pixel units is denoted as S. il The vertical distance between two adjacent pixel units is denoted as S. id ;
[0017] Find all S il and all S id The least common divisor N between them.
[0018] In some possible implementations, after finding all S il and all S id The steps to find the least common divisor N between the two factors specifically include the following steps:
[0019] Find all S il all common divisors N between l , find all S id all common divisors N between d ;
[0020] Compare all common divisors N l and all common divisors N d ; find the minimum |N l -N d |;
[0021] Find the common divisor between N l and N d in the minimum |N l and N d |, the common divisor is the minimum common divisor N between all S il and all S id , the minimum common divisor N is in the same order of magnitude as said N l and N d , or the minimum common divisor N is one order of magnitude lower than said N l or N d .
[0022] In some possible implementations, in the step of finding the minimum common divisor N between all S il and all S id , the following steps are specifically included:
[0023] Find all S il all common divisors N between l , find all S id all common divisors N between d ;
[0024] Compare the minimum common divisor N l and the minimum common divisor N d , find the average value between N l and N d , so as to obtain the minimum common divisor N between all S il and all S id , the minimum common divisor N is in the same order of magnitude as said N l and N d , or the minimum common divisor N is one order of magnitude lower than said N l or N d .
[0025] In some possible implementations, in the step that the upper computer or the controller respectively splits the longitudinal length a and the transverse length b of the printed image into integer pixel units, the specific splitting operation is as follows:
[0026] Divide the vertical length 'a' and horizontal length 'b' of the printed image into n2 and n3 parts respectively. Selecting n1 will give you the actual pixel precision with the highest pixel precision of 1 / n1; selecting n2 and n3 will give you the printing precision of 1 / n2*n3.
[0027] In some possible implementation methods, the specific operation in the step of controlling the printhead in the thermal printer by the host computer or controller to perform printing is as follows:
[0028] Obtain the value of n1, and the host computer or controller adjusts the pixel precision of the pixel unit according to the value of n1; the host computer or controller adjusts the print head in the thermal printer according to the number of rows n2 and n3, and prints the paper line by line.
[0029] In some possible implementations, the host computer or controller adjusts the pixel precision of the pixel unit based on the value of n1. The specific method for the host computer or controller to adjust the pixel precision is as follows: If n1 equals 1, the thermal printer controls the print head to print entirely according to the print command issued by the host computer or controller; if n1 is ≥ 2, the thermal printer performs a secondary split of the pixel unit according to the print command issued by the host computer or controller, splitting it into n1 parts in both the vertical and horizontal directions. The vertical or horizontal direction is selected, and the printing effect of each part in the other direction is adjusted. Adjacent parts in the adjusted direction can be printed with dots or lines spaced apart to obtain the pixel unit with the required pixel precision.
[0030] Compared to existing technologies, the advantages of this invention are as follows: The printing control method for thermal printers of this invention designs the gearbox gear precision using the common divisor among different printing resolutions, and designs the gears using the least common divisor, allowing pixel units to have different resolutions. This enables the gearbox gear precision to adapt to all printing resolutions, solving the problem of gear compatibility within the same gearbox, improving adaptability, and reducing manufacturing and maintenance costs. Furthermore, by splitting the graphic into different vertical and horizontal rows, it effectively ensures that the graphic will not be distorted during the printing process, while ensuring that pixel units in each vertical and horizontal row effectively adapt to different graphic sizes. Attached Figure Description
[0031] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0032] Figure 1This is a flowchart of an embodiment of the present invention;
[0033] Figure 2 This is a schematic diagram of a pixel unit in an embodiment of the present invention;
[0034] Figure 3 This is a schematic diagram illustrating the principle of pixel unit spacing in an embodiment of the present invention;
[0035] Figure 4 This is a schematic diagram illustrating the principle of interlaced pixel unit splitting in an embodiment of the present invention. Detailed Implementation
[0036] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention. Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of this disclosure, unless otherwise stated, "a plurality of" means two or more.
[0037] Reference Figure 1 The method for controlling printing at different resolutions in a thermal printer, as shown, includes the following steps:
[0038] S100. Obtain information on all resolutions of the thermal printer, and find the least common divisor N among all resolutions. The least common divisor N is a value of the same order of magnitude as the resolution or the least common divisor N is an order of magnitude greater than the resolution.
[0039] S200. Select a gear in the gearbox of the thermal printer. The tooth pitch ΔL between two adjacent teeth of the gear has the following relationship with the least common divisor N: ΔL=n1N; n1 is a natural number; and construct pixel units with a square with ΔL as the side length.
[0040] S300: Identify the vertical length a and horizontal length b of the printed image. The host computer or controller will then divide the vertical length a and horizontal length b of the printed image into integer pixel units.
[0041] The following relationships exist between ΔL and a and b, respectively:
[0042] a=n2ΔL+Δε1; b=n3ΔL+Δε2;
[0043] Where n2 and n3 represent the number of rows divided by the vertical length a and horizontal length b of the printed image, and both n2 and n3 are natural numbers;
[0044] Δε1 and Δε2 are the remaining quantities after splitting, and both |Δε1| and |Δε2| are less than ΔL;
[0045] S400. If both Δε1 and Δε2 are positive, the host computer or controller sets the length a and width b of the printed image as: a = (n2+1)ΔL; b = (n3+1)ΔL. The host computer or controller controls the print head in the thermal printer to print according to this splitting method. If both Δε1 and Δε2 are negative, the host computer or controller sets the length a and width b of the printed image as: a = n2ΔL; b = n3ΔL. The host computer or controller controls the print head in the thermal printer to print according to this splitting method. The required precision graphic can then be obtained.
[0046] The aforementioned pixel unit is actually the basic point group that constitutes all graphics. In the actual printing process, the pixel unit is actually a point group similar to a square. In this application, the theoretical side length of the point group is taken as d. Due to the limitations of physical structure, and the inevitable errors between different point groups, the absolute value of |d-ΔL| should be as small as possible in the design process, and d>ΔL is the optimal solution. This allows the points in different vertical and horizontal directions to overlap at the edges, ensuring that the entire graphic is more delicate.
[0047] This thermal printer's printing control method for different resolutions designs the gearbox gear precision by using the common divisor among different printing resolutions, and designs the gears using the least common divisor, allowing pixel units to have different resolutions. This ensures the gearbox gear precision adapts to all printing resolutions, solving the problem of gear compatibility within the same gearbox, improving adaptability, and reducing manufacturing and maintenance costs. Furthermore, by splitting the graphic into different vertical and horizontal rows, it effectively ensures that the graphic does not deform during the printing process, while ensuring that pixel units in each vertical and horizontal row effectively adapt to different graphic sizes.
[0048] In some possible implementations, step S100, which involves obtaining information on all resolutions of the thermal printer and calculating the least common divisor N of all resolutions, specifically includes the following steps:
[0049] S110. Obtain information on all resolutions of the thermal printer, and denote each resolution as S. i , where i is a natural number; each resolution S i Both include horizontal and vertical resolution;
[0050] S120. Convert the horizontal resolution and vertical resolution of each resolution into the spacing distance between each pixel unit, wherein the spacing distance between two adjacent pixel units in the horizontal direction is denoted as S1, and the spacing distance between two adjacent pixel units in the vertical direction is denoted as S id ;
[0051] S130. Find the greatest common divisor N between all S il and all S id .
[0052] It should be noted that in step S110, the aforementioned multiple pixel units are the basic modules constituting the pattern in the present application. The difference between different resolutions lies in the difference in the spacing distance between two adjacent pixel units in the horizontal and vertical directions. For this reason, in the present application, S il and S id differ to determine different resolutions.
[0053] In the above embodiment, step S130 specifically includes the following steps:
[0054] S131. Find all common divisors N of all S il , and find all common divisors N l of all S id d ;
[0055] S132. Compare all the common divisors N l and all the common divisors N d ; find the minimum |N l -N d |;
[0056] S133. Find the common divisor between N l and N d in the minimum |N l and N d |, the common divisor being the greatest common divisor N between all S il and all S id , wherein the greatest common divisor N is in the same order of magnitude as said N l and N d , or the greatest common divisor N is one order of magnitude lower than said N l or N d .
[0057] This method of calculating the least common divisor N is relatively complex. Although it cannot achieve the highest resolution printing effect in both the horizontal and vertical directions, the calculated least common divisor N can be adapted to the resolution in both directions, ensuring that the graphic is not distorted, reducing the cumulative error between different lines of printing, and guaranteeing the normal printing of the graphic. In fact, to reduce the cumulative error, this application preferably uses a least common divisor N lower than the stated N. l or N d One order of magnitude, thus using the difference between orders of magnitude to compensate for the cumulative error mentioned above.
[0058] Of course, in one embodiment of this application, the simplest calculation method can also be used in step S130 to calculate all S il and all S id The least common divisor N between them includes the following steps:
[0059] S131, Find all S il All common divisors N between l Find all S id All common divisors N between d ;
[0060] S132. Compare the least common divisor N. l The least common divisor N d Find N l and N d The average value between them gives all S il and all S id The least common divisor N between them, the least common divisor N and the N l and N d For those of the same order of magnitude or whose least common divisor N is lower than the stated N l or N d One order of magnitude.
[0061] In this embodiment, although the least common divisor N obtained in this way can basically meet the highest resolution requirements in both the horizontal and vertical directions, if the least common divisor N... l The least common divisor N d When the difference between the two values is too large, different cumulative errors will always be generated in the two directions during the printing process, and this cumulative error is larger than the cumulative error in the previous embodiment, which leads to increased graphic deformation. Therefore, the higher the printing precision, the smaller the graphic deformation. When the printing precision is lower, due to the multiple of n1, the cumulative error of the spacing between pixel units will also be amplified by a multiple of n1. Therefore, this printing method is only suitable for high-precision graphic printing.
[0062] See Figure 2In some possible implementations, in step S300, the host computer or controller divides the vertical length 'a' and horizontal length 'b' of the printed image into integer pixel units. Specifically, the division operation is as follows: the vertical length 'a' and horizontal length 'b' of the printed image are divided into n2 and n3 parts respectively. Selecting n1 yields the actual pixel precision with a maximum pixel precision of 1 / n1; selecting n2 and n3 yields the printing precision of 1 / n2*n3. Where a and b are fixed, the larger the selected values of n2 and n3, the greater the actual pixel precision, resulting in a smaller ΔL and thus a higher overall printing precision.
[0063] In some possible implementations, in step S300, the specific operation of the host computer or controller controlling the print head of the thermal printer to print is as follows: The value of n1 is obtained; the host computer or controller adjusts the pixel precision of the pixel unit according to the value of n1; the host computer or controller adjusts the print head of the thermal printer according to the pixel precision, printing line by line according to the number of rows n2 and n3. Here, the precision of the pixel unit determines the basic resolution of the entire image, and n2 and n3 are adapted to n1. Therefore, in the functions formed by n1, n2, and n3 respectively, n1 is the independent variable, while n2 and n3 are the dependent variables.
[0064] More specifically, in step S300, the host computer or controller adjusts the pixel precision of the pixel unit according to the value of n1. The specific method of adjusting the pixel precision by the host computer or controller is as follows: if n1 equals 1, the thermal printer controls the print head to print entirely according to the print command issued by the host computer or controller; if n1 ≥ 2, the thermal printer performs a second split of the pixel unit according to the print command issued by the host computer or controller, and splits it into n1 parts in both the vertical and horizontal directions. The vertical or horizontal direction is selected and the printing effect of each part in the other direction is adjusted. Adjacent parts in the adjusted direction can be printed with dots or lines spaced apart to obtain the pixel unit with the required pixel precision.
[0065] For an example of using dot-spaced printing, please refer to [link / reference]. Figure 2 In this application, when n1=2, the printing command issued by the host computer or controller is complete data, which is represented as 0xFFFF in hexadecimal. After receiving the data, the thermal printer splits it into 0x5555 and 0xAAAA. When printing the first line, the data 0x5555 is used for heating, and when printing the second line, the data 0xAAAA is used for heating control.
[0066] Similarly, for interlaced printing, see [link to relevant documentation]. Figure 4This application again uses n1=2 as an example. The printing command issued by the host computer or controller is complete data, which is represented as 0xFFFF in hexadecimal. During the printing process, only the first line is printed, while the second line is left blank and not printed.
[0067] Therefore, in the above printing methods, different levels of precision can be printed depending on the number of rows split and the grouping of data.
[0068] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions within the technical scope disclosed in the present invention should be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A printing control method for thermal printers at different resolutions, characterized in that, Includes the following steps: Obtain information on all resolutions of the thermal printer, find the least common divisor N among all resolutions, where the least common divisor N is a value of the same order of magnitude as the resolution or is an order of magnitude greater than the resolution; Select a gear inside the gearbox of the thermal printer. The tooth pitch ΔL between two adjacent teeth of this gear has the following relationship with the least common divisor N: ΔL=n1N; n1 is a natural number; and construct pixel units with a square with a side length of ΔL. Identify the vertical length 'a' and horizontal length 'b' of the printed image, and the host computer or controller will divide the vertical length 'a' and horizontal length 'b' of the printed image into integer pixel units respectively; The following relationships exist between ΔL and a and b, respectively: a=n2ΔL+Δε1; b=n3ΔL+Δε2; Where n2 and n3 represent the number of rows divided by the vertical length a and horizontal length b of the printed image, and both n2 and n3 are natural numbers; Δε1 and Δε2 are the remaining quantities after splitting, and both |Δε1| and |Δε2| are less than ΔL; If both Δε1 and Δε2 are positive, the host computer or controller sets the length a and width b of the printed image as: a = (n2+1)ΔL; b = (n3+1)ΔL. The host computer or controller controls the print head in the thermal printer to print according to this splitting method. If both Δε1 and Δε2 are negative, the host computer or controller sets the length a and width b of the printed image as: a = n2ΔL; b = n3ΔL. The host computer or controller controls the print head in the thermal printer to print according to this splitting method. The desired image precision can then be obtained.
2. The printing control method for thermal printers with different resolutions according to claim 1, characterized in that, The steps involved in obtaining information on all resolutions of the thermal printer and finding the least common divisor N of all resolutions include the following: Obtain information on all resolutions of the thermal printer, and denote each resolution as S. i , where i is a natural number; each resolution S i Both include horizontal and vertical resolution; The horizontal and vertical resolutions of each resolution are converted into the spacing between each pixel unit. The horizontal spacing between two adjacent pixel units is denoted as Sil, and the vertical spacing between two adjacent pixel units is denoted as S. id ; Find all S il and all S id The least common divisor N between them.
3. The printing control method for thermal printers with different resolutions according to claim 2, characterized in that, Find all S il and all S id The steps to find the least common divisor N between the two factors specifically include the following steps: Find all S il All common divisors N between l Find all S id All common divisors N between d ; Compare all common divisors N l and all common divisors N d Find the smallest |N l -N d |; Find the minimum |N l -N d | where N l and N d the common divisor between them, and this common divisor is the greatest common divisor between all S il and all S id , denoted as N. The greatest common divisor N is of the same order of magnitude as the N l and N d , or the greatest common divisor N is one order of magnitude lower than said N l or N d .
4. The printing control method for thermal printers with different resolutions according to claim 2, characterized in that, Find all S il and all S id The steps to find the least common divisor N between the two factors specifically include the following steps: Find all S il All common divisors N between l Find all S id All common divisors N between d ; Compare the least common divisor N l The least common divisor N d Find N l and N d The average value between them gives all S values. il and all S id The least common divisor N between them, the least common divisor N and the N l and N d For those of the same order of magnitude or whose least common divisor N is lower than the stated N l or N d One order of magnitude.
5. The printing control method for thermal printers with different resolutions according to claim 1, characterized in that, In the step where the host computer or controller divides the vertical length 'a' and horizontal length 'b' of the printed image into integer pixel units, the specific division operation is as follows: Divide the vertical length 'a' and horizontal length 'b' of the printed image into n2 and n3 parts respectively. Selecting n1 will give you the actual pixel precision with the highest pixel precision of 1 / n1; selecting n2 and n3 will give you the printing precision of 1 / n2*n3.
6. The printing control method for thermal printers at different resolutions according to claim 5, characterized in that, In the steps of controlling the printhead of a thermal printer to print using a host computer or controller, the specific operations are as follows: Obtain the value of n1, and the host computer or controller adjusts the pixel precision of the pixel unit according to the value of n1; the host computer or controller adjusts the print head in the thermal printer according to the number of rows n2 and n3, and prints the paper line by line.
7. The printing control method for thermal printers at different resolutions according to claim 6, characterized in that, The host computer or controller adjusts the pixel precision of the pixel unit according to the value of n1. The specific method of adjusting the pixel precision by the host computer or controller is as follows: If n1 equals 1, the thermal printer controls the print head to print entirely according to the print command issued by the host computer or controller; if n1 is ≥ 2, the thermal printer performs a second split of the pixel unit according to the print command issued by the host computer or controller, and splits it into n1 parts in both the vertical and horizontal directions. The vertical or horizontal direction is selected and the printing effect of each part in the other direction is adjusted. Adjacent parts in the adjusted direction can be printed with dots or lines spaced apart to obtain the pixel unit with the required pixel precision.
Citation Information
Patent Citations
Extremely simple thermal printer
CN213734166U
Method for thermal printing
EP1234677A1
