使用 Code 128 字体在 HTML 中呈现条形码
是否可以使用 Code 128 字体在 HTML 中呈现正确的条形码? 条形码的主要内容在浏览器(firefox)中很好,但是当我尝试添加起始码字符时,我只是在浏览器中得到这个字符:
Ñ
This is ASCII code 209。我想知道它是否有一个酒吧代表。 我正在使用 MVC,但我认为这实际上只是一个 HTML/CSS 问题。
谢谢
Is it possible to render correct bar-codes in HTML using the Code 128 font?
The main content of the bar-code is fine in the broswer (firefox) but when I try to add the start code character I just get this character in the browser:
Ñ
This is ASCII code 209. I'm wondering if it even has a bar representation.
I'm using MVC but this is really just a HTML/CSS problem I think.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这并不完全符合您的要求,但您可以使用 CSS 制作条形码:请参阅 http: //unixshell.jcomeau.com/src/barcodes/memberships.html。我使用的是 code39,但大多数其他线性代码都可以用同样的方式完成。
This isn't quite what you asked for, but you can make barcodes using CSS: see http://unixshell.jcomeau.com/src/barcodes/memberships.html. I'm using code39 for this, but most other linear codes can be done the same way.
您确定客户端要安装条形码字体吗?
服务器端图像生成似乎是更好的解决方案。
您可能想尝试 Barcode.dll 进行条形码渲染。
它包括 ASP.NET 条形码控件 - 只需拖动即可降低。
请注意,这是我开发的商业产品。
Are you sure that the client is going to have barcode font installed?
Server side image generation seems to be a better solution.
You may want to try Barcode.dll for barcode rendering.
It includes ASP.NET barcode control - just drag & drop.
Please note that this is a commercial product I developed.
我知道这已经晚了好几年了,但再看看这个问题,我很确定你只是没有为你的字体使用正确的数字代码。没有单一的“Code 128 字体”。而 Wikipedia 显示 209 是
Start B< 的正确“通用”代码/code>,我在网上发现各种字体都不是这样的。在这个中,
Start B
是236; 这里是 204。为您的特定字体使用正确的代码,您应该得到什么你想要的。未由条形码字体编码的代码点将由默认字体呈现,这就是您看到 N 波浪号字符的原因。
I know this is years too late, but looking again at the question, I'm pretty sure you're just not using the right numeric code for your font. there is no single "Code 128 font". while 209 is shown by Wikipedia to be the correct "common" code for
Start B
, in various fonts I found online this is not the case. in this,Start B
is 236; and here it's 204. use the right code for your particular font, and you should get what you want.a code point not encoded by the barcode font will be rendered by a default font, which is why you're seeting the N tilde character.