如何使用 C# 从字符串生成条形码?

发布于 2024-08-16 16:53:00 字数 102 浏览 3 评论 0原文

  • 是否可以从字符串生成条形码
    使用c#?
  • ASP.NET 中是否有用于生成条形码的内置类?
  • 是否可以检测与系统连接的条码打印机?
  • Is it possible to generate barcode from a string
    using c#?
  • Is there any builtin classes for generating barcodes in asp.net?
  • Is it possible to detect a barcode printer connected with a system?

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

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

发布评论

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

评论(4

诗化ㄋ丶相逢 2024-08-23 16:53:00

是的。当然有可能。 :-)
据我所知,有两种生成条形码的方法:

  1. 使用特殊的条形码字体(尝试在 google 上搜索“barcode font free”)
  2. 将条形码渲染为图像并显示该图像(尝试使用 条码渲染框架可在 github 上找到)

针对您关于检测条码打印机的更新问题:
我认为条形码打印机将在您的系统上显示为常规打印机。至少我玩过的设备都是这样工作的。
这意味着您可以通过枚举系统上已安装的打印机并查找指定的设备来检测特定的条形码打印机,但在大多数情况下,我建议您让用户使用标准打印对话框或使用自定义对话框。

Yep. Of course it is possible. :-)
As far as I know there are two ways to generate bar codes:

  1. Using a special bar code font (try to google for "barcode font free")
  2. Render the bar code to an image and display that (try using the Barcode Rendering Framework available on github)

In response to your updated question about detecting barcode printers:
I think a barcode printer will show up as a regular printer on your system. At least that is how the devices I have played with have worked.
This means that you can detect a specific barcode printer by enumerating the installed printers on the system and looking for the specified device, but in most cases I would suggest that you let the user specify the printer himself using either the standard print dialog or using a custom dialog.

随风而去 2024-08-23 16:53:00

是否可以使用 C# 从字符串生成条形码?

是的。有很多框架可以做到这一点 - 无论是作为字体还是图像。

asp.net中是否有用于生成条形码的内置类?

不,但是这个 github 上的 c# 项目 允许将字符串转换为图像(甚至可以是多种条形码类型) )。然后您需要做的就是在应用程序中显示该图像,就像任何其他图像一样。

是否可以检测与系统连接的条码打印机?

是的,例如,在 WinForm 应用程序中,您可以使用 System.Drawing.Printing.PrinterSettings.InstalledPrinters 。

Is it possible to generate barcodes from a string using c#?

Yes, it is. There are quite a lot of frameworks that do it - either as a font or an image.

Is there any built-in classes for generating barcodes in asp.net?

No, but this c# project on github allows a string to be converted into an image (even multiple barcode types). All you need to do then is display the image in your application, just like any other image.

Is it possible to detect a barcode printer connected with a system?

Yes, in a WinForm application, for example, you could use System.Drawing.Printing.PrinterSettings.InstalledPrinters.

筱果果 2024-08-23 16:53:00

要检测您是否安装了打印机,您可以简单地使用以下命令枚举可用的打印机:

 System.Drawing.Printing.PrinterSettings.InstalledPrinters

to detect if you have printer installed then you may simply enumerate available printers using:

 System.Drawing.Printing.PrinterSettings.InstalledPrinters
[浮城] 2024-08-23 16:53:00

是否可以使用 C# 从字符串生成条形码?

如果您想要一个可以创建您的 C# 条形码生成器您可以使用 IronOcr 在一行代码中输入所需的条形码类型。

// Create A Barcode in 1 Line of Code
BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.QRCode).SaveAsJpeg("QR.jpg");

结果可以导出为图像、位图、二进制数据、流、独立 HTML 图像标签、Data Uris、PDF 或 HTML。

如果您需要更高级的条形码、带徽标的 QR 码 - 这些也都受支持。

免责声明:我在 Iron Software 工作,该公司是 IronBarcode 的制造商

Is it possible to generate barcode from a string using c#?

If you want a C# barcode generator that can create your desired barcode type in a single line of code, you can use IronOcr.

// Create A Barcode in 1 Line of Code
BarcodeWriter.CreateBarcode("https://ironsoftware.com/csharp/barcode", BarcodeWriterEncoding.QRCode).SaveAsJpeg("QR.jpg");

The result can be exported as images, bitmaps, binary data, streams, stand-alone HTML image tag, Data Uris, PDFs or HTML.

If you need more advanced barcodes, QR Codes with logos - these are also supported.

Disclaimer: I work for Iron Software, makers of IronBarcode

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