标签: barcode

ZXing条码扫描仪意图:设置DecodeHintType.ASSUME_GS1

在我的应用程序中,我想扫描 GS1-128 条形码,并且需要从 ZXing 条形码扫描仪传递的 FNC1 字符。现在我只收到不带 FNC1 字符的纯文本。

有没有办法通过 Intent 将 DecodeHintType.ASSUME_GS1 传递给扫描仪应用程序?

我不想在我的应用程序中包含完整的扫描仪源代码,而是使用 Intent。

在扫描仪的源代码中,我可以看到需要设置 DecodeHintType 才能实现:https: //code.google.com/p/zxing/source/browse/trunk/core/src/main/java/com /google/zxing/oned/Code128Reader.java

 boolean convertFNC1 = hints != null && hints.containsKey(DecodeHintType.ASSUME_GS1);
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助。我几乎搜索了整个网络,但没有找到这个问题的答案。这让我发疯......

android barcode zxing android-intent gs1-128

4
推荐指数
1
解决办法
3498
查看次数

不规则线条条码打印

一位客户要求我为他们构建一个库存解决方案,他们可以为所有办公设备打印条形码标签,以便以各种方式跟踪它们。

他们给了我一台 Citizen CL-S621 打印机(203x203 dpi 分辨率)用于测试,然后(那是噩梦)配置其驱动程序以打印并将所有内容安装到他们给我测试的非标准标签上,这是我遇到的最大问题仍然遇到的问题是打印机无法以直线打印某些条形,而是以虚线/点线形式打印它们。

下面的 C# 代码显示了我如何使用此库构建条形码的基础知识:

