Skip to content

Commit b14c8e7

Browse files
Release 24.1 (#83)
* "Types" param for multiple barcode types to read added. mostCommonlyUsed decode type added. * Copyright updated * README.md: Insert updated examples --------- Co-authored-by: Denis Averin <denis.averin@aspose.com>
1 parent b9834af commit b14c8e7

114 files changed

Lines changed: 235 additions & 195 deletions

File tree

Some content is hidden

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

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Aspose Pty Ltd
3+
Copyright (c) 2024 Aspose Pty Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 83 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Nuget](https://img.shields.io/nuget/v/Aspose.BarCode-Cloud)](https://www.nuget.org/packages/Aspose.BarCode-Cloud/)
77

88
- API version: 3.0
9-
- SDK version: 23.12.0
9+
- SDK version: 24.1.0
1010

1111
## Demo applications
1212

@@ -71,54 +71,58 @@ using Aspose.BarCode.Cloud.Sdk.Model.Requests;
7171
using System;
7272
using System.IO;
7373
using System.Reflection;
74+
using System.Threading.Tasks;
7475

75-
namespace ReadQR
76+
namespace ReadQR;
77+
78+
internal static class Program
7679
{
77-
internal static class Program
80+
private static Configuration MakeConfiguration()
7881
{
79-
private static Configuration MakeConfiguration()
80-
{
81-
var config = new Configuration();
82-
83-
string envToken = Environment.GetEnvironmentVariable("TEST_CONFIGURATION_JWT_TOKEN");
84-
if (string.IsNullOrEmpty(envToken))
85-
{
86-
config.ClientId = "Client Id from https://dashboard.aspose.cloud/applications";
87-
config.ClientSecret = "Client Secret from https://dashboard.aspose.cloud/applications";
88-
}
89-
else
90-
{
91-
config.JwtToken = envToken;
92-
}
82+
Configuration config = new Configuration();
9383

94-
return config;
84+
string? envToken = Environment.GetEnvironmentVariable("TEST_CONFIGURATION_JWT_TOKEN");
85+
if (string.IsNullOrEmpty(envToken))
86+
{
87+
config.ClientId = "Client Id from https://dashboard.aspose.cloud/applications";
88+
config.ClientSecret = "Client Secret from https://dashboard.aspose.cloud/applications";
89+
}
90+
else
91+
{
92+
config.JwtToken = envToken;
9593
}
9694

97-
private static string ReadQR(IBarcodeApi api, string fileName)
95+
return config;
96+
}
97+
98+
private static async Task<string> ReadQR(IBarcodeApi api, string fileName)
99+
{
100+
await using (FileStream imageStream = File.OpenRead(fileName))
98101
{
99-
using (FileStream imageStream = File.OpenRead(fileName))
100-
{
101-
BarcodeResponseList recognized = api.PostBarcodeRecognizeFromUrlOrContent(
102-
new PostBarcodeRecognizeFromUrlOrContentRequest(image: imageStream)
103-
);
102+
BarcodeResponseList recognized = await api.PostBarcodeRecognizeFromUrlOrContentAsync(
103+
new PostBarcodeRecognizeFromUrlOrContentRequest(image: imageStream)
104+
{
105+
Type = DecodeBarcodeType.QR.ToString(),
106+
Preset = PresetType.HighPerformance.ToString(),
107+
}
108+
);
104109

105-
return recognized.Barcodes[0].BarcodeValue;
106-
}
110+
return recognized.Barcodes[0].BarcodeValue;
107111
}
112+
}
108113

109-
static void Main(string[] args)
110-
{
111-
string fileName = Path.GetFullPath(Path.Join(
112-
Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location),
113-
"..", "..", "..", "..",
114-
"qr.png"
115-
));
114+
public static async Task Main(string[] args)
115+
{
116+
string fileName = Path.GetFullPath(Path.Join(
117+
Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location),
118+
"..", "..", "..", "..",
119+
"qr.png"
120+
));
116121

117-
var api = new BarcodeApi(MakeConfiguration());
122+
BarcodeApi api = new BarcodeApi(MakeConfiguration());
118123

119-
string result = ReadQR(api, fileName);
120-
Console.WriteLine($"File '{fileName}' recognized, result: '{result}'");
121-
}
124+
string result = await ReadQR(api, fileName);
125+
Console.WriteLine($"File '{fileName}' recognized, result: '{result}'");
122126
}
123127
}
124128

