IRONSOFTWAREHOME
VIDEOLAR

Dynamsoft Barkod Okuyucu'dan IronBarcode'a Geçiş

Curtis Chau
Curtis Chau
Updated: 1 Ağustos 2026

Dynamsoft Barkod Okuyucu'dan IronBarcode'a göç eden çoğu geliştirici iki gruptan birine düşer: İyi duyulmuş bir itici olan Dynamsoft'u seçenler ve daha sonra kamera merkezli API'nin bir belge işleme kullanım senaryosuna uygun olmadığını keşfedenler ve lisans sunucusu bağımlılığının üretim olaylarına neden olduğu hava boşluklu veya Docker ortamlarında çalışanlar.

İlk gruptaysanız, geçiş, harici PDF görüntüleme kütüphanesini, sayfa başına render döngüsünü ve hata kodu lisans modelini kaldırır. Eğer ikinci grupta yer alıyorsanız, geçiş işlemi InitLicense ağ çağrısını, çevrimdışı lisans-içerik paketini ve yenileme döngüsünü ve dışa giden ağ politikasını Docker veya VPC yapılandırmanızdan kaldırır. Her iki durumda da, kod tabanı bu geçişten sonra daha kısa olur.

Bu kılavuz, kaybettiklerinizle ilgili dürüsttür: eğer uygulamanız gerçek zamanlı kamera karelerini işliyorsa, Dynamsoft'un Capture Vision iş hattı bu iş yükü için ayarlanmıştır ve IronBarcode doğru bir yedek değildir. Bu geçiş kılavuzu, sunucu tarafı dosya işleme, belge iş akışları ve lisans sunucusu erişiminin bir sorun olduğu ortamlara yöneliktir.

Adım 1: NuGet Paketlerini Değiştirin

dotnet remove package Dynamsoft.DotNet.BarcodeReader.Bundle
dotnet add package BarCode
SHELL

Projenize yalnızca Dynamsoft için eklenmiş bir PDF görüntüleme kütüphanesi varsa (PdfiumViewer en yaygın olanıdır), o da kaldırılabilir:

# Remove if added only for Dynamsoft PDF support
dotnet remove package PdfiumViewer
dotnet remove package PdfiumViewer.Native.x86_64.v8-xfa
SHELL

Adım 2: Lisans Başlatmayı Değiştirin

İlk basitleşmenin gerçekleştiği yer burasıdır. Dynamsoft modeli, her başlangıçta bir hata kodu kontrolü ve istisna yönetimi gerektirir:

Önce — Dynamsoft:

using Dynamsoft.License;
using Dynamsoft.Core;

// Must run before any barcode operations
int errorCode = LicenseManager.InitLicense("YOUR-DYNAMSOFT-KEY", out string errorMsg);
if (errorCode != (int)EnumErrorCode.EC_OK)
    throw new InvalidOperationException($"License validation failed [{errorCode}]: {errorMsg}");

Sonrası — IronBarcode:

// NuGet: dotnet add package BarCode
using IronBarCode;

// Local validation — no network call, no error code
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

Bir ASP.NET Core uygulamasında, bunu Program.cs öncesinde builder.Build() içerisine ekleyin:

IronBarCode.License.LicenseKey = Environment.GetEnvironmentVariable("IRONBARCODE_KEY")
    ?? "YOUR-LICENSE-KEY";

Bir Docker veya Kubernetes ortamında, dağıtım manifestosunda IRONBARCODE_KEY ortam değişkenini ayarlayın. Dışa giden ağ kuralları gerekli değildir.

Adım 3: Ad Alanı İthalatlarını Değiştirin

Tüm kaynak dosyaları genelinde bul ve değiştir:

grep -r "using Dynamsoft\." --include="*.cs" .
SHELL

Her oluşumu değiştirin:

// Before
using Dynamsoft.CVR;
using Dynamsoft.DBR;
using Dynamsoft.License;
using Dynamsoft.Core;

// After
using IronBarCode;

Kod Göç Örnekleri

Temel Dosya Okuma

En temel işlem — bir resim dosyasından barkod okuma.

Önce — Dynamsoft:

