(4) unveil the mystery of the printer driver

Source: Internet
Author: User

In the previous article, we obtained the hexadecimal file TestDriver4.1 generated by the print driver. Next, I will discuss with you the meanings of these hexadecimal numbers. To learn about these hexadecimal data, it is essential to have an ESC/POS instruction set, which has been downloaded online. At present, most of the thermal printing in China uses the ESC/POS command. The driver we installed earlier is based on the ESC/POS command, and the ESC/POS command is used. To interact with a computer, a printer must use a common language, ESC/POS. The driver is to translate the content that the computer wants to express into an ESC/POS command, and then tell the printer that the printer will start printing.

Fig 4.1

We can see that the first line of data is 1B40, which is a hexadecimal number, that is, 0x1B, 0x40. Then we open the ESC/POS instruction set, find the 1B40 command 4.2,
Fig 4.2

We can see that the hexadecimal command is 1B 40, and the decimal value is 27 64. The hexadecimal 0x1B is 27 in decimal format, and the hexadecimal 40 is 64 in decimal format. this command initializes the printer. The instruction below describes the specific explanation of the instruction, mainly to clear the print buffer data and NV bitmap data.

Let's look at the next one, 1B4A30, turn on the ESC/POS instruction set, 4.3

4.3

We can see that the purpose of this command is to print and take a piece of paper. This command also carries the parameter n. Now the command is 1B4A30, and n is hexadecimal 0x30, that is, decimal 48, therefore, according to the instruction, the distance from the paper is n x vertical or horizontal movement unit. This vertical or horizontal movement unit can be set, generally, the default printer is 1 point, that is, 0.125mm, so the distance from the paper is 48x0.125mm = 6mm.

The next line is 1D76300030018... this command is complicated. View command 4.4

We can see that this command is used to print the grating bitmap. There are many parameters. We will compare them one by one and compare them with our data 1d76300018... then, m = 00, xL = 0x30, xH = 0x00, yL = 0x18, yH = 0x00, k = 1152, this command is the main part of driving translation. It is used to convert images and text into a dot matrix and send them to the printer. After the printer receives the dot matrix, print the image and text.

From the above analysis, we can see that the driver has nothing to do with magic. It just converts the content to be printed into a data dot matrix, then sends it to the printer, and then prints it out, these data lattice formats follow the ESC/POS instructions. Therefore, the most important thing in printer development is to understand the ESC/POS instruction set. I will introduce the ESC/POS instruction set later.

(4) unveil the mystery of the printer driver

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.