@@ -136,61 +140,61 @@ using Aspose.BarCode.Cloud.Sdk.Model.Requests;
136140
using System;
137141
using System.IO;
138142
using System.Reflection;
143+
using System.Threading.Tasks;
144+
145+
namespace GenerateQR;
139146

140-
namespace GenerateQR
147+
internal static class Program
141148
{
142-
class Program
149+
private static Configuration MakeConfiguration()
143150
{
144-
static Configuration MakeConfiguration()
145-
{
146-
var config = new Configuration();
147-
148-
var envToken = Environment.GetEnvironmentVariable("TEST_CONFIGURATION_JWT_TOKEN");
149-
if (string.IsNullOrEmpty(envToken))
150-
{
151-
config.ClientId = "Client Id from https://dashboard.aspose.cloud/applications";
152-
config.ClientSecret = "Client Secret from https://dashboard.aspose.cloud/applications";
153-
}
154-
else
155-
{
156-
config.JwtToken = envToken;
157-
}
151+
Configuration config = new Configuration();
158152

159-
return config;
153+
string? envToken = Environment.GetEnvironmentVariable("TEST_CONFIGURATION_JWT_TOKEN");
154+
if (string.IsNullOrEmpty(envToken))
155+
{
156+
config.ClientId = "Client Id from https://dashboard.aspose.cloud/applications";
157+
config.ClientSecret = "Client Secret from https://dashboard.aspose.cloud/applications";
158+
}
159+
else
160+
{
161+
config.JwtToken = envToken;
160162
}
161163

162-
private static void GenerateQR(IBarcodeApi api, string fileName)
164+
return config;
165+
}
166+
167+
private static async Task GenerateQR(IBarcodeApi api, string fileName)
168+
{
169+
await using (Stream generated = await api.GetBarcodeGenerateAsync(
170+
new GetBarcodeGenerateRequest(
171+
EncodeBarcodeType.QR.ToString(),
172+
"QR code text")
173+
{
174+
TextLocation = "None",
175+
format = "png"
176+
})
177+
)
163178
{
164-
using (Stream generated = api.GetBarcodeGenerate(
165-
new GetBarcodeGenerateRequest(
166-
EncodeBarcodeType.QR.ToString(),
167-
"QR code text")
168-
{
169-
TextLocation = "None",
170-
format = "png"
171-
})
172-
)
179+
await using (FileStream stream = File.Create(fileName))
173180
{
174-
using (FileStream stream = File.Create(fileName))
175-
{
176-
generated.CopyTo(stream);
177-
}
181+
await generated.CopyToAsync(stream);
178182
}
179183
}
184+
}
180185

181-
static void Main(string[] args)
182-
{
183-
string fileName = Path.GetFullPath(Path.Join(
184-
Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location),
185-
"..", "..", "..", "..",
186-
"qr.png"
187-
));
186+
public static async Task Main(string[] args)
187+
{
188+
string fileName = Path.GetFullPath(Path.Join(
189+
Path.GetDirectoryName(Assembly.GetEntryAssembly()!.Location),
190+
"..", "..", "..", "..",
191+
"qr.png"
192+
));
188193

189-
var api = new BarcodeApi(MakeConfiguration());
194+
BarcodeApi api = new BarcodeApi(MakeConfiguration());
190195

191-
GenerateQR(api, fileName);
192-
Console.WriteLine($"File '{fileName}' generated.");
193-
}
196+
await GenerateQR(api, fileName);
197+
Console.WriteLine($"File '{fileName}' generated.");
194198
}
195199
}
196200

