C# SDK - installation
Using the barKoder SDK in a C# .NET Console Application #
The barKoder SDK provides powerful barcode decoding and ID Document decoding (MRZ) capabilities. This guide will help you set up and use our barcode API's in your C# .NET console application.
Installation #
1. Add the barKoder SDK to your project by installing the NuGet package:
- Place the `BarkoderSDK.(VERSION).nupkg` file in your local NuGet repository.
- Install the package into your C# project from your local repository.
Getting Started #
Follow these steps to use the Barkoder SDK in your C# application:
1. Import the barKoder SDK:
Add the following to your `Program.cs` file:
```csharp
using BarkoderNET;
```
2. Explore Sample Code:
Review the `sample_charp` demo application for common usage patterns.
3. Bitmap Conversion to Grayscale:
If using the sample code for converting `Bitmap` to a grayscale array (required for decoding), include these imports:
```csharp
using System.Drawing;
using System.Drawing.Imaging;
```
4. Initialize with a License Key:
Provide a valid trial or production license key in the `Config.InitializeWithLicenseKey` function:
```csharp
Config.InitializeWithLicenseKey("YourLicenseKeyHere");
```
5. Configure the Decoder:
Adjust decoder settings as needed, such as enabling specific barcode types or optimizing decoding speed.
6. Run Your Application:
Build and run your application, specifying the image file name as the first (and only) command-line argument.
Using OCR (MRZ) Features #
The barKoder SDK also supports OCR for decoding Machine-Readable Zones (MRZ) in ID documents. Follow these steps to enable OCR:
1. Enable MRZ Decoding:
Configure the decoder to enable MRZ decoding:
```csharp
config.SetEnabledDecoders(new List<DecoderType> { DecoderType.IDDocument });
```
2. Use an MRZ-Enabled License Key:
Ensure your license key supports MRZ features. This is mandatory for OCR functionality.