using Dynamsoft.CVR;
using Dynamsoft.DBR;

public string ReadBarcodeFromFile(CaptureVisionRouter router, string imagePath)
{
    CapturedResult result = router.Capture(imagePath, PresetTemplate.PT_READ_BARCODES);
    BarcodeResultItem[] items = result.GetDecodedBarcodesResult()?.GetItems();
    if (items == null || items.Length == 0)
        return null;

    return items[0].GetText();
}

Sonrası — IronBarcode:

// NuGet: dotnet add package BarCode
using IronBarCode;

public string ReadBarcodeFromFile(string imagePath)
{
    var results = BarcodeReader.Read(imagePath);
    return results?.FirstOrDefault()?.Value;
}

Yönlendirici örneği yok oldu. BarcodeReader.Read statiktir. BarcodeResultItem.GetText(), .Value olur. LINQ ile results üzerindeki null kontrolü daha temizdir.

Birden Fazla Barkod Okuma

Önce — Dynamsoft:

using Dynamsoft.CVR;
using Dynamsoft.DBR;

public List<string> ReadAllBarcodes(CaptureVisionRouter router, string imagePath)
{
    SimplifiedCaptureVisionSettings settings = router.GetSimplifiedSettings(
        PresetTemplate.PT_READ_BARCODES);
    settings.BarcodeSettings.ExpectedBarcodesCount = 0; // 0 = find all
    router.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings);

    CapturedResult result = router.Capture(imagePath, PresetTemplate.PT_READ_BARCODES);
    BarcodeResultItem[] items = result.GetDecodedBarcodesResult()?.GetItems();
    var values = new List<string>();

    if (items != null)
    {
        foreach (var item in items)
            values.Add(item.GetText());
    }

    return values;
}

Sonrası — IronBarcode:

using IronBarCode;

public List<string> ReadAllBarcodes(string imagePath)
{
    var options = new BarcodeReaderOptions
    {
        ExpectMultipleBarcodes = true,
        MaxParallelThreads = 4
    };

    return BarcodeReader.Read(imagePath, options)
        .Select(r => r.Value)
        .ToList();
}

Baytlardan Okuma (Bellek İçi Görüntüler)

Önce — Dynamsoft:

using Dynamsoft.CVR;
using Dynamsoft.Core;
using Dynamsoft.DBR;

// Requires width, height, stride, and pixel format — low-level buffer API
public string ReadFromBuffer(CaptureVisionRouter router, byte[] rawPixels, int width, int height)
{
    var imageData = new ImageData
    {
        Bytes = rawPixels,
        Width = width,
        Height = height,
        Stride = width * 3, // assuming 24bpp RGB
        Format = EnumImagePixelFormat.IPF_RGB_888
    };

    CapturedResult result = router.Capture(imageData, PresetTemplate.PT_READ_BARCODES);
    return result.GetDecodedBarcodesResult()?.GetItems()?.FirstOrDefault()?.GetText();
}

Sonrası — IronBarcode:

using IronBarCode;

// Pass PNG/JPEG/BMP bytes directly — no pixel format or stride calculation
public string ReadFromImageBytes(byte[] imageBytes)
{
    return BarcodeReader.Read(imageBytes)?.FirstOrDefault()?.Value;
}

Uygulamanız daha önce Dynamsoft için resim baytlarını ham piksel tamponuna dönüştürdüyse, kod çözüp ham piksellere dönüştürmeden önce özgün kodlanmış resim baytlarını (PNG, JPEG, BMP) doğrudan IronBarcode'a geçebilirsiniz.

PDF Barkod Okuma — Döngü Renderini Kaldırın

Bu genellikle geçişte en büyük kod azaltımıdır. Tüm PdfiumViewer render döngüsünü kaldırın ve tek bir çağrı ile değiştirin.

Önce — Dynamsoft ve PdfiumViewer ile:

// Requires: Dynamsoft.DotNet.BarcodeReader.Bundle + PdfiumViewer + PdfiumViewer.Native.*
using Dynamsoft.CVR;
using Dynamsoft.DBR;
using PdfiumViewer;
using System.Drawing.Imaging;