public void CreateTheBarcode(string StringToEncode)
{
    Barcode b = new Barcode();
    b.LabelFont = new Font("Sample Bar Code Font", 24, FontStyle.Bold);
    b.IncludeLabel = true;
    b.Encode(BarcodeLib.TYPE.CODE128, StringToEncode, Color.Black, Color.White, 730, 140);
    b.SaveImage(@"C:\temp\Barcodes\"+StringToEncode+".png",SaveTypes.PNG);
    Print(@"C:\temp\Barcodes\"+StringToEncode+".png");
}

public static void Print(string FilePath)
{
    Process printJob = new Process();
    printJob.StartInfo.FileName = FilePath;
    printJob.StartInfo.UseShellExecute = true;
    printJob.StartInfo.Verb = "printto";
    printJob.StartInfo.CreateNoWindow = false;
    printJob.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
    printJob.StartInfo.Arguments = "\"" + "Citizen CL-S621" + "\"";
    printJob.StartInfo.WorkingDirectory = Path.GetDirectoryName(FilePath);
    printJob.Start(); …
Run Code Online (Sandbox Code Playgroud)

c# printing barcode barcode-printing

4
推荐指数
1
解决办法
6972
查看次数

ZXing.Net 解码条形码给出错误 - 无法从“System.Drawing.Bitmap”转换为“ZXing.LuminanceSource”

我正在使用ZXing.Net 0.16.4.0 解码保存在“wwwroot/qrr”文件夹中的二维码文件,但我收到编译时错误:

无法从“System.Drawing.Bitmap”转换为“ZXing.LuminanceSource”

我的代码:

string[] files = Directory.GetFiles("wwwroot/qrr");
foreach (string file in files)
{
    // create a barcode reader instance
    IBarcodeReader reader = new BarcodeReader();
    // load a bitmap
    var barcodeBitmap = (Bitmap)Image.FromFile("wwwroot/qrr/" + Path.GetFileName(file));

    // detect and decode the barcode inside the bitmap
    var result = reader.Decode(barcodeBitmap);
}
Run Code Online (Sandbox Code Playgroud)

错误出现在最后一行代码:

 var result = reader.Decode(barcodeBitmap);
Run Code Online (Sandbox Code Playgroud)

我的应用程序位于 ASP.NET Core 中,我正在使用官方文档代码,但它们不起作用。请帮忙?

更新

我注意到,当 ZXing 包添加到 ASP.NET Core 应用程序时,它的 ZXing.IBarcodeReader 缺少 Decode 重载方法:

IBarcodeReader 只有 2 个解码方法重载:

Result Decode(byte[] rawRGB, …
Run Code Online (Sandbox Code Playgroud)

c# qr-code barcode zxing asp.net-core

4
推荐指数
1
解决办法
5672
查看次数

调整条形码图像输出的大小

我正在尝试调整条形码输出的大小

import barcode
from barcode.writer import ImageWriter

bar_class = barcode.get_barcode_class('code128')
barcode = '1234567890'
writer=ImageWriter()
writer.set_options({module_width:2, module_height:2})
code128 = bar_class(barcode, writer)
code128.save('filename')
Run Code Online (Sandbox Code Playgroud)

我收到的错误是:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'module_width' is not defined
Run Code Online (Sandbox Code Playgroud)

我真的不明白如何使用这里找到的文档:https ://pythonhosted.org/pyBarcode/writers/index.html

python image barcode

4
推荐指数
2
解决办法
8949
查看次数

如何在python 3.7中生成条形码

我正在使用 python 3.7,为了生成条形码,我尝试使用pip install pyBarcode'. 但它显示以下错误:

找不到满足 pyBarcode 要求的版本(来自版本:)没有找到 pyBarcode 的匹配发行版

现在,我该如何安装pyBarcode我的 Python 版本?

python pip barcode

4
推荐指数
1
解决办法
2万
查看次数

java.io.FileNotFoundException:(只读文件系统)Mac

我有一个 SpringBoot 应用程序,我试图在其中测试条形码的生成,但出现此错误java.io.FileNotFoundException: (Read-only file system) Mac

\n\n

这是完成此任务的代码:

\n\n

pom.xml

\n\n
        <dependency>\n            <groupId>junit</groupId>\n            <artifactId>junit</artifactId>\n            <version>4.13</version>\n            <scope>test</scope>\n        </dependency>\n        <dependency>\n            <groupId>net.sf.barcode4j</groupId>\n            <artifactId>barcode4j</artifactId>\n            <version>2.1</version>\n        </dependency>\n
Run Code Online (Sandbox Code Playgroud)\n\n

Test Class

\n\n
public class FooTest extends TestCase {\n    @Test\n    public void testP() {\n        try {\n            Code128Bean bean = new Code128Bean();\n            final int dpi = 160;\n\n            //Configure the barcode generator\n            bean.setModuleWidth(UnitConv.in2mm(2.8f / dpi));\n\n            bean.doQuietZone(false);\n\n            //Open output file\n            File outputFile = new File("/" + "test" + ".JPG");\n\n            FileOutputStream out = new FileOutputStream(outputFile);\n\n            BitmapCanvasProvider canvas = …
Run Code Online (Sandbox Code Playgroud)

java spring file barcode fileoutputstream

4
推荐指数
1
解决办法
2万
查看次数

如何使用 Python 或 NodeJS 检测 EAN-13 +5 补充条形码

我正在尝试找到一种使用 Python 或 NodeJS 获取 UPC 加上 5 号补充条形码的方法。

到目前为止,我已经尝试通过此代码在 Python 中使用 pyzbar。

 img = Image.open(requests.get(url, stream=True).raw)
 img = ImageOps.grayscale(img)
 results = decode(img)
Run Code Online (Sandbox Code Playgroud)

这只返回主要的 UPC 代码。不是补充代码。

这是我试图从中读取的图像的示例。

在此输入图像描述

python barcode barcode-scanner node.js

4
推荐指数
1
解决办法
547
查看次数

为什么相同的数据条形码在视觉上看起来不同?

我遇到内容相同但原始字节不同的两个条形码之间的差异。一个条形码是使用名为 Labelary 的在线工具生成的,该工具专为创建 ZPL 标签而设计,另一个条形码是使用 ZXing 库在我的 Java 代码中生成的。尽管内容相同,但条形码的视觉外观有所不同。

我的条形码

我的条形码

原始文本: 12345678
原始字节: 69 0c 22 38 4e 2f 6a

BarcodeGenerator.java

public byte[] getBarCode128(String data, int width, int height) {
    Code128Writer writer = new Code128Writer();
    BitMatrix matrix = writer.encode(data, BarcodeFormat.CODE_128, width, height);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

    try {
        MatrixToImageWriter.writeToStream(matrix, "png", outputStream);
        return outputStream.toByteArray();
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}
Run Code Online (Sandbox Code Playgroud)

Main.java

public static void main(String[] args) {
    String data = "12345678";
        
    int width = (int) (data.length() …
Run Code Online (Sandbox Code Playgroud)

java barcode

4
推荐指数
1
解决办法
139
查看次数

QR码 - 我在哪里可以找到(免费)代码在网页上嵌入我自己的生成器?

无法从早期的问题中找到它,但我可能正在重复一个早期的问题,所以在前面道歉;-)

我正在寻找一个简单的代码来在我正在构建的网站上嵌入QR二维码生成器.我认为他们应该是一些免费的开源代码,但我只能找到付费软件.

谁能指出我正确的方向?我会非常感激!

最好的祝福,

Robbert

qr-code barcode

3
推荐指数
1
解决办法
4664
查看次数

C#条码扫描器和具有更改事件的文本框

所以我有条码扫描器和带有更改文本事件的文本框。我正在尝试做的是,当用户扫描代码时,它进入文本框,之后我有了执行某些SQL的代码(工作正常)。问题是由于文本事件更改,texbox仅接受代码的第一个字符,而不接受整个字符串。

我想拥有它,因为那样的话,用户无需按任何其他按钮即可插入产品。我试图捕获条形码,将其保存为字符串,但这也行不通。

有没有办法解决 ?

c# textbox barcode

3
推荐指数
2
解决办法
8810
查看次数