docs/BarcodeApi.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ System.IO.Stream
7575
## **GetBarcodeRecognize**
7676

7777
```csharp
78-
BarcodeResponseList GetBarcodeRecognize (string name, string type = null, string checksumValidation = null, bool? detectEncoding = null, string preset = null, int? rectX = null, int? rectY = null, int? rectWidth = null, int? rectHeight = null, bool? stripFNC = null, int? timeout = null, int? medianSmoothingWindowSize = null, bool? allowMedianSmoothing = null, bool? allowComplexBackground = null, bool? allowDatamatrixIndustrialBarcodes = null, bool? allowDecreasedImage = null, bool? allowDetectScanGap = null, bool? allowIncorrectBarcodes = null, bool? allowInvertImage = null, bool? allowMicroWhiteSpotsRemoving = null, bool? allowOneDFastBarcodesDetector = null, bool? allowOneDWipedBarsRestoration = null, bool? allowQRMicroQrRestoration = null, bool? allowRegularImage = null, bool? allowSaltAndPepperFiltering = null, bool? allowWhiteSpotsRemoving = null, bool? checkMore1DVariants = null, bool? fastScanOnly = null, bool? allowAdditionalRestorations = null, double? regionLikelihoodThresholdPercent = null, List<int?> scanWindowSizes = null, double? similarity = null, bool? skipDiagonalSearch = null, bool? readTinyBarcodes = null, string australianPostEncodingTable = null, bool? ignoreEndingFillingPatternsForCTable = null, string storage = null, string folder = null)
78+
BarcodeResponseList GetBarcodeRecognize (string name, string type = null, List<DecodeBarcodeType> types = null, string checksumValidation = null, bool? detectEncoding = null, string preset = null, int? rectX = null, int? rectY = null, int? rectWidth = null, int? rectHeight = null, bool? stripFNC = null, int? timeout = null, int? medianSmoothingWindowSize = null, bool? allowMedianSmoothing = null, bool? allowComplexBackground = null, bool? allowDatamatrixIndustrialBarcodes = null, bool? allowDecreasedImage = null, bool? allowDetectScanGap = null, bool? allowIncorrectBarcodes = null, bool? allowInvertImage = null, bool? allowMicroWhiteSpotsRemoving = null, bool? allowOneDFastBarcodesDetector = null, bool? allowOneDWipedBarsRestoration = null, bool? allowQRMicroQrRestoration = null, bool? allowRegularImage = null, bool? allowSaltAndPepperFiltering = null, bool? allowWhiteSpotsRemoving = null, bool? checkMore1DVariants = null, bool? fastScanOnly = null, bool? allowAdditionalRestorations = null, double? regionLikelihoodThresholdPercent = null, List<int?> scanWindowSizes = null, double? similarity = null, bool? skipDiagonalSearch = null, bool? readTinyBarcodes = null, string australianPostEncodingTable = null, bool? ignoreEndingFillingPatternsForCTable = null, string storage = null, string folder = null)
7979
```
8080

8181
Recognize barcode from a file on server.
@@ -86,6 +86,7 @@ Name | Type | Description | Notes
8686
---- | ---- | ------------ | -----
8787
**name** | **string**| The image file name. |
8888
**type** | **string**| The type of barcode to read. | [optional]
89+
**types** | [**List&lt;DecodeBarcodeType&gt;**](DecodeBarcodeType.md)| Multiple barcode types to read. | [optional]
8990
**checksumValidation** | **string**| Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies | [optional]
9091
**detectEncoding** | **bool?**| A flag which force engine to detect codetext encoding for Unicode. | [optional]
9192
**preset** | **string**| Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality. | [optional]
@@ -136,7 +137,7 @@ Name | Type | Description | Notes
136137
## **PostBarcodeRecognizeFromUrlOrContent**
137138

