您将什么字符发送到“通用/纯文本”打印机打印粗体和下划线字符?

发布于 2024-11-07 07:37:06 字数 191 浏览 0 评论 0原文

我需要打印我正在进行的项目的报告。我已经打印它,但缺少一些格式(粗体、下划线),用于强调和区分某些区域。

打印机安装为“通用/仅文本”(客户端要求)。我已经在谷歌上搜索了一段时间,但还没有找到一种方法来发送正确的字符以使代码中的文本加粗和下划线。

如何通过代码在通用文本打印机中打印粗体和下划线字符?

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 emphasize 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

破晓 2024-11-14 07:37:06

通常,纯文本打印机会通过将滑架移至左侧并叠印字符来响应 BS(退格)字符 chr(8)。因此,要加粗单词,您可以发送字符:

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

和下划线:

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 _

有时打印机可能会更好地响应 CR(回车符,chr(13)),这会将滑车一直移动到左侧,以便您可以在字符上留出空间并叠印:

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

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
花间憩 2024-11-14 07:37:06

好吧,如果它接受类似 Epson 的代码,则打印字节

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

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
青巷忧颜 2024-11-14 07:37:06

您是否尝试过 ESC+E 开始粗体并 ESC+F 结束它?

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文