此标记应用于有关如何在程序中生成,解码或使用条形码的问题。
我正在尝试使用 dart 从条形码中获取公司前缀: 字符串 extractCompanyPrefix(字符串 gtin) { // 确保 GTIN 是一个字符串,用于处理前导零并执行字符串操作 ...
我正在尝试使用 dart 从条形码中获取公司前缀: 字符串 extractCompanyPrefix(字符串 gtin) { // 确保 GTIN 是一个字符串,用于处理前导零并执行字符串操作 ...
仅使用 Excel VBA 生成带有控制字符/转义序列的 2D 条形码
我昨天发布了一个问题,诚然缺乏一些细节。为了遵循评论的建议,这里尝试做得更好: 我想生成允许
我浏览了他们的文档,一开始发现它有点让人不知所措。我知道您可以通过输入 UPC(一维条形码下方的数字)来搜索商品,但我找不到任何关于我的词...
有人知道如何从 Base64 编码值反向创建条形码吗?这是因为我无法访问真正的许可证,我只是获得了一些创建的 Base64 值的示例...
为什么当我尝试打印时,我的条码图像不适合条码打印机设置中指定的纸张尺寸?
我正在使用 Zen Barcode Rendering Framework 在 C# Windows 窗体应用程序中创建条形码。我有两个文本框(一个用于条形码本身,一个用于我希望它成为主要内容的相关文本...
我必须使用flutter开发一个移动应用程序。该应用程序要求用户扫描条形码,不是使用手机的摄像头,而是使用嵌入手机顶部的条形码。是...
为什么条码扫描器会在 Chrome 中打开 Chrome 开发者控制台?
我刚买了一个来自中国的条码阅读器,型号为Honeywell HH400。当我在其他设备上使用它时,它工作得很好。但现在我在我的网络应用程序中使用它,但遇到了问题。它总是切换 C...
我正在做一个项目,我需要生成和读取“pharmacode”。我可以使用条形码生成器库生成“pharmacode”吗? 如果是,请向我推荐任何免费的条形码
当我使用 Android 应用程序扫描内华达州驾驶执照背面条形码 pdf417 时,我得到不可读的数据。 @<0xA><0x1E><0xD>ANSI 636049030002DL00410466ZN05070057DLDCABCDE<0xA>
我一直在努力完成这件事,但过去几天没有成功。我正在尝试在移动设备顶部添加一个方形框覆盖层(如果它也可以包含 2 个按钮,那就太好了)...
找不到我.dm7.barcodescanner:zbar:1.9.13
我想在我的 android studio 应用程序中使用这个库 https://github.com/dm77/barcodescanner。我按照上述步骤进行操作,例如将库添加到 build.gradle 文件中并添加 jcenter() 但仍然...
在java中使用selenium Webdriver、appium测试条形码的自动化
我们有一个新的要求,我们想要自动化条形码来测试我们的应用程序,我们计划使用 selenium Webdriver、Appium 和 java。 你能分享一下其他插件吗
我有一个 django 项目,我用它来创建库存管理系统。我有一个 html 网站,其中显示产品说明。它还应该显示生成的条形码图像...
我有一个条形码阅读器,可以将学生卡上的条形码读取到未绑定的访问表单字段中。条形码是英文数字的文本。问题是有时条形码阅读器读取正常......
我正在尝试学习如何扫描和读取一维和二维条形码中的编码数据。 ISO/IEC 15418 似乎非常详细地详细介绍了我有兴趣阅读的数据。不幸的是,具体...
Chrome ShapeDetetion API BarcodeDetector 适用于 javascript,但不适用于 typescript
我想在 Angular 应用程序中实现 BarcodeDetector。我使用以下代码测试了 API: HTML: <p>我想在 Angular 应用程序中实现 <a href="https://web.dev/shape-detection/#barcodedetector" rel="nofollow noreferrer">BarcodeDetector</a>。我使用以下代码测试了 API:</p> <p>HTML:</p> <pre><code><!DOCTYPE html> <html lang="en"> <head> <script src="./script.js"></script> </head> <body> <button onclick="scan()">Click me</button> <img src="./barcode.gif"> <pre></pre> </body> </html> </code></pre> <p>JavaScript:</p> <pre><code>function scan() { const images = document.querySelectorAll('img'); const pres = document.querySelectorAll('pre'); try { pres[0].textContent += 'started\n'; let barcodeDetector = new BarcodeDetector(); pres[0].textContent += 'created and detecting\n'; barcodeDetector.detect(images[0]).then(detectedCodes => { for (const barcode of detectedCodes) { pres[0].textContent += barcode.rawValue + '\n'; }}).catch((e) => { pres[0].textContent += e + '\n'; }); } catch (e) { pres[0].textContent += e + '\n'; } } </code></pre> <p>而且效果很好。在 PC 上,当我在手机上打开页面时,出现 <pre><code>NotSupported</code></pre> 错误和解码的条形码。</p> <p>由于 TypeScript 是 JavaScript 的超集,我认为移植代码应该非常简单,但显然事实并非如此。 Angular 应用程序中的 HTML 几乎相同。组件代码如下: </p> <pre><code>var BarcodeDetector: any; @Component({ templateUrl: './index.component.html' }) export class IndexComponent { @ViewChild('imgRef') image: ElementRef; hasBarcodeDetector = ''; errors = ''; scanData = ''; constructor() { try { this.hasBarcodeDetector = 'BarcodeDetector' in window ? 'true' : 'false'; const barcodeDetector = new BarcodeDetector(); barcodeDetector.detect(this.image.nativeElement).then(detectedCodes => { for (const barcode of detectedCodes) { this.scanData += barcode.rawValue + '\n'; } }); } catch (e) { this.errors = e; } } } </code></pre> <p>检查探测器是否存在有效,因为我得到 <pre><code>true</code></pre>,但在 PC 和移动设备上我都收到以下错误:</p> <pre><code>TypeError: (void 0) is not a constructor </code></pre> <p>我猜这与解码器的声明有关,但我真的不知道该怎么做。</p> </question> <answer tick="false" vote="0"> <p>我认为你的变量不小心覆盖了<pre><code>window.BarcodeDetector</code></pre>。另请注意,您没有使用特征检测的结果。顺便说一句,特征检测现在应该以不同的方式进行,正如最近更新的<a href="https://web.dev/shape-detection/#featuredetection" rel="nofollow noreferrer">文章</a>中所述:</p> <pre><code>await BarcodeDetector.getSupportedFormats(); /* On a macOS computer logs [ "aztec", "code_128", "code_39", "code_93", "data_matrix", "ean_13", "ean_8", "itf", "pdf417", "qr_code", "upc_e" ] */ </code></pre> <p>这允许您检测您需要的特定功能,例如二维码扫描:</p> <pre><code>if (('BarcodeDetector' in window) && ((await BarcodeDetector.getSupportedFormats()).includes('qr_code'))) { console.log('QR code scanning is supported.'); } </code></pre> </answer> <answer tick="false" vote="0"> <p>我遇到了同样的问题,花了我一些时间。可能不是绝对完美,但以下内容对我有用。</p> <p>我希望在这两种情况下都支持扫描,因为这仅适用于 Mac、Android 和 Chrome 操作系统。</p> <p>希望有帮助!我很感激任何反馈。</p> <pre><code><div *ngIf="hasBarcodeDetectorApi" else useWindowsScanning> <video id="player" #player></video> <div>{{consoleMessage}}</div> </div> <ng-template #useWindowsScanning> <mso-camera-scan (scanEvent)="onScanNumber($event)" (cameraError)="onCameraError()"></mso-camera-scan> </ng-template> </code></pre> <p>我的完整组件,因为即使读取条形码也需要一点努力</p> <pre><code>import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, OnDestroy, OnInit, Output, ViewChild } from '@angular/core'; import { BarcodeDetectorApi, BarcodeDetectorOptions } from './barcode.model'; import { SubSink } from 'subsink'; import { concatMap, from, timer } from 'rxjs'; // declare keyword tells browser it is defined elsewhere, which is how this works // I'd like to move to the barcode.model file, but compile issues that would take time to figure // eslint-disable-next-line @typescript-eslint/naming-convention, no-var export declare var BarcodeDetector: typeof BarcodeDetectorApi; @Component({ selector: 'mso-barcode-detector', templateUrl: './barcode-detector.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class BarcodeDetectorComponent implements OnInit, AfterViewInit, OnDestroy { @Output() scanEvent = new EventEmitter<string>(); @Output() cameraError = new EventEmitter<void>(); @ViewChild('player', { static: false }) player: ElementRef<HTMLVideoElement>; hasBarcodeDetectorApi = false; barcodeDetector: BarcodeDetectorApi; consoleMessage: string; private subsink = new SubSink(); private mediaStream: MediaStream = null; constructor() { if (!!window['BarcodeDetector']) { /* BarcodeDetector API only available on Mac, Android, and Chrome OS as of this note If you are on Windows then return and use a backup method of checking for barcodes */ this.hasBarcodeDetectorApi = true; } } ngOnInit(): void { if (!this.hasBarcodeDetectorApi) { return; } console.log('Using BarcodeDetector API'); const options = {} as BarcodeDetectorOptions; options.formats = ['code_128']; this.barcodeDetector = new BarcodeDetector(options); } ngAfterViewInit(): void { if (!this.hasBarcodeDetectorApi) { return; } const constraints = { video: { facingMode: 'environment', }, } as MediaStreamConstraints; navigator.mediaDevices.getUserMedia(constraints).then((stream) => { // Attach the video stream to the video element and autoplay. this.player.nativeElement.srcObject = stream; this.mediaStream = stream; this.player.nativeElement.play().then(() => { this.startListeningToBarcodes(); }); }); } ngOnDestroy(): void { if (this.mediaStream) { this.player.nativeElement.pause(); this.mediaStream.getTracks().forEach(x => x.stop()); } this.subsink.unsubscribe(); } onScanNumber(barcode: string): void { this.scanEvent.emit(barcode); } onCameraError(): void { this.cameraError.emit(); } private startListeningToBarcodes(): void { /* Now that we've started the video we need to check for a barcode in intervals as the detect function checks exactly once when you call it We want to continue to check until we find a valid barcode */ this.subsink.sink = timer(250, 500).pipe( concatMap(() => from(this.barcodeDetector .detect(this.player.nativeElement) .then((barcodes) => { if (barcodes.length === 0) { return; } console.log(`found ${barcodes.length} barcodes`); barcodes.forEach((barcode) => { console.log(barcode.rawValue); this.onScanNumber(barcode.rawValue); }); }) .catch((err) => { this.consoleMessage = err; console.log(err); this.onCameraError(); })))) .subscribe(); } } </code></pre> <p>最后,让它发挥作用的模型</p> <pre><code>// cheating by defining what it would look like, no implementation // interface doesn't like to define constructor or static very easily export class BarcodeDetectorApi { static getSupportedFormats(): Promise<BarcodeFormat[]> { throw new Error('not implemented'); } constructor(barcodeDetectorOptions?: BarcodeDetectorOptions) { } detect(image: ImageBitmapSource): Promise<DetectedBarcode[]> { throw new Error('not implemented'); } } export interface BarcodeDetectorOptions { formats?: Array<BarcodeFormat>; }; export interface Point2D { x: number; y: number; }; export interface DetectedBarcode { boundingBox: DOMRectReadOnly; rawValue: string; format: BarcodeFormat; cornerPoints: ReadonlyArray<Point2D>; }; export type BarcodeFormat = 'aztec' | 'code_128' | 'code_11' | 'code_39' | 'code_93' | 'codabar' | 'data_matrix' | 'ean_13' | 'ean_8' | 'itf' | 'pdf417' | 'qr_code' | 'micro_qr_code' | 'maxi_code' | 'upc_a' | 'upc_e' | 'gs1_composite' | 'gs1_databar' | 'gs1_databar_expanded' | 'gs1_databar_expanded_stacked' | 'gs1_databar_limited' | 'gs1_databar_omnidirectional' | 'gs1_databar_stacked' | 'gs1_databar_stacked_omnidirectional' | 'gs1_databar_truncated' | 'unknown'; </code></pre> </answer> </body></html>
我开发了一个 Android 应用程序,在处理输入图像期间使用 chaquopy 运行 easyocr 和 pyzbar 模块。该应用程序的目标是能够提取文本并解码条形码...
用于在 iOS 中扫描条形码(代码 39 格式)的免费 SDK
我想使用iphone/ipad的相机扫描Code 39格式的VIN条形码。我尝试了 zxing 和 zbar,但它们效果不佳。大多数时候他们无法识别条形码。任何人都可以...
我是一名新的 iOS 开发人员。我想知道如何在 Swift 中生成条形码。 我已经有了代码,有多种资源可以学习如何读取条形码,但我没有找到...