138139
```csharp
139-
BarcodeResponseList PostBarcodeRecognizeFromUrlOrContent (string type = null, string checksumValidation = null, bool? detectEncoding = null, string preset = null, int? rectX = null, int? rectY = null, int? rectWidth = null, int? rectHeight = null, bool? stripFNC = null, int? timeout = null, int? medianSmoothingWindowSize = null, bool? allowMedianSmoothing = null, bool? allowComplexBackground = null, bool? allowDatamatrixIndustrialBarcodes = null, bool? allowDecreasedImage = null, bool? allowDetectScanGap = null, bool? allowIncorrectBarcodes = null, bool? allowInvertImage = null, bool? allowMicroWhiteSpotsRemoving = null, bool? allowOneDFastBarcodesDetector = null, bool? allowOneDWipedBarsRestoration = null, bool? allowQRMicroQrRestoration = null, bool? allowRegularImage = null, bool? allowSaltAndPepperFiltering = null, bool? allowWhiteSpotsRemoving = null, bool? checkMore1DVariants = null, bool? fastScanOnly = null, bool? allowAdditionalRestorations = null, double? regionLikelihoodThresholdPercent = null, List<int?> scanWindowSizes = null, double? similarity = null, bool? skipDiagonalSearch = null, bool? readTinyBarcodes = null, string australianPostEncodingTable = null, bool? ignoreEndingFillingPatternsForCTable = null, string url = null, System.IO.Stream image = null)
140+
BarcodeResponseList PostBarcodeRecognizeFromUrlOrContent (string type = null, List<DecodeBarcodeType> types = null, string checksumValidation = null, bool? detectEncoding = null, string preset = null, int? rectX = null, int? rectY = null, int? rectWidth = null, int? rectHeight = null, bool? stripFNC = null, int? timeout = null, int? medianSmoothingWindowSize = null, bool? allowMedianSmoothing = null, bool? allowComplexBackground = null, bool? allowDatamatrixIndustrialBarcodes = null, bool? allowDecreasedImage = null, bool? allowDetectScanGap = null, bool? allowIncorrectBarcodes = null, bool? allowInvertImage = null, bool? allowMicroWhiteSpotsRemoving = null, bool? allowOneDFastBarcodesDetector = null, bool? allowOneDWipedBarsRestoration = null, bool? allowQRMicroQrRestoration = null, bool? allowRegularImage = null, bool? allowSaltAndPepperFiltering = null, bool? allowWhiteSpotsRemoving = null, bool? checkMore1DVariants = null, bool? fastScanOnly = null, bool? allowAdditionalRestorations = null, double? regionLikelihoodThresholdPercent = null, List<int?> scanWindowSizes = null, double? similarity = null, bool? skipDiagonalSearch = null, bool? readTinyBarcodes = null, string australianPostEncodingTable = null, bool? ignoreEndingFillingPatternsForCTable = null, string url = null, System.IO.Stream image = null)
140141
```
141142

142143
Recognize barcode from an url or from request body. Request body can contain raw data bytes of the image with content-type \"application/octet-stream\". An image can also be passed as a form field.
@@ -146,6 +147,7 @@ Recognize barcode from an url or from request body. Request body can contain raw
146147
Name | Type | Description | Notes
147148
---- | ---- | ------------ | -----
148149
**type** | **string**| The type of barcode to read. | [optional]
150+
**types** | [**List&lt;DecodeBarcodeType&gt;**](DecodeBarcodeType.md)| Multiple barcode types to read. | [optional]
149151
**checksumValidation** | **string**| Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies | [optional]
150152
**detectEncoding** | **bool?**| A flag which force engine to detect codetext encoding for Unicode. | [optional]
151153
**preset** | **string**| Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality. | [optional]

docs/DecodeBarcodeType.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,4 @@ See DecodeType
8888
* GS1Aztec
8989
* GS1CompositeBar
9090
* GS1MicroPdf417
91+
* mostCommonlyUsed

