开发者

What characters do you send to a "Generic/Text Only" printer to print bolded and underlined characters?

I need to print a report for a project I'm working on. I'm already printing it, but some formatting is missing (bold, underline) that is used to emphasiz开发者_如何学Goe and differentiate certain areas.

The printer is installed as "Generic/Text Only" (required by the client). I've been googling for a while now, and haven't found a way to send the right characters to make the text bolded and underlined from code.

How can I print bold and underline characters in a generic text only printer by code?


Often a plain text printer will respond to the BS (backspace) character, chr(8) by moving the carriage to the left and overprinting characters. So to bold a word, you could send the characters:

t h i s SP i s SP b BS b o BS o l BS l d BS d

and to underline:

t h i s SP i s SP u BS _ n BS _ d BS _ e BS _ r BS _ l BS _ i BS _ n BS _ e BS _ d BS _

Sometimes the printer might respond better to CR (carriage return, chr(13)) better, which moves the carriage all the way to the left so you can space over and overprint characters:

t h i s SP i s SP b o l d CR SP SP SP SP SP SP SP SP b o l d


Well, if it accepts Epson-like codes then print the bytes:

27, 45, 49  for underline on
27, 45, 48  for underline off
27, 69      for bold on
27, 70      for bold off


Have you tried ESC+E to start bold and ESC+F to finish it?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