public List<string> ReadBarcodesFromPdf(CaptureVisionRouter router, string pdfPath)
{
    var allBarcodes = new List<string>();

    using (var pdfDoc = PdfDocument.Load(pdfPath))
    {
        for (int page = 0; page < pdfDoc.PageCount; page++)
        {
            using var image = pdfDoc.Render(page, 300, 300, true);
            using var ms = new MemoryStream();
            image.Save(ms, ImageFormat.Png);

            CapturedResult result = router.Capture(ms.ToArray(),
                PresetTemplate.PT_READ_BARCODES);
            var items = result.GetDecodedBarcodesResult()?.GetItems();
            if (items != null)
            {
                foreach (var item in items)
                    allBarcodes.Add(item.GetText());
            }
        }
    }

    return allBarcodes;
}

Sonrası — IronBarcode:

using IronBarCode;

public List<string> ReadBarcodesFromPdf(string pdfPath)
{
    return BarcodeReader.Read(pdfPath)
        .Select(r => r.Value)
        .ToList();
}

Sayfa döngüsü, PdfDocument, 300 DPI render aşaması, MemoryStream ve her sayfa için Capture çağrısı hepsi kaybolur. IronBarcode PDF sayfalarını dahili olarak işler.

Seçenekli PDF'den okumak mı gerekiyor (yoğun veya zor barkodlar için):

using IronBarCode;

public List<string> ReadBarcodesFromPdfAccurate(string pdfPath)
{
    var options = new BarcodeReaderOptions
    {
        Speed = ReadingSpeed.Balanced,
        ExpectMultipleBarcodes = true
    };

    return BarcodeReader.Read(pdfPath, options)
        .Select(r => r.Value)
        .ToList();
}

Çevrimdışı / Hava Aralıklı Dağıtım

Mevcut kodunuzda çevrimdışı lisanslama deseni varsa, tamamen kaldırın:

Önce — Dynamsoft çevrimdışı lisansı:

using Dynamsoft.License;
using Dynamsoft.Core;

// Dynamsoft offline: fetch license bundle on a connected machine, persist it,
// then replay it on the offline machine via InitLicenseFromLicenseContent.
int errorCode = LicenseManager.InitLicenseFromLicenseContent(
    licenseContent,
    out string errorMsg);

if (errorCode != (int)EnumErrorCode.EC_OK)
    throw new InvalidOperationException($"Offline license failed: {errorMsg}");

Sonrası — IronBarcode:

// Remove all of the above. Replace with:
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";

Alınacak ve yenilenecek lisans-içerik paketi yok. Bağlı makine önyükleme adımı yok. Anahtar yerel olarak doğrulanır.

Docker Yapılandırması

Eğer daha önce Dynamsoft'un lisans uç noktalarına dışa yönelik HTTPS'e izin vermek için ağ çıkış kuralları veya proxy konfigürasyonu yaptıysanız:

# Before: Docker or Kubernetes egress policy
# Required: Allow outbound HTTPS to Dynamsoft licence endpoints

# After: Remove that egress rule.
# IronBarcode does not require outbound network access for license validation.

# Set license via environment variable
env:
  - name: IRONBARCODE_KEY
    valueFrom:
      secretKeyRef:
        name: ironbarcode-license
        key: key
Text

Örnek Yönetimi Temizleme

Dynamsoft, CaptureVisionRouter tabanlı bir örnek API kullanır. Kodunuzda hizmet sınıflarında, alan başlatıcılarında veya DI kayıtlarında yönlendirici örnekleri oluşturuyorsa, tümü kaybolur:

Önce — Dynamsoft örnek yönetimi:

using Dynamsoft.CVR;
using Dynamsoft.DBR;
using Dynamsoft.License;
using Dynamsoft.Core;

public class BarcodeService : IDisposable
{
    private readonly CaptureVisionRouter _router;

