Skip to content

Commit 09b8464

Browse files
update to v10.2.10
1 parent df7a58b commit 09b8464

File tree

312 files changed

+410
-13083
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

312 files changed

+410
-13083
lines changed

LICENSE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
License Notice
22

3-
This folder contains code samples ("Sample Code") for use with Dynamsoft Barcode Reader, a commercial software development kit licensed by Dynamsoft. The Sample Code may be modified and included in your end user software under the terms of the Dynamsoft Software License Agreement https://www.dynamsoft.com/company/license-agreement/ ("Commercial License"). Except as expressly stated in the Commercial License, no other rights are granted in the Sample Code. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3+
This folder contains code samples ("Sample Code") for use with Dynamsoft Barcode Reader, a commercial software development kit licensed by Dynamsoft. The Sample Code may be modified and included in your end user software under the terms of the Dynamsoft Software License Agreement https://www.dynamsoft.com/company/license-agreement/ ("Commercial License"). Except as expressly stated in the Commercial License, no other rights are granted in the Sample Code. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4+
45
Copyright © 2003–2024 Dynamsoft. All rights reserved.

Legal.txt

Lines changed: 184 additions & 106 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,36 @@
1-
# Dynamsoft Barcode Reader Samples - .Net Edition
1+
# Dynamsoft Barcode Reader Samples - .NET Edition
22

3-
This repository contains multiple samples that demonstrates how to use the <a href="https://www.dynamsoft.com/barcode-reader/overview/?product=dbr&utm_source=samples&package=dotnet" target="_blank">Dynamsoft Barcode Reader</a> .Net Edition.
3+
This repository contains multiple samples that demonstrates how to use the <a href="https://www.dynamsoft.com/barcode-reader/overview/" target="_blank">Dynamsoft Barcode Reader</a> .NET Edition.
44

5-
## Requirements
6-
- Operating systems:
7-
- Windows: 7, 8, 10, 2003, 2008, 2008 R2, 2012 and above
8-
- Environment:
9-
- Visual Studio 2008 and above
10-
- Framework supported:
11-
- .NET Framework 2.0
12-
- .NET Framework 4.0 and above
5+
## System Requirements
6+
7+
- Windows:
8+
- Supported Versions: Windows 7 and higher, or Windows Server 2003 and higher
9+
- Architecture: x64 and x86
10+
- Development Environment: Visual Studio 2012 or higher.
11+
12+
- Linux:
13+
- Supported Distributions: Ubuntu 14.04.4+ LTS, Debian 8+, CentOS 6+
14+
- Architectures: x64
15+
- Minimum GLIBC Version: GLIBC_2.18 or higher
16+
17+
- Supported .NET versions
18+
- .NET Framework 3.5 and above
19+
- .NET 6, 7, 8
1320

1421
## Samples
1522

1623
| Sample | Description |
1724
|---|---|
18-
| [`HelloWorld`](samples/HelloWorld) | This sample demonstrates the simplest way to read barcodes from an image file. |
19-
| [`GeneralSettings`](samples/GeneralSettings) | This sample demonstrates how to configure general settings and read barcodes from an image file. |
20-
| [`ProcessDocumentsByBarcodes`](samples/UseCases/ProcessDocumentsByBarcodes) | This sample demonstrates how to renaming, splitting or classifying a batch of documents using barcodes result. |
21-
| [`DecodeFromScannerAndWebcam`](samples/UseCases/DecodeFromScannerAndWebcam) | This sample demonstrates how to read barcodes from scanner, webcam and local files. |
22-
| [`ImageDecoding`](samples/ImageDecoding) | This sample demonstrates how to decode images in various format (including Disk File/File Bytes in Memory/Raw Buffer/Base64 String/Bitmap) when using Dynamsoft Barcode Reader. |
23-
| [`SpeedFirstSettings`](samples/Performance/SpeedFirstSettings) | This sample demonstrates how to configure Dynamsoft Barcode Reader to read barcodes as fast as possible. The downside is that read-rate and accuracy might be affected. |
24-
| [`ReadRateFirstSettings`](samples/Performance/ReadRateFirstSettings) | This sample demonstrates how to configure Dynamsoft Barcode Reader to read as many barcodes as possible at one time. The downside is that speed and accuracy might be affected. It is recommended to apply these configurations when decoding multiple barcodes from a single image. |
25-
| [`AccuracyFirstSettings`](samples/Performance/AccuracyFirstSettings) | This sample demonstrates how to configure Dynamsoft Barcode Reader to read barcodes as accurately as possible. The downside is that speed and read-rate might be affected. It is recommended to apply these configurations when misreading is unbearable. |
26-
| [`ReadDPMBarcodes`](samples/UseCases/ReadDPMBarcodes) | This sample demonstrates how to configure Dynamsoft Barcode Reader to read DPM barcodes. |
27-
| [`DecodeWithConcurrentInstance`](samples/DecodeWithConcurrentInstance) | This sample demonstrates how to decode barcodes in concurrent instance mode. |
25+
| [`ReadAnImage`](Samples/HelloWorld/ReadAnImage) | This sample demonstrates the simplest way to read barcodes from an image file and output barcode format and text. |
26+
| [`ReadMultipleImages`](Samples/HelloWorld/ReadMultipleImages) | This sample demonstrates the simplest way to read barcodes from directory with image files and output barcode format and text. |
2827