docs/ReaderParams.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Represents BarcodeReader object.
77
Name | Type | Description | Notes
88
---- | ---- | ----------- | -----
99
**Type** | **DecodeBarcodeType** | The type of barcode to read. | [optional]
10+
**Types** | [**List&lt;DecodeBarcodeType&gt;**](DecodeBarcodeType.md) | Multiple barcode types to read. | [optional]
1011
**ChecksumValidation** | **ChecksumValidation** | Enable checksum validation during recognition for 1D barcodes. Default is treated as Yes for symbologies which must contain checksum, as No where checksum only possible. Checksum never used: Codabar Checksum is possible: Code39 Standard/Extended, Standard2of5, Interleaved2of5, Matrix2of5, ItalianPost25, DeutschePostIdentcode, DeutschePostLeitcode, VIN Checksum always used: Rest symbologies | [optional]
1112
**DetectEncoding** | **bool?** | A flag which force engine to detect codetext encoding for Unicode. | [optional]
1213
**Preset** | **PresetType** | Preset allows to configure recognition quality and speed manually. You can quickly set up Preset by embedded presets: HighPerformance, NormalQuality, HighQuality, MaxBarCodes or you can manually configure separate options. Default value of Preset is NormalQuality. | [optional]

examples/GenerateQR/GenerateQR.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Aspose.BarCode-Cloud" Version="23.12.0" />
10+
<PackageReference Include="Aspose.BarCode-Cloud" Version="24.1.0" />
1111
</ItemGroup>
1212

1313
</Project>

examples/ReadQR/ReadQR.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Aspose.BarCode-Cloud" Version="23.12.0" />
10+
<PackageReference Include="Aspose.BarCode-Cloud" Version="24.1.0" />
1111
</ItemGroup>
1212

1313
</Project>

src/Api/BarcodeApi.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// --------------------------------------------------------------------------------------------------------------------
22
// <copyright company="Aspose" file="BarcodeApi.cs">
3-
// Copyright (c) 2023 Aspose.BarCode for Cloud
3+
// Copyright (c) 2024 Aspose.BarCode for Cloud
44
// </copyright>
55
// <summary>
66
// Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -400,6 +400,9 @@ public BarcodeResponseList GetBarcodeRecognize(GetBarcodeRecognizeRequest reques
400400
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "type", request.Type);
401401

402402

403+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "types", request.Types);
404+
405+
403406
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "checksumValidation", request.ChecksumValidation);
404407

405408

@@ -549,6 +552,9 @@ public async Task<BarcodeResponseList> GetBarcodeRecognizeAsync(GetBarcodeRecogn
549552
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "type", request.Type);
550553

551554

555+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "types", request.Types);
556+
557+
552558
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "checksumValidation", request.ChecksumValidation);
553559

554560

@@ -695,6 +701,9 @@ public BarcodeResponseList PostBarcodeRecognizeFromUrlOrContent(PostBarcodeRecog
695701
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "type", request.Type);
696702

697703

704+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "types", request.Types);
705+
706+
698707
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "checksumValidation", request.ChecksumValidation);
699708

700709

@@ -841,6 +850,9 @@ public async Task<BarcodeResponseList> PostBarcodeRecognizeFromUrlOrContentAsync
841850
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "type", request.Type);
842851

843852

853+
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "types", request.Types);
854+
855+
844856
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "checksumValidation", request.ChecksumValidation);
845857

846858

src/Api/Configuration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// --------------------------------------------------------------------------------------------------------------------
22
// <copyright company="Aspose" file="Configuration.cs">
3-
// Copyright (c) 2023 Aspose.BarCode for Cloud
3+
// Copyright (c) 2024 Aspose.BarCode for Cloud
44
// </copyright>
55
// <summary>
66
// Permission is hereby granted, free of charge, to any person obtaining a copy

src/Api/FileApi.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// --------------------------------------------------------------------------------------------------------------------
22
// <copyright company="Aspose" file="FileApi.cs">
3-
// Copyright (c) 2023 Aspose.BarCode for Cloud
3+
// Copyright (c) 2024 Aspose.BarCode for Cloud
44
// </copyright>
55
// <summary>
66
// Permission is hereby granted, free of charge, to any person obtaining a copy

0 commit comments

Comments
 (0)