All you can do with TextOut calls it every time you need a new line, and increase the y coordinate according to the settings, such as the font size and the selected printer (if the selected printer is "Generic / Text Only" in FILE port, just leave it alone alone). Otherwise, the text will be scrambled if it simply does not appear at all. With this in mind, this function is suitable for the intent of plain text and knows exactly the length of the text based on the font attributes. Therefore, it is best to use a POS printer or use a monospace font, leaving all text-breaking operations to your concern.
int increment, y; char *text, *text0; increment=25; y=0; text="Hello"; text0="World"; TextOut(hDC,10,y+=increment,text,strlen(text)); TextOut(hDC,10,y+=increment,text0,strlen(text0)); TextOut(hDC,10,y+=increment,"",0); TextOut(hDC,10,y+=increment,"",0);
source share