2928
## License
3029

31-
The library requires a license to work, you use the API InitLicense to initialize license key and activate the SDK.
32-
33-
These samples use a free public trial license which require network connection to function. You can request a 30-day free trial license key from <a href="https://www.dynamsoft.com/customer/license/trialLicense?architecture=dcv&product=dbr&utm_source=samples&package=dotnet" target="_blank">Customer Portal</a> which works offline.
34-
35-
To run sample `DecodeWithConcurrentInstance`, please contact us at https://www.dynamsoft.com/company/contact/ to get a concurrent instance license first.
30+
The library requires a license to work, you use the API `LicenseManager.InitLicense` to initialize license key and activate the SDK.
3631

37-
For more information, please refer to https://www.dynamsoft.com/license-server/docs/about/licensefaq.html.
32+
These samples use a free public trial license which require network connection to function. You can request a 30-day free trial license key from <a href="https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=github&package=dotnet" target="_blank">Customer Portal</a> which works offline.
3833

3934
## Contact Us
4035

41-
https://www.dynamsoft.com/company/contact/
36+
<a href="https://www.dynamsoft.com/company/contact/">Contact Dynamsoft</a> if you have any questions.

Samples/HelloWorld/HelloWorld.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.7.34221.43
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReadAnImage", "ReadAnImage\ReadAnImage.csproj", "{CA902091-6DE1-43EB-806A-13F3A2FFE3A4}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReadMultipleImages", "ReadMultipleImages\ReadMultipleImages.csproj", "{9C166401-CEC8-4BA0-BDE9-3B0F366E4F42}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{CA902091-6DE1-43EB-806A-13F3A2FFE3A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{CA902091-6DE1-43EB-806A-13F3A2FFE3A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{CA902091-6DE1-43EB-806A-13F3A2FFE3A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{CA902091-6DE1-43EB-806A-13F3A2FFE3A4}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{9C166401-CEC8-4BA0-BDE9-3B0F366E4F42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{9C166401-CEC8-4BA0-BDE9-3B0F366E4F42}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{9C166401-CEC8-4BA0-BDE9-3B0F366E4F42}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{9C166401-CEC8-4BA0-BDE9-3B0F366E4F42}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {F01351FE-6AD0-40F2-B084-D44E1AA3378E}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
using Dynamsoft.DBR;
2+
using Dynamsoft.Core;
3+
using Dynamsoft.CVR;
4+
using Dynamsoft.License;
5+
namespace ReadAnImage
6+
{
7+
internal class Program
8+
{
9+
static void Main(string[] args)
10+
{
11+
int errorCode = 1;
12+
string errorMsg;
13+
errorCode = LicenseManager.InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", out errorMsg);
14+
if (errorCode != (int)EnumErrorCode.EC_OK)
15+
Console.WriteLine("License initialization error: " + errorMsg);
16+
using (CaptureVisionRouter cvr = new CaptureVisionRouter())
17+
{
18+
string imageFile = "../../../../../../Images/AllSupportedBarcodeTypes.png";
19+
CapturedResult? result = cvr.Capture(imageFile, PresetTemplate.PT_READ_BARCODES);
20+
if (result == null)
21+
{
22+
Console.WriteLine("No barcode detected.");
23+
}
24+
else if (result.GetErrorCode() != 0)
25+
{
26+
Console.WriteLine("Error: " + result.GetErrorCode() + ", " + result.GetErrorString());
27+
}
28+
else
29+
{
30+
DecodedBarcodesResult? barcodesResult = result.GetDecodedBarcodesResult();
31+
if (barcodesResult != null)
32+
{
33+
BarcodeResultItem[] items = barcodesResult.GetItems();
34+
Console.WriteLine("Decoded " + items.Length + " barcodes");
35+
foreach (BarcodeResultItem barcodeItem in items)
36+
{
37+
Console.WriteLine("Result " + (Array.IndexOf(items, barcodeItem) + 1));
38+
Console.WriteLine("Barcode Format: " + barcodeItem.GetFormatString());
39+
Console.WriteLine("Barcode Text: " + barcodeItem.GetText());
40+
}
41+
}
42+
}
43+
}
44+
Console.WriteLine("Press any key to quit...");
45+
Console.Read();
46+
}
47+
}
48+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net7.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
11+
<ItemGroup>
12+
<PackageReference Include="Dynamsoft.DotNet.BarcodeReader.Bundle" Version="10.2.1000" />
13+
14+
15+
16+
17+
</ItemGroup>
18+
19+
</Project>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
using Dynamsoft.Core;
2+
using Dynamsoft.CVR;
3+
using Dynamsoft.DBR;
4+
using Dynamsoft.License;
5+
using Dynamsoft.Utility;
6+
7+
namespace ReadMultipleImages
8+
{
9+
class MyCapturedResultReceiver : CapturedResultReceiver
10+
{
11+
public override void OnDecodedBarcodesReceived(DecodedBarcodesResult result)
12+
{
13+
FileImageTag? tag = (FileImageTag?)result.GetOriginalImageTag();
14+
Console.WriteLine("File: " + tag.GetFilePath());
15+
if (result.GetErrorCode() != (int)EnumErrorCode.EC_OK)
16+
{
17+
Console.WriteLine("Error: " + result.GetErrorString());
18+
}
19+
else
20+
{
21+
BarcodeResultItem[] items = result.GetItems();
22+
Console.WriteLine("Decoded " + items.Length + " barcodes");
23+
foreach (BarcodeResultItem item in items)
24+
{
25+
Console.WriteLine("Result " + (Array.IndexOf(items, item) + 1));
26+
Console.WriteLine("Barcode Format: " + item.GetFormatString());
27+
Console.WriteLine("Barcode Text: " + item.GetText());
28+
}
29+
}
30+
Console.WriteLine();
31+
}
32+
}
33+
class MyImageSourceStateListener : IImageSourceStateListener
34+
{
35+
private CaptureVisionRouter? cvr = null;
36+
public MyImageSourceStateListener(CaptureVisionRouter cvr)
37+
{
38+
this.cvr = cvr;
39+
}
40+
41+
public void OnImageSourceStateReceived(EnumImageSourceState state)
42+
{
43+
if (state == EnumImageSourceState.ISS_EXHAUSTED)
44+
{
45+
if (cvr != null)
46+
{
47+
cvr.StopCapturing();
48+
}
49+
}
50+
}
51+
}
52+
internal class Program
53+
{
54+
static void Main(string[] args)
55+
{
56+
int errorCode = 1;
57+
string errorMsg;
58+
errorCode = LicenseManager.InitLicense("DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9", out errorMsg);
59+
if (errorCode != (int)EnumErrorCode.EC_OK)
60+
{
61+
Console.WriteLine("License initialization error: " + errorMsg);
62+
}
63+
using (CaptureVisionRouter cvr = new CaptureVisionRouter())
64+
using (DirectoryFetcher fetcher = new DirectoryFetcher())
65+
{
66+
fetcher.SetDirectory("../../../../../../Images");
67+
cvr.SetInput(fetcher);
68+
69+
CapturedResultReceiver receiver = new MyCapturedResultReceiver();
70+
cvr.AddResultReceiver(receiver);
71+
72+
MyImageSourceStateListener listener = new MyImageSourceStateListener(cvr);
73+
cvr.AddImageSourceStateListener(listener);
74+
75+
errorCode = cvr.StartCapturing(PresetTemplate.PT_READ_BARCODES, true, out errorMsg);
76+
if (errorCode != (int)EnumErrorCode.EC_OK)
77+
{
78+
Console.WriteLine("error: " + errorMsg);
79+
}
80+
}
81+
Console.WriteLine("Press any key to quit...");
82+
Console.Read();
83+
}
84+
}
85+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net7.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="Dynamsoft.DotNet.BarcodeReader.Bundle" Version="10.2.1000" />
12+
13+
14+
15+
16+
17+
</ItemGroup>
18+
19+
</Project>
-172 KB
Loading

images/BarcodeColorMode.png

21.1 KB
Loading

0 commit comments

Comments
 (0)