    public BarcodeService()
    {
        int errorCode = LicenseManager.InitLicense("KEY", out string errorMsg);
        if (errorCode != (int)EnumErrorCode.EC_OK)
            throw new InvalidOperationException(errorMsg);

        _router = new CaptureVisionRouter();

        var settings = _router.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES);
        settings.BarcodeSettings.ExpectedBarcodesCount = 0;
        _router.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings);
    }

    public string[] ReadFile(string path)
    {
        CapturedResult result = _router.Capture(path, PresetTemplate.PT_READ_BARCODES);
        var items = result.GetDecodedBarcodesResult()?.GetItems();
        return items?.Select(i => i.GetText()).ToArray() ?? Array.Empty<string>();
    }

    public void Dispose()
    {
        _router?.Dispose();
    }
}

Sonra — IronBarcode statik API:

// NuGet: dotnet add package BarCode
using IronBarCode;

public class BarcodeService
{
    // No constructor initialization — license set once at app startup
    // No Dispose — no instance to clean up

    public string[] ReadFile(string path)
    {
        var options = new BarcodeReaderOptions { ExpectMultipleBarcodes = true };
        return BarcodeReader.Read(path, options)
            .Select(r => r.Value)
            .ToArray();
    }
}

Sınıf, yapıcısını, IDisposable uygulamasını ve _router alanını kaybeder. Bu hizmet, DI içinde bir singleton veya yaşam döngüsü hizmeti olarak kaydedilmişse, bu kayıt basitleştirilebilir veya hizmet bir dizi statik metoda dönüşebilir.

Okuma Hızı vs Zaman Aşımı Eşleme

Dynamsoft, kamera kare hızları için optimize edilmiş milisaniyeler cinsinden bir Timeout kullanır. IronBarcode bir ReadingSpeed enum kullanır:

Dynamsoft ayarıIronBarcode eşdeğeri
settings.Timeout = 100 (kamera hattı)Speed = ReadingSpeed.Faster
Düşük zaman aşımı (hız öncelikli)Speed = ReadingSpeed.Balanced
Daha yüksek zaman aşımı (doğruluk öncelikli)Speed = ReadingSpeed.Detailed
Maksimum doğruluk, zaman baskısı yokSpeed = ReadingSpeed.ExtremeDetail

İş hacminin 100ms altındaki yanıt süresinden daha önemli olduğu çoğu belge işleme iş akışları için, ReadingSpeed.Balanced doğru varsayılandır:

var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true,
    MaxParallelThreads = 4
};

Yaygın Geçiş Sorunları

BarcodeResultItem.GetText() vs result.Value

Erişim yöntemi bir özellikten değiştirilmiştir:

// Before
string value = item.GetText();

// After
string value = result.Value;

BarcodeResultItem.GetFormatString() vs result.Format

Dynamsoft formatı GetFormatString() üzerinden bir string olarak döndürür. IronBarcode bunu BarcodeEncoding enum olarak result.Format üzerindeki bir enum olarak sunar:

// Before
if (item.GetFormatString() == "QR_CODE")
    Console.WriteLine("Found QR code");

// After
if (result.Format == BarcodeEncoding.QRCode)
    Console.WriteLine("Found QR code");

// For logging without enum comparison — .ToString() works on both
Console.WriteLine($"Format: {result.Format}");

Null Sonuçlar vs Boş Koleksiyon

Dynamsoft'un GetDecodedBarcodesResult()'i, barkod bulunamadığında null döndürebilir. IronBarcode boş bir koleksiyon döndürür. Null kontrollerini güncelleyin:

// Before: null check required
CapturedResult result = router.Capture(path, PresetTemplate.PT_READ_BARCODES);
var items = result.GetDecodedBarcodesResult()?.GetItems();
if (items != null && items.Length > 0)
    Process(items[0].GetText());

// After: null-safe but also correct to check Count
var results = BarcodeReader.Read(path);
if (results.Any())
    Process(results.First().Value);

SimplifiedCaptureVisionSettings to BarcodeReaderOptions

GetSimplifiedSettings / UpdateSettings deseni Read'e geçerken BarcodeReaderOptions olur:

// Before
var settings = router.GetSimplifiedSettings(PresetTemplate.PT_READ_BARCODES);
settings.BarcodeSettings.ExpectedBarcodesCount = 0;
settings.Timeout = 500;
router.UpdateSettings(PresetTemplate.PT_READ_BARCODES, settings);
var result = router.Capture(path, PresetTemplate.PT_READ_BARCODES);

