Sistem Çizim Nesnelerinden Barkodları Nasıl Okursunuz
Cloudmersive Barcode API'den IronBarcode'a Geçiş
Bu, .NET barkod tarihindeki en basit geçiştir. HTTP istemcisini kaldırın. Bir NuGet paketi ekleyin. API anahtarı yönetimini silin. Gerisi bir bul-ve-değiştir işlemi.
Cloudmersive'ın .NET SDK'si, HttpClient çağrılarının etrafında ince bir sarmalayıcı olan oluşturulmuş bir REST API istemcisidir. Uygulamanızdaki Cloudmersive'a özgü her kod parçası, o istemci için ya yapılandırmadır ya da ağ istekleri başarısız olduğunda meydana gelen hata yönetimidir. IronBarcode ile bu altyapının hiçbirine ihtiyaç yok. Barkodları yerel olarak işlemekte ve ağa bağımlı değildir.
Kısa Başlangıç: Üç Adım
Adım 1: Paketleri Değiştirin
dotnet remove package Cloudmersive.APIClient.NET.Barcode
dotnet add package BarCode
dotnet remove package Cloudmersive.APIClient.NET.Barcode
dotnet add package BarCode
Adım 2: Ad Alanlarını Değiştirin
// Remove these
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
// Add this
using IronBarCode;
// Remove these
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
// Add this
using IronBarCode;
Imports IronBarCode
Adım 3: API Anahtarı Kurulumunu Lisans Anahtarı ile Değiştirin
// Remove this
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
// Replace with this — set once at application startup
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// Remove this
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
// Replace with this — set once at application startup
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
' Remove this
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY")
' Replace with this — set once at application startup
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
Bir ASP.NET Core uygulamasında, lisans anahtarı Program.cs içine builder.Build()'dan önce yerleştirilir:
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
var builder = WebApplication.CreateBuilder(args);
// ... rest of startup
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
var builder = WebApplication.CreateBuilder(args);
// ... rest of startup
Imports IronBarCode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim builder = WebApplication.CreateBuilder(args)
' ... rest of startup
Maliyet: Önceki Harcamalarınıza Karşı Ne Harcayacaksınız
Geçişten önce, Cloudmersive entegrasyonunun aslında ne kadara mal olduğunu hesaplamak faydalı olur. Matematik basit:
| Günlük Hacminiz | Aylık İstekler | Cloudmersive Seviyesi | IronBarcode (tek seferlik) |
|---|---|---|---|
| 100/gün | ~3.000 | Temel $19.99/ay | $749 |
| 1.000/gün | ~30.000 | İşletme Premier $99.99/ay | $749 |
| 5.000/gün | ~150.000 | Orta İşletme $499.99/ay | $749 |
| 10.000/gün | ~300.000 | Kurumsal (özel) | $749 |
| 25.000/gün | ~750.000 | Kurumsal (özel) | 1.499$ (Plus, 3 dev) |
Cloudmersive için ayda ~63 $ 'dan fazla ödüyorsanız, IronBarcode'un Lite lisansı kendini ilk yıl içinde öder. Karşılaşma noktasından sonra, IronBarcode yenilenme ve talep başına ücret olmadan bir süresiz lisansdır.
Kod Göç Örnekleri
QR Kod Oluşturma
En yaygın Cloudmersive üretim çağrısı doğrudan IronBarcode ile eşleşir:
Öncesi (Cloudmersive):
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
var apiInstance = new GenerateBarcodeApi();
byte[] result = apiInstance.GenerateBarcodeQRCode("https://example.com");
File.WriteAllBytes("qr.png", result);
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
var apiInstance = new GenerateBarcodeApi();
byte[] result = apiInstance.GenerateBarcodeQRCode("https://example.com");
File.WriteAllBytes("qr.png", result);
Imports Cloudmersive.APIClient.NET.Barcode.Api
Imports Cloudmersive.APIClient.NET.Barcode.Client
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY")
Dim apiInstance As New GenerateBarcodeApi()
Dim result As Byte() = apiInstance.GenerateBarcodeQRCode("https://example.com")
File.WriteAllBytes("qr.png", result)
Sonrası (IronBarcode):
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
byte[] result = QRCodeWriter.CreateQrCode("https://example.com", 500)
.ToPngBinaryData();
File.WriteAllBytes("qr.png", result);
// Or save directly
QRCodeWriter.CreateQrCode("https://example.com", 500)
.SaveAsPng("qr.png");
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
byte[] result = QRCodeWriter.CreateQrCode("https://example.com", 500)
.ToPngBinaryData();
File.WriteAllBytes("qr.png", result);
// Or save directly
QRCodeWriter.CreateQrCode("https://example.com", 500)
.SaveAsPng("qr.png");
Imports IronBarCode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim result As Byte() = QRCodeWriter.CreateQrCode("https://example.com", 500).ToPngBinaryData()
File.WriteAllBytes("qr.png", result)
' Or save directly
QRCodeWriter.CreateQrCode("https://example.com", 500).SaveAsPng("qr.png")
Code128 Oluşturma
Öncesi (Cloudmersive):
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
var apiInstance = new GenerateBarcodeApi();
byte[] result = apiInstance.GenerateBarcodeCode128("SHIP-2024031500428");
File.WriteAllBytes("barcode.png", result);
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
var apiInstance = new GenerateBarcodeApi();
byte[] result = apiInstance.GenerateBarcodeCode128("SHIP-2024031500428");
File.WriteAllBytes("barcode.png", result);
Imports Cloudmersive.APIClient.NET.Barcode.Api
Imports Cloudmersive.APIClient.NET.Barcode.Client
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY")
Dim apiInstance As New GenerateBarcodeApi()
Dim result As Byte() = apiInstance.GenerateBarcodeCode128("SHIP-2024031500428")
File.WriteAllBytes("barcode.png", result)
Sonrası (IronBarcode):
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
BarcodeWriter.CreateBarcode("SHIP-2024031500428", BarcodeEncoding.Code128)
.SaveAsPng("barcode.png");
// Or get bytes directly
byte[] result = BarcodeWriter.CreateBarcode("SHIP-2024031500428", BarcodeEncoding.Code128)
.ToPngBinaryData();
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
BarcodeWriter.CreateBarcode("SHIP-2024031500428", BarcodeEncoding.Code128)
.SaveAsPng("barcode.png");
// Or get bytes directly
byte[] result = BarcodeWriter.CreateBarcode("SHIP-2024031500428", BarcodeEncoding.Code128)
.ToPngBinaryData();
Imports IronBarCode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
BarcodeWriter.CreateBarcode("SHIP-2024031500428", BarcodeEncoding.Code128) _
.SaveAsPng("barcode.png")
' Or get bytes directly
Dim result As Byte() = BarcodeWriter.CreateBarcode("SHIP-2024031500428", BarcodeEncoding.Code128) _
.ToPngBinaryData()
Barkod Okuma
Öncesi (Cloudmersive):
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
var scanApi = new BarcodeScanApi();
using (var stream = File.OpenRead("barcode.png"))
{
var result = scanApi.BarcodeScanImage(stream);
if (result.Successful == true)
{
Console.WriteLine($"Value: {result.RawText}");
Console.WriteLine($"Type: {result.BarcodeType}");
}
}
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
var scanApi = new BarcodeScanApi();
using (var stream = File.OpenRead("barcode.png"))
{
var result = scanApi.BarcodeScanImage(stream);
if (result.Successful == true)
{
Console.WriteLine($"Value: {result.RawText}");
Console.WriteLine($"Type: {result.BarcodeType}");
}
}
Imports Cloudmersive.APIClient.NET.Barcode.Api
Imports Cloudmersive.APIClient.NET.Barcode.Client
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY")
Dim scanApi As New BarcodeScanApi()
Using stream = File.OpenRead("barcode.png")
Dim result = scanApi.BarcodeScanImage(stream)
If result.Successful = True Then
Console.WriteLine($"Value: {result.RawText}")
Console.WriteLine($"Type: {result.BarcodeType}")
End If
End Using
Sonrası (IronBarcode):
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
var results = BarcodeReader.Read("barcode.png");
var result = results.First();
Console.WriteLine($"Value: {result.Value}");
Console.WriteLine($"Type: {result.Format}");
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
var results = BarcodeReader.Read("barcode.png");
var result = results.First();
Console.WriteLine($"Value: {result.Value}");
Console.WriteLine($"Type: {result.Format}");
Imports IronBarCode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim results = BarcodeReader.Read("barcode.png")
Dim result = results.First()
Console.WriteLine($"Value: {result.Value}")
Console.WriteLine($"Type: {result.Format}")
Asenkron Barkod Okuma
Cloudmersive entegrasyonunuz asenkron API kullanıyorsa:
Öncesi (Cloudmersive):
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
var scanApi = new BarcodeScanApi();
using (var stream = File.OpenRead("barcode.png"))
{
var result = await scanApi.BarcodeScanImageAsync(stream);
return result.Successful == true ? result.RawText : null;
}
using Cloudmersive.APIClient.NET.Barcode.Api;
using Cloudmersive.APIClient.NET.Barcode.Client;
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY");
var scanApi = new BarcodeScanApi();
using (var stream = File.OpenRead("barcode.png"))
{
var result = await scanApi.BarcodeScanImageAsync(stream);
return result.Successful == true ? result.RawText : null;
}
Imports Cloudmersive.APIClient.NET.Barcode.Api
Imports Cloudmersive.APIClient.NET.Barcode.Client
Configuration.Default.ApiKey.Add("Apikey", "YOUR-CLOUDMERSIVE-API-KEY")
Dim scanApi As New BarcodeScanApi()
Using stream = File.OpenRead("barcode.png")
Dim result = Await scanApi.BarcodeScanImageAsync(stream)
Return If(result.Successful = True, result.RawText, Nothing)
End Using
Sonrası (IronBarcode):
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// IronBarcode is synchronous; wrap in Task.Run to free the calling thread for CPU-bound work
var results = await Task.Run(() => BarcodeReader.Read("barcode.png"));
return results.FirstOrDefault()?.Value;
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// IronBarcode is synchronous; wrap in Task.Run to free the calling thread for CPU-bound work
var results = await Task.Run(() => BarcodeReader.Read("barcode.png"));
return results.FirstOrDefault()?.Value;
Imports IronBarCode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
' IronBarcode is synchronous; wrap in Task.Run to free the calling thread for CPU-bound work
Dim results = Await Task.Run(Function() BarcodeReader.Read("barcode.png"))
Return results.FirstOrDefault()?.Value
PDF'den Barkod Okuma
Cloudmersive'un yerel PDF desteği yok. Mevcut kodunuz taramadan önce PDF'lerden görüntü çıkarıyorsa, o tüm hattı tek bir IronBarcode çağrısıyla değiştirin:
Öncesi (Cloudmersive — ayrı PDF çıkarma gerektirir):
// Requires a separate PDF library to extract pages as images,
// then one Cloudmersive API call per extracted page image.
var scanApi = new BarcodeScanApi();
foreach (var pageImagePath in ExtractPdfPages("document.pdf"))
{
using var stream = File.OpenRead(pageImagePath);
var result = await scanApi.BarcodeScanImageAsync(stream);
if (result.Successful == true)
{
Console.WriteLine($"Found: {result.RawText}");
}
}
// Requires a separate PDF library to extract pages as images,
// then one Cloudmersive API call per extracted page image.
var scanApi = new BarcodeScanApi();
foreach (var pageImagePath in ExtractPdfPages("document.pdf"))
{
using var stream = File.OpenRead(pageImagePath);
var result = await scanApi.BarcodeScanImageAsync(stream);
if (result.Successful == true)
{
Console.WriteLine($"Found: {result.RawText}");
}
}
Imports System.IO
Imports Cloudmersive.APIClient.NET.BarcodeScan
' Requires a separate PDF library to extract pages as images,
' then one Cloudmersive API call per extracted page image.
Dim scanApi As New BarcodeScanApi()
For Each pageImagePath In ExtractPdfPages("document.pdf")
Using stream As FileStream = File.OpenRead(pageImagePath)
Dim result = Await scanApi.BarcodeScanImageAsync(stream)
If result.Successful = True Then
Console.WriteLine($"Found: {result.RawText}")
End If
End Using
Next
Sonrası (IronBarcode):
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// One call — all pages, all barcodes, no image extraction step
var results = BarcodeReader.Read("document.pdf");
foreach (var result in results)
{
Console.WriteLine($"Page {result.PageNumber}: {result.Value}");
}
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
// One call — all pages, all barcodes, no image extraction step
var results = BarcodeReader.Read("document.pdf");
foreach (var result in results)
{
Console.WriteLine($"Page {result.PageNumber}: {result.Value}");
}
Imports IronBarCode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
' One call — all pages, all barcodes, no image extraction step
Dim results = BarcodeReader.Read("document.pdf")
For Each result In results
Console.WriteLine($"Page {result.PageNumber}: {result.Value}")
Next
Çoklu-Barcode Algılama
Birden fazla barkod tarayan kodunuz varsa:
Öncesi (Cloudmersive — birçok çağrı gerekli):
// Cloudmersive returns one barcode per scan — multiple calls for multiple barcodes
var scanApi = new BarcodeScanApi();
var barcodeValues = new List<string>();
foreach (var croppedRegion in CropBarcodeRegions("invoice.png"))
{
using var stream = new MemoryStream(croppedRegion);
var result = await scanApi.BarcodeScanImageAsync(stream);
if (result.Successful == true)
barcodeValues.Add(result.RawText);
}
// Cloudmersive returns one barcode per scan — multiple calls for multiple barcodes
var scanApi = new BarcodeScanApi();
var barcodeValues = new List<string>();
foreach (var croppedRegion in CropBarcodeRegions("invoice.png"))
{
using var stream = new MemoryStream(croppedRegion);
var result = await scanApi.BarcodeScanImageAsync(stream);
if (result.Successful == true)
barcodeValues.Add(result.RawText);
}
Imports System.IO
Imports System.Collections.Generic
Imports System.Threading.Tasks
' Cloudmersive returns one barcode per scan — multiple calls for multiple barcodes
Dim scanApi As New BarcodeScanApi()
Dim barcodeValues As New List(Of String)()
For Each croppedRegion In CropBarcodeRegions("invoice.png")
Using stream As New MemoryStream(croppedRegion)
Dim result = Await scanApi.BarcodeScanImageAsync(stream)
If result.Successful = True Then
barcodeValues.Add(result.RawText)
End If
End Using
Next
Sonrası (IronBarcode):
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
var options = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Balanced,
ExpectMultipleBarcodes = true,
};
// One call — returns all barcodes in the image
var results = BarcodeReader.Read("invoice.png", options);
var barcodeValues = results.Select(r => r.Value).ToList();
using IronBarCode;
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY";
var options = new BarcodeReaderOptions
{
Speed = ReadingSpeed.Balanced,
ExpectMultipleBarcodes = true,
};
// One call — returns all barcodes in the image
var results = BarcodeReader.Read("invoice.png", options);
var barcodeValues = results.Select(r => r.Value).ToList();
Imports IronBarCode
IronBarCode.License.LicenseKey = "YOUR-LICENSE-KEY"
Dim options As New BarcodeReaderOptions With {
.Speed = ReadingSpeed.Balanced,
.ExpectMultipleBarcodes = True
}
' One call — returns all barcodes in the image
Dim results = BarcodeReader.Read("invoice.png", options)
Dim barcodeValues = results.Select(Function(r) r.Value).ToList()
Artık Gerekli Olmayan Altyapıyı Kaldırma
Geçişin bu kısmında yazdığınızdan daha fazla kodu silersiniz.
HTTP İstisna Yönetimini Kaldır
Cloudmersive işlemleri ağ hataları, HTTP 4xx/5xx yanıtları ve zaman aşımı istisnaları ile başarısız olabilir. Bu genellikle IronBarcode'un ihtiyacı olmayan try/catch altyapısı üretir:
// Remove all of this
try
{
var result = await scanApi.BarcodeScanImageAsync(stream);
// ...
}
catch (ApiException ex) when (ex.ErrorCode == 429)
{
// Rate limited — wait and retry
await Task.Delay(TimeSpan.FromSeconds(2));
// retry logic...
}
catch (ApiException ex) when (ex.ErrorCode == 503)
{
// Service unavailable — Cloudmersive is down
_logger.LogError("Cloudmersive unavailable: {Message}", ex.Message);
throw;
}
catch (HttpRequestException ex)
{
// Network error
_logger.LogError("Network failure: {Message}", ex.Message);
throw;
}
catch (TaskCanceledException)
{
// Timeout
_logger.LogError("Cloudmersive request timed out");
throw;
}
// Remove all of this
try
{
var result = await scanApi.BarcodeScanImageAsync(stream);
// ...
}
catch (ApiException ex) when (ex.ErrorCode == 429)
{
// Rate limited — wait and retry
await Task.Delay(TimeSpan.FromSeconds(2));
// retry logic...
}
catch (ApiException ex) when (ex.ErrorCode == 503)
{
// Service unavailable — Cloudmersive is down
_logger.LogError("Cloudmersive unavailable: {Message}", ex.Message);
throw;
}
catch (HttpRequestException ex)
{
// Network error
_logger.LogError("Network failure: {Message}", ex.Message);
throw;
}
catch (TaskCanceledException)
{
// Timeout
_logger.LogError("Cloudmersive request timed out");
throw;
}
Imports System
Imports System.Threading.Tasks
' Remove all of this
Try
Dim result = Await scanApi.BarcodeScanImageAsync(stream)
' ...
Catch ex As ApiException When ex.ErrorCode = 429
' Rate limited — wait and retry
Await Task.Delay(TimeSpan.FromSeconds(2))
' retry logic...
Catch ex As ApiException When ex.ErrorCode = 503
' Service unavailable — Cloudmersive is down
_logger.LogError("Cloudmersive unavailable: {Message}", ex.Message)
Throw
Catch ex As HttpRequestException
' Network error
_logger.LogError("Network failure: {Message}", ex.Message)
Throw
Catch ex As TaskCanceledException
' Timeout
_logger.LogError("Cloudmersive request timed out")
Throw
End Try
IronBarcode ağ istisnaları atmaz. Girdi verilerinden bir barkodun çözülememesi durumunda BarcodeException fırlatır, bu bir altyapı değil içerik sorunudur. Basitleştirilmiş hata yönetimi:
using IronBarCode;
var results = BarcodeReader.Read("barcode.png");
if (!results.Any())
{
_logger.LogWarning("No barcode detected in image");
}
using IronBarCode;
var results = BarcodeReader.Read("barcode.png");
if (!results.Any())
{
_logger.LogWarning("No barcode detected in image");
}
Imports IronBarCode
Dim results = BarcodeReader.Read("barcode.png")
If Not results.Any() Then
_logger.LogWarning("No barcode detected in image")
End If
Yeniden Deneme Mantığını Kaldır
Cloudmersive entegrasyonunuz yeniden deneme politikaları, Polly, özel yeniden deneme döngüleri veya üstel yedekleme içeriyorsa, bunları tamamen kaldırın:
// Remove retry infrastructure
// var retryPolicy = Policy
// .Handle<ApiException>()
// .WaitAndRetryAsync(3, retryAttempt =>
// TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
// IronBarcode — no retry needed
var results = BarcodeReader.Read("barcode.png");
// Remove retry infrastructure
// var retryPolicy = Policy
// .Handle<ApiException>()
// .WaitAndRetryAsync(3, retryAttempt =>
// TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
// IronBarcode — no retry needed
var results = BarcodeReader.Read("barcode.png");
' Remove retry infrastructure
' Dim retryPolicy = Policy _
' .Handle(Of ApiException)() _
' .WaitAndRetryAsync(3, Function(retryAttempt) _
' TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)))
' IronBarcode — no retry needed
Dim results = BarcodeReader.Read("barcode.png")
Oran Sınırlama İzlemeyi Kaldır
Kodu, Cloudmersive'ın aylık kotasına uymak için API çağrı sayılarını izliyorsa:
// Remove quota tracking
// private static int _monthlyCallCount = 0;
// private const int MonthlyLimit = 30000;
//
// if (Interlocked.Increment(ref _monthlyCallCount) > MonthlyLimit)
// throw new InvalidOperationException("Monthly Cloudmersive quota exceeded");
// IronBarcode — no quota
var results = BarcodeReader.Read("barcode.png");
// Remove quota tracking
// private static int _monthlyCallCount = 0;
// private const int MonthlyLimit = 30000;
//
// if (Interlocked.Increment(ref _monthlyCallCount) > MonthlyLimit)
// throw new InvalidOperationException("Monthly Cloudmersive quota exceeded");
// IronBarcode — no quota
var results = BarcodeReader.Read("barcode.png");
' Remove quota tracking
' Private Shared _monthlyCallCount As Integer = 0
' Private Const MonthlyLimit As Integer = 30000
'
' If Interlocked.Increment(_monthlyCallCount) > MonthlyLimit Then
' Throw New InvalidOperationException("Monthly Cloudmersive quota exceeded")
' IronBarcode — no quota
Dim results = BarcodeReader.Read("barcode.png")
Ağ Zaman Aşımı Yapılandırmasını Kaldır
Cloudmersive istemcileri sıklıkla zaman aşımı yapılandırması içerir. Bunu kaldırın:
// Remove timeout configuration
// Configuration.Default.Timeout = 30000; // 30 second timeout
// Configuration.Default.ConnectionTimeout = 5000;
// IronBarcode has no network timeout — no network
// Remove timeout configuration
// Configuration.Default.Timeout = 30000; // 30 second timeout
// Configuration.Default.ConnectionTimeout = 5000;
// IronBarcode has no network timeout — no network
' Remove timeout configuration
' Configuration.Default.Timeout = 30000 ' 30 second timeout
' Configuration.Default.ConnectionTimeout = 5000
' IronBarcode has no network timeout — no network
API Anahtar Dönüşümünü Kaldır
Uygulamanız bir takvimde API anahtarlarını döndürüyorsa veya gizli yönetiminde saklıyorsa:
// Simplify this pattern
// private string GetCloudmersiveApiKey() =>
// _secretManager.GetSecret("cloudmersive-api-key-current");
//
// Configuration.Default.ApiKey["Apikey"] = GetCloudmersiveApiKey();
// IronBarcode — set once at startup
IronBarCode.License.LicenseKey = _configuration["IronBarcode:LicenseKey"];
// or literal: "YOUR-LICENSE-KEY"
// Simplify this pattern
// private string GetCloudmersiveApiKey() =>
// _secretManager.GetSecret("cloudmersive-api-key-current");
//
// Configuration.Default.ApiKey["Apikey"] = GetCloudmersiveApiKey();
// IronBarcode — set once at startup
IronBarCode.License.LicenseKey = _configuration["IronBarcode:LicenseKey"];
// or literal: "YOUR-LICENSE-KEY"
' Simplify this pattern
' Private Function GetCloudmersiveApiKey() As String
' Return _secretManager.GetSecret("cloudmersive-api-key-current")
' End Function
'
' Configuration.Default.ApiKey("Apikey") = GetCloudmersiveApiKey()
' IronBarcode — set once at startup
IronBarCode.License.LicenseKey = _configuration("IronBarcode:LicenseKey")
' or literal: "YOUR-LICENSE-KEY"
Yaygın Geçiş Sorunları
Cloudmersive Üretim için byte[] Döndürdü
Cloudmersive'ın üretim yöntemleri doğrudan byte[] döndürür. IronBarcode size daha fazla seçenek sunan bir GeneratedBarcode nesnesi döndürür:
// Cloudmersive returned byte[] directly
byte[] cloudmersiveResult = apiInstance.GenerateBarcodeQRCode("data");
// IronBarcode — call ToPngBinaryData() for the equivalent byte[]
byte[] ironBarcodeResult = BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode)
.ToPngBinaryData();
// Or save directly (often simpler)
BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode)
.SaveAsPng("output.png");
// Or get other formats
byte[] jpegBytes = BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode)
.ToJpegBinaryData();
// Cloudmersive returned byte[] directly
byte[] cloudmersiveResult = apiInstance.GenerateBarcodeQRCode("data");
// IronBarcode — call ToPngBinaryData() for the equivalent byte[]
byte[] ironBarcodeResult = BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode)
.ToPngBinaryData();
// Or save directly (often simpler)
BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode)
.SaveAsPng("output.png");
// Or get other formats
byte[] jpegBytes = BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode)
.ToJpegBinaryData();
Imports Cloudmersive.APIClient
Imports IronBarCode
' Cloudmersive returned byte() directly
Dim cloudmersiveResult As Byte() = apiInstance.GenerateBarcodeQRCode("data")
' IronBarcode — call ToPngBinaryData() for the equivalent byte()
Dim ironBarcodeResult As Byte() = BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode) _
.ToPngBinaryData()
' Or save directly (often simpler)
BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode) _
.SaveAsPng("output.png")
' Or get other formats
Dim jpegBytes As Byte() = BarcodeWriter.CreateBarcode("data", BarcodeEncoding.QRCode) _
.ToJpegBinaryData()
Cloudmersive Okuma JSON Yanıt Modeli Döndürdü
Cloudmersive'ın tarama sonucu, Successful, RawText ve BarcodeType gibi özelliklere sahip bir yanıt modelidir. IronBarcode, yazılı sonuç nesneleri döndürür:
// Cloudmersive result model
if (cloudmersiveResult.Successful == true)
{
string value = cloudmersiveResult.RawText;
string type = cloudmersiveResult.BarcodeType;
}
// IronBarcode result — use .Value and .Format directly
var results = BarcodeReader.Read("barcode.png");
if (results.Any())
{
string value = results.First().Value;
string format = results.First().Format.ToString();
}
// Cloudmersive result model
if (cloudmersiveResult.Successful == true)
{
string value = cloudmersiveResult.RawText;
string type = cloudmersiveResult.BarcodeType;
}
// IronBarcode result — use .Value and .Format directly
var results = BarcodeReader.Read("barcode.png");
if (results.Any())
{
string value = results.First().Value;
string format = results.First().Format.ToString();
}
' Cloudmersive result model
If cloudmersiveResult.Successful = True Then
Dim value As String = cloudmersiveResult.RawText
Dim type As String = cloudmersiveResult.BarcodeType
End If
' IronBarcode result — use .Value and .Format directly
Dim results = BarcodeReader.Read("barcode.png")
If results.Any() Then
Dim value As String = results.First().Value
Dim format As String = results.First().Format.ToString()
End If
Birkaç Cloudmersive API Örnek Türü
Cloudmersive, üretim ve taramayı GenerateBarcodeApi ve BarcodeScanApi örneklerinde ayırır. IronBarcode statik sınıflar kullanır — örneklere gerek yoktur:
// Cloudmersive — two separate API instances
var generateApi = new GenerateBarcodeApi();
var scanApi = new BarcodeScanApi();
// IronBarcode — static, no instances
// BarcodeWriter for generation
// BarcodeReader for reading
// QRCodeWriter for QR codes specifically
// Cloudmersive — two separate API instances
var generateApi = new GenerateBarcodeApi();
var scanApi = new BarcodeScanApi();
// IronBarcode — static, no instances
// BarcodeWriter for generation
// BarcodeReader for reading
// QRCodeWriter for QR codes specifically
' Cloudmersive — two separate API instances
Dim generateApi As New GenerateBarcodeApi()
Dim scanApi As New BarcodeScanApi()
' IronBarcode — static, no instances
' BarcodeWriter for generation
' BarcodeReader for reading
' QRCodeWriter for QR codes specifically
Geçiş Kontrol Listesi
Tüm Cloudmersive referanslarını yakaladığınızdan emin olmak için geçişten önce ve sonra kod tabanınızda bu aramaları yapın:
# Find all Cloudmersive references
grep -r "Cloudmersive" --include="*.cs" .
grep -r "GenerateBarcodeApi" --include="*.cs" .
grep -r "BarcodeScanApi" --include="*.cs" .
grep -r "Configuration.Default.ApiKey" --include="*.cs" .
grep -r '"Apikey"' --include="*.cs" .
grep -r "GenerateBarcodeQRCode" --include="*.cs" .
grep -r "GenerateBarcodeCode128" --include="*.cs" .
grep -r "BarcodeScanImage" --include="*.cs" .
grep -r "cloudmersive" --include="*.csproj" .
grep -r "cloudmersive" --include="*.json" .
# Find all Cloudmersive references
grep -r "Cloudmersive" --include="*.cs" .
grep -r "GenerateBarcodeApi" --include="*.cs" .
grep -r "BarcodeScanApi" --include="*.cs" .
grep -r "Configuration.Default.ApiKey" --include="*.cs" .
grep -r '"Apikey"' --include="*.cs" .
grep -r "GenerateBarcodeQRCode" --include="*.cs" .
grep -r "GenerateBarcodeCode128" --include="*.cs" .
grep -r "BarcodeScanImage" --include="*.cs" .
grep -r "cloudmersive" --include="*.csproj" .
grep -r "cloudmersive" --include="*.json" .
Geçişten sonra, tüm aramaların sıfır sonuç döndürmesi gerekir. Daha sonra IronBarcode'un doğru bir şekilde atıfta bulunduğunu doğrulayın:
grep -r "IronBarCode" --include="*.cs" .
grep -r "BarcodeReader" --include="*.cs" .
grep -r "BarcodeWriter" --include="*.cs" .
grep -r "IronBarCode" --include="*.cs" .
grep -r "BarcodeReader" --include="*.cs" .
grep -r "BarcodeWriter" --include="*.cs" .
Yapılandırma Kontrol Listesi
- Tüm
.csprojdosyalarındanCloudmersive.APIClient.NET.Barcodekaldırın - Cloudmersive API anahtarını, ortam değişkenlerinden ve gizli depolardan kaldırın
- IronBarcode NuGet paketini ekleyin
- Uygulama başlangıcında
IronBarCode.License.LicenseKeybaşlatmasını ekleyin - Cloudmersive çağrıları için yeniden deneme politikalarını ve devre kesicileri kaldırın
- Oran sınırlama izleme kodunu kaldırın
- Ağ zaman aşımı yapılandırmasını kaldırın
Test Kontrol Listesi
Geçişi tamamladıktan sonra:
- QR kod üretiminin geçerli, taranabilir çıktıyı ürettiğini doğrulayın
- Code128 ve diğer lineer barkod üretimini doğrulayın
- Yaygın görüntü formatlarından (PNG, JPEG, BMP) barkod okuma doğrulayın
- PDF belgeleri işliyorsanız PDF okuma test edin
- Uygulanabilir ise çoklu barkod algılamayı test edin
- Ağ trafiğinde Cloudmersive API çağrılarının görünmediğini doğrulayın
- Uygulamanın internet bağlantısı olmadan doğru çalıştığını doğrulayın
Geçişten Sonra Kazançlarınız
Maliyet tasarruflarının ötesinde, geçiş bir dizi operasyonel endişeyi ortadan kaldırır:
Ağ bağımlı barkod işleme artık yok. Belge işleme hattınız Cloudmersive'un erişilebilirliği, internet bağlantınızın kalitesi veya ağ gecikmeleri nedeniyle çalışmaz.
Kota yönetimi artık yok. Ay sonunda belge hacmindeki artışlar, beklenmedik aşım ücretleri veya işleme hataları ortaya çıkarmaz.
Ağınızı terk eden veri artık yok. Müşteri, mali veya sağlık bilgilerini içeren barkod görüntüleri kendi altyapınızda kalır.
Daha basit kod. Üretim Cloudmersive entegrasyonlarının gerektirdiği yeniden deneme altyapısı, zaman aşımı yönetimi ve HTTP istisna yönetimi kaldırılmıştır. Yerine doğrudan bir yöntem çağrısı gelir.
Geçiş mekaniktir. Kazançlar yapısaldır — bir iş akışının gerektirmediği harici bir ağ servisine olan bağımlılığı ortadan kaldırmak.
Sıkça Sorulan Sorular
Neden Cloudmersive Barcode API'den IronBarcode'a geçiş yapmalıyım?
Yaygın nedenler arasında lisanslamanın basitleştirilmesi (SDK + runtime anahtar karmaşıklığının kaldırılması), veri geçiş limitlerinin ortadan kaldırılması, yerel PDF desteği kazanılması, Docker/CI/CD dağıtımının iyileştirilmesi ve üretim kodunda API tekrarlama azalması yer alır.
Cloudmersive API çağrılarını IronBarcode ile nasıl değiştiririm?
Örnek oluşturma ve lisanslama tekrarlamalarını IronBarCode.License.LicenseKey = "anahtar" ile değiştirin. Okuyucu çağrılarını BarcodeReader.Read(yol) ile ve yazıcı çağrılarını BarcodeWriter.CreateBarcode(veri, kodlama) ile değiştirin. Statik yöntemler örnek yönetimi gerektirmez.
Cloudmersive Barcode API'den IronBarcode'a geçiş sırasında ne kadar kod değişiyor?
Çoğu geçiş daha az kod satırıyla sonuçlanır. Lisanslama tekrarlamaları, örnek oluşturucular ve açık format yapılandırması kaldırılır. Temel okuma/yazma işlemleri, daha temiz sonuç nesneleriyle daha kısa IronBarcode eşdeğerlerine dönüştürülür.
Geçiş sırasında hem Cloudmersive Barcode API hem de IronBarcode'un yüklü kalması gerekiyor mu?
Hayır. Çoğu geçiş doğrudan değişim yapılır, paralel bir işletim yerine geçer. Bir hizmet sınıfını bir seferde geçirin, NuGet referansını değiştirin ve sonraki sınıfa geçmeden önce başlatma ve API çağrı desenlerini güncelleyin.
IronBarcode için NuGet paketi adı nedir?
Paket 'IronBarCode' (büyük B ve C harfleriyle). 'Install-Package IronBarCode' veya 'dotnet add package IronBarCode' ile kurun. Kodda kullanılan yönerge 'using IronBarCode;' şeklindedir.
IronBarcode, Docker dağıtımını Cloudmersive Barcode API'ye kıyasla nasıl kolaylaştırır?
IronBarcode, harici SDK dosyaları veya montajlı lisans yapılandırması olmayan bir NuGet paketidir. Docker'da, IRONBARCODE_LICENSE_KEY ortam değişkenini ayarlayın ve paket lisans doğrulamasını başlangıçta kendi kendine yapar.
IronBarcode, Cloudmersive'den göç ettikten sonra tüm barkod formatlarını otomatik olarak algılıyor mu?
Evet. IronBarcode, desteklenen tüm formatlardaki sembolojiyi otomatik olarak algılar. Açık BarcodeTypes sayımı gerekli değildir. Format zaten biliniyorsa ve performans önemliyse, BarcodeReaderOptions arama alanını optimize etmek için sınırlamayı sağlar.
IronBarcode, ayrı bir kütüphane olmadan PDF'lerden barkod okuyabiliyor mu?
Evet. BarcodeReader.Read("document.pdf") PDF dosyalarını yerel olarak işlemler. Sonuçlar her barkod için SayfaNumarası, Format, Değer ve Güven içerir. Harici bir PDF render adımı gerekmez.
IronBarcode, paralel barkod işlemeyi nasıl yönetiyor?
IronBarcode'un statik yöntemleri durumsuz ve thread-safe'dir. Dağıtılmış dosya listeleri üzerinde per-thread örnek yönetimi olmadan doğrudan Parallel.ForEach kullanın. BarcodeReaderOptions.MaxParallelThreads, iç thread bütçesini kontrol eder.
Cloudmersive Barcode API'den IronBarcode'a geçiş yaparken hangi sonuç özellikleri değişiyor?
Yaygın yeniden adlandırmalar: BarcodeValue, Value olur; BarcodeType, Format olur. IronBarcode sonuçları ayrıca Güven ve SayfaNumarası ekler. Çözüm çapında arama-değiştirme, mevcut sonuç işleme kodundaki yeniden adlandırmaları ele alır.
Bir CI/CD hattında IronBarcode lisanslamasını nasıl ayarlayabilirim?
IRONBARCODE_LICENSE_KEY'i bir boru hattı sırrı olarak saklayın ve uygulama başlangıç kodunda IronBarCode.License.LicenseKey olarak atayın. Bir sır, geliştirme, test, aşama ve üretim dahil olmak üzere tüm ortamları kapsar.
IronBarcode, özel biçimlendirmeye sahip QR kodu üretimini destekliyor mu?
Evet. QRCodeWriter.CreateQrCode() özelleştirilmiş renkler için ChangeBarCodeColor(), logo yerleştirme için AddBrandLogo(), yapılandırılabilir hata düzeltme seviyeleri ve PNG, JPG, PDF ve akış dahil birden çok çıktı formatını destekler.