// After
var options = new BarcodeReaderOptions
{
    Speed = ReadingSpeed.Balanced,
    ExpectMultipleBarcodes = true
};
var results = BarcodeReader.Read(path, options);

Geçiş Kontrol Listesi

Güncellenmesi gereken tüm Dynamsoft referanslarını bulmak için bu aramaları gerçekleştirin:

grep -r "using Dynamsoft\." --include="*.cs" .
grep -r "LicenseManager.InitLicense\|EnumErrorCode\|EC_OK" --include="*.cs" .
grep -r "new CaptureVisionRouter\|router\.Capture\|PresetTemplate" --include="*.cs" .
grep -r "BarcodeResultItem\|GetDecodedBarcodesResult\|GetFormatString" --include="*.cs" .
grep -r "GetSimplifiedSettings\|UpdateSettings\|SimplifiedCaptureVisionSettings" --include="*.cs" .
grep -r "router\.Dispose\|InitLicenseFromLicenseContent" --include="*.cs" .
SHELL

Her bir eşleşme üzerinde çalışın:

  • using Dynamsoft.*using IronBarCode
  • LicenseManager.InitLicense(key, out errorMsg) + hata kontrolü → IronBarCode.License.LicenseKey = "key"
  • new CaptureVisionRouter() → kaldır (statik API, örnek yok)
  • router.Capture(path, PresetTemplate.PT_READ_BARCODES)BarcodeReader.Read(path)
  • router.Capture(imageData, ...) (ham piksel tamponu) → BarcodeReader.Read(imageBytes)
  • Sayfa başına PDF işleme döngüsü + router.Capture(pageBytes, ...)BarcodeReader.Read(pdfPath)
  • BarcodeResultItem.GetText()result.Value
  • BarcodeResultItem.GetFormatString()result.Format
  • GetSimplifiedSettings(...) + UpdateSettings(...)new BarcodeReaderOptions { ... }
  • router.Dispose() → kaldır
  • LicenseManager.InitLicenseFromLicenseContent(...) → tamamen kaldır
  • PdfiumViewer NuGet paketlerini yalnızca Dynamsoft PDF işleme desteği için eklediyseniz kaldırın
  • Docker/Kubernetes ağ çıkıs kurallarını Dynamsoft lisans uç noktaları için kaldır
  • Dağıtım yapılandırmasında IRONBARCODE_KEY ortam değişkenini ayarla
Curtis Chau
Teknik Yazar

Curtis Chau, Bilgisayar Bilimleri alanında Lisans Derecesine (Carleton Üniversitesi) sahip ve Node.js, TypeScript, JavaScript ve React konularında uzmanlaşmış ön uç geliştirmeyle ilgileniyor. Sezgisel ve estetik açıdan hoş kullanıcı arayüzleri oluşturma tutkunu, Curtis modern çerçevelerle çalışmayı ve iyi yapılandırılmış, görsel olarak çekici kılavuzlar oluşturmayı seviyor.

...
Daha Fazla Oku

İlgili Makaleler

Key in blue circle

Ücretsiz 30 günlük Deneme Anahtarınızı anında edinin.

Your trial license will be sent to your email address

Herhangi bir sınırlama yoktur. %100 erişim. Kredi kartı gerekmez.

bullet_checkedKredi kartı veya hesap oluşturma gerektirmezHerhangi bir sınırlama yoktur. %100 erişim. Kredi kartı gerekmez.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Ücretsiz Canlı Demo rezervasyonu yapın
Booking Badge

Dünya Çapında Milyonlarca Mühendisin Güvendiği

Iron Software müşteri logoları
Bağımsız Danışmanlık Alın
Aşağıdaki formu doldurun veya sales@ironsoftware.com adresine e-posta gönderin
Bilgileriniz daima gizli kalacaktır.
Dünya Çapında Milyonlarca Mühendisin Güvendiği
Iron Software müşteri logoları
Ücretsiz 30 Günlük Deneme Anahtarınızı anında alın.
Kredi kartı veya hesap oluşturma gerektirmez