Skip to content

Commit 4d84075

Browse files
authored
Release 24.9 (#93)
* Update documentation * Add checksumValidation to Scan endpoint * Add test for Code39 type without checksum
1 parent 948fb8d commit 4d84075

File tree

12 files changed

+65
-50
lines changed

12 files changed

+65
-50
lines changed

.github/workflows/net-framework.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: |
4242
$ErrorActionPreference = "Stop"
4343
VSTest.Console.exe /Framework:".NETFramework,Version=${{ matrix.net-version }}" /ResultsDirectory:Tests\Results /Logger:"trx;LogFileName=test.log" Tests\bin\Release\${{ matrix.framework }}\Aspose.BarCode.Cloud.Sdk.Tests.dll
44-
if( ([xml](Get-Content Tests\Results\test.log)).TestRun.ResultSummary.Counters.total -ne 28 ){ throw "Not all tests were explored or added new tests" }
44+
if( ([xml](Get-Content Tests\Results\test.log)).TestRun.ResultSummary.Counters.total -ne 29 ){ throw "Not all tests were explored or added new tests" }
4545
4646
env:
4747
TEST_CONFIGURATION_JWT_TOKEN: ${{ secrets.TEST_CONFIGURATION_ACCESS_TOKEN }}

Tests/ScanTests.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,27 @@ await _api.ScanBarcodeAsync(
6363
Assert.IsNotNull(apiException);
6464
Assert.AreEqual(408, apiException.ErrorCode);
6565
}
66+
67+
68+
[Test]
69+
public async Task ScanCode39Test()
70+
{
71+
// Arrange
72+
using Stream image = GetTestImage("Code39.jpg");
73+
74+
// Act
75+
BarcodeResponseList response = await _api.ScanBarcodeAsync(
76+
new ScanBarcodeRequest(image)
77+
{
78+
decodeTypes = new List<DecodeBarcodeType> { DecodeBarcodeType.Code39Extended },
79+
checksumValidation = ChecksumValidation.Off.ToString(),
80+
}
81+
);
82+
83+
// Assert
84+
Assert.AreEqual(1, response.Barcodes.Count);
85+
Assert.AreEqual(DecodeBarcodeType.Code39Extended.ToString(), response.Barcodes[0].Type);
86+
Assert.AreEqual("8M93", response.Barcodes[0].BarcodeValue);
87+
}
6688
}
6789
}

Tests/test_data/Code39.jpg

24.2 KB
Loading

docs/BarcodeApi.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Method | HTTP request | Description
1717
## **GetBarcodeGenerate**
1818

1919
```csharp
20-
System.IO.Stream GetBarcodeGenerate (string type, string text, string twoDDisplayText = null, string textLocation = null, string textAlignment = null, string textColor = null, string fontSizeMode = null, bool? noWrap = null, double? resolution = null, double? resolutionX = null, double? resolutionY = null, double? dimensionX = null, double? textSpace = null, string units = null, string sizeMode = null, double? barHeight = null, double? imageHeight = null, double? imageWidth = null, double? rotationAngle = null, string backColor = null, string barColor = null, string borderColor = null, double? borderWidth = null, string borderDashStyle = null, bool? borderVisible = null, string enableChecksum = null, bool? enableEscape = null, bool? filledBars = null, bool? alwaysShowChecksum = null, double? wideNarrowRatio = null, bool? validateText = null, string supplementData = null, double? supplementSpace = null, double? barWidthReduction = null, bool? useAntiAlias = null, string format = null)
20+
System.IO.Stream GetBarcodeGenerate (string type, string text, string twoDDisplayText = null, string textLocation = null, string textAlignment = null, string textColor = null, bool? noWrap = null, double? resolution = null, double? resolutionX = null, double? resolutionY = null, double? dimensionX = null, double? textSpace = null, string units = null, string sizeMode = null, double? barHeight = null, double? imageHeight = null, double? imageWidth = null, double? rotationAngle = null, string backColor = null, string barColor = null, string borderColor = null, double? borderWidth = null, string borderDashStyle = null, bool? borderVisible = null, string enableChecksum = null, bool? enableEscape = null, bool? filledBars = null, bool? alwaysShowChecksum = null, double? wideNarrowRatio = null, bool? validateText = null, string supplementData = null, double? supplementSpace = null, double? barWidthReduction = null, bool? useAntiAlias = null, string format = null)
2121
```
2222

2323
Generate barcode.
@@ -31,8 +31,7 @@ Name | Type | Description | Notes
3131
**twoDDisplayText** | **string**| Text that will be displayed instead of codetext in 2D barcodes. Used for: Aztec, Pdf417, DataMatrix, QR, MaxiCode, DotCode | [optional]
3232
**textLocation** | **string**| Specify the displaying Text Location, set to CodeLocation.None to hide CodeText. Default value: CodeLocation.Below. | [optional]
3333
**textAlignment** | **string**| Text alignment. | [optional]
34-
**textColor** | **string**| Specify the displaying CodeText&#39;s Color. Default value: Color.Black. | [optional]
35-
**fontSizeMode** | **string**| Specify FontSizeMode. If FontSizeMode is set to Auto, font size will be calculated automatically based on xDimension value. It is recommended to use FontSizeMode.Auto especially in AutoSizeMode.Nearest or AutoSizeMode.Interpolation. Default value: FontSizeMode.Auto. | [optional]
34+
**textColor** | **string**| Specify the displaying CodeText&#39;s Color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
3635
**noWrap** | **bool?**| Specify word wraps (line breaks) within text. Default value: false. | [optional]
3736
**resolution** | **double?**| Resolution of the BarCode image. One value for both dimensions. Default value: 96 dpi. | [optional]
3837
**resolutionX** | **double?**| DEPRECATED: Use &#39;Resolution&#39; instead. | [optional]
@@ -45,9 +44,9 @@ Name | Type | Description | Notes
4544
**imageHeight** | **double?**| Height of the barcode image in given units. Default units: pixel. | [optional]
4645
**imageWidth** | **double?**| Width of the barcode image in given units. Default units: pixel. | [optional]
4746
**rotationAngle** | **double?**| BarCode image rotation angle, measured in degree, e.g. RotationAngle &#x3D; 0 or RotationAngle &#x3D; 360 means no rotation. If RotationAngle NOT equal to 90, 180, 270 or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. | [optional]
48-
**backColor** | **string**| Background color of the barcode image. Default value: Color.White. | [optional]
49-
**barColor** | **string**| Bars color. Default value: Color.Black. | [optional]
50-
**borderColor** | **string**| Border color. Default value: Color.Black. | [optional]
47+
**backColor** | **string**| Background color of the barcode image. Default value: white. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
48+
**barColor** | **string**| Bars color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
49+
**borderColor** | **string**| Border color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
5150
**borderWidth** | **double?**| Border width. Default value: 0. Ignored if Visible is set to false. | [optional]
5251
**borderDashStyle** | **string**| Border dash style. Default value: BorderDashStyle.Solid. | [optional]
5352
**borderVisible** | **bool?**| Border visibility. If false than parameter Width is always ignored (0). Default value: false. | [optional]
@@ -224,7 +223,7 @@ System.IO.Stream
224223
## **PutBarcodeGenerateFile**
225224

226225
```csharp
227-
ResultImageInfo PutBarcodeGenerateFile (string name, string type, string text, string twoDDisplayText = null, string textLocation = null, string textAlignment = null, string textColor = null, string fontSizeMode = null, bool? noWrap = null, double? resolution = null, double? resolutionX = null, double? resolutionY = null, double? dimensionX = null, double? textSpace = null, string units = null, string sizeMode = null, double? barHeight = null, double? imageHeight = null, double? imageWidth = null, double? rotationAngle = null, string backColor = null, string barColor = null, string borderColor = null, double? borderWidth = null, string borderDashStyle = null, bool? borderVisible = null, string enableChecksum = null, bool? enableEscape = null, bool? filledBars = null, bool? alwaysShowChecksum = null, double? wideNarrowRatio = null, bool? validateText = null, string supplementData = null, double? supplementSpace = null, double? barWidthReduction = null, bool? useAntiAlias = null, string storage = null, string folder = null, string format = null)
226+
ResultImageInfo PutBarcodeGenerateFile (string name, string type, string text, string twoDDisplayText = null, string textLocation = null, string textAlignment = null, string textColor = null, bool? noWrap = null, double? resolution = null, double? resolutionX = null, double? resolutionY = null, double? dimensionX = null, double? textSpace = null, string units = null, string sizeMode = null, double? barHeight = null, double? imageHeight = null, double? imageWidth = null, double? rotationAngle = null, string backColor = null, string barColor = null, string borderColor = null, double? borderWidth = null, string borderDashStyle = null, bool? borderVisible = null, string enableChecksum = null, bool? enableEscape = null, bool? filledBars = null, bool? alwaysShowChecksum = null, double? wideNarrowRatio = null, bool? validateText = null, string supplementData = null, double? supplementSpace = null, double? barWidthReduction = null, bool? useAntiAlias = null, string storage = null, string folder = null, string format = null)
228227
```
229228

230229
Generate barcode and save on server (from query params or from file with json or xml content)
@@ -239,8 +238,7 @@ Name | Type | Description | Notes
239238
**twoDDisplayText** | **string**| Text that will be displayed instead of codetext in 2D barcodes. Used for: Aztec, Pdf417, DataMatrix, QR, MaxiCode, DotCode | [optional]
240239
**textLocation** | **string**| Specify the displaying Text Location, set to CodeLocation.None to hide CodeText. Default value: CodeLocation.Below. | [optional]
241240
**textAlignment** | **string**| Text alignment. | [optional]
242-
**textColor** | **string**| Specify the displaying CodeText&#39;s Color. Default value: Color.Black. | [optional]
243-
**fontSizeMode** | **string**| Specify FontSizeMode. If FontSizeMode is set to Auto, font size will be calculated automatically based on xDimension value. It is recommended to use FontSizeMode.Auto especially in AutoSizeMode.Nearest or AutoSizeMode.Interpolation. Default value: FontSizeMode.Auto. | [optional]
241+
**textColor** | **string**| Specify the displaying CodeText&#39;s Color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
244242
**noWrap** | **bool?**| Specify word wraps (line breaks) within text. Default value: false. | [optional]
245243
**resolution** | **double?**| Resolution of the BarCode image. One value for both dimensions. Default value: 96 dpi. | [optional]
246244
**resolutionX** | **double?**| DEPRECATED: Use &#39;Resolution&#39; instead. | [optional]
@@ -253,9 +251,9 @@ Name | Type | Description | Notes
253251
**imageHeight** | **double?**| Height of the barcode image in given units. Default units: pixel. | [optional]
254252
**imageWidth** | **double?**| Width of the barcode image in given units. Default units: pixel. | [optional]
255253
**rotationAngle** | **double?**| BarCode image rotation angle, measured in degree, e.g. RotationAngle &#x3D; 0 or RotationAngle &#x3D; 360 means no rotation. If RotationAngle NOT equal to 90, 180, 270 or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. | [optional]
256-
**backColor** | **string**| Background color of the barcode image. Default value: Color.White. | [optional]
257-
**barColor** | **string**| Bars color. Default value: Color.Black. | [optional]
258-
**borderColor** | **string**| Border color. Default value: Color.Black. | [optional]
254+
**backColor** | **string**| Background color of the barcode image. Default value: white. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
255+
**barColor** | **string**| Bars color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
256+
**borderColor** | **string**| Border color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
259257
**borderWidth** | **double?**| Border width. Default value: 0. Ignored if Visible is set to false. | [optional]
260258
**borderDashStyle** | **string**| Border dash style. Default value: BorderDashStyle.Solid. | [optional]
261259
**borderVisible** | **bool?**| Border visibility. If false than parameter Width is always ignored (0). Default value: false. | [optional]
@@ -342,7 +340,7 @@ Name | Type | Description | Notes
342340
## **ScanBarcode**
343341

344342
```csharp
345-
BarcodeResponseList ScanBarcode (System.IO.Stream imageFile, List<DecodeBarcodeType> decodeTypes = null, int? timeout = null)
343+
BarcodeResponseList ScanBarcode (System.IO.Stream imageFile, List<DecodeBarcodeType> decodeTypes = null, int? timeout = null, string checksumValidation = null)
346344
```
347345

348346
Quickly scan a barcode from an image.
@@ -354,6 +352,7 @@ Name | Type | Description | Notes
354352
**imageFile** | **System.IO.Stream**| Image as file |
355353
**decodeTypes** | [**List&lt;DecodeBarcodeType&gt;**](DecodeBarcodeType.md)| Types of barcode to recognize | [optional]
356354
**timeout** | **int?**| Timeout of recognition process in milliseconds. Default value is 15_000 (15 seconds). Maximum value is 30_000 (1/2 minute). In case of a timeout RequestTimeout (408) status will be returned. Try reducing the image size to avoid timeout. | [optional]
355+
**checksumValidation** | **string**| Checksum validation setting. Default is ON. | [optional]
357356

358357
### Return type
359358

docs/CaptionParams.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Name | Type | Description | Notes
88
---- | ---- | ----------- | -----
99
**Text** | **string** | Caption text. | [optional]
1010
**Alignment** | **TextAlignment** | Text alignment. | [optional]
11-
**Color** | **string** | Text color. | [optional]
11+
**Color** | **string** | Text color. Default value: black Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
1212
**Visible** | **bool?** | Is caption visible. | [optional]
1313
**Font** | [**FontParams**](FontParams.md) | Font. | [optional]
1414
**Padding** | [**Padding**](Padding.md) | Padding. | [optional]

docs/GeneratorParams.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Name | Type | Description | Notes
1111
**TwoDDisplayText** | **string** | Text that will be displayed instead of codetext in 2D barcodes. Used for: Aztec, Pdf417, DataMatrix, QR, MaxiCode, DotCode | [optional]
1212
**TextLocation** | **CodeLocation** | Specify the displaying Text Location, set to CodeLocation.None to hide CodeText. Default value: CodeLocation.Below. | [optional]
1313
**TextAlignment** | **TextAlignment** | Text alignment. | [optional]
14-
**TextColor** | **string** | Specify the displaying CodeText&#39;s Color. Default value: Color.Black. | [optional]
14+
**TextColor** | **string** | Specify the displaying CodeText&#39;s Color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
1515
**Font** | [**FontParams**](FontParams.md) | Specify the displaying Text&#39;s font. Default value: Arial 5pt regular. Ignored if FontSizeMode is set to FontSizeMode.Auto. | [optional]
1616
**FontSizeMode** | **FontMode** | Specify FontSizeMode. If FontSizeMode is set to Auto, font size will be calculated automatically based on xDimension value. It is recommended to use FontSizeMode.Auto especially in AutoSizeMode.Nearest or AutoSizeMode.Interpolation. Default value: FontSizeMode.Auto. | [optional]
1717
**NoWrap** | **bool?** | Specify word wraps (line breaks) within text. Default value: false. | [optional]
@@ -29,9 +29,9 @@ Name | Type | Description | Notes
2929
**Padding** | [**Padding**](Padding.md) | Barcode paddings. Default value: 5pt 5pt 5pt 5pt. | [optional]
3030
**CaptionAbove** | [**CaptionParams**](CaptionParams.md) | Additional caption above barcode. | [optional]
3131
**CaptionBelow** | [**CaptionParams**](CaptionParams.md) | Additional caption below barcode. | [optional]
32-
**BackColor** | **string** | Background color of the barcode image. Default value: Color.White. | [optional]
33-
**BarColor** | **string** | Bars color. Default value: Color.Black. | [optional]
34-
**BorderColor** | **string** | Border color. Default value: Color.Black. | [optional]
32+
**BackColor** | **string** | Background color of the barcode image. Default value: white. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
33+
**BarColor** | **string** | Bars color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
34+
**BorderColor** | **string** | Border color. Default value: black. Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF | [optional]
3535
**BorderWidth** | **double?** | Border width. Default value: 0. Ignored if Visible is set to false. | [optional]
3636
**BorderDashStyle** | **BorderDashStyle** | Border dash style. Default value: BorderDashStyle.Solid. | [optional]
3737
**BorderVisible** | **bool?** | Border visibility. If false than parameter Width is always ignored (0). Default value: false. | [optional]
@@ -60,5 +60,5 @@ Name | Type | Description | Notes
6060
**Postal** | [**PostalParams**](PostalParams.md) | Postal params. | [optional]
6161
**QR** | [**QrParams**](QrParams.md) | QR params. | [optional]
6262
**PatchCode** | [**PatchCodeParams**](PatchCodeParams.md) | PatchCode params. | [optional]
63-
**Code128** | [**Code128Params**](Code128Params.md) | Code128 params. | [optional]
63+
**Code128** | [**Code128Params**](Code128Params.md) | Code128 parameters | [optional]
6464
**HanXin** | [**HanXinParams**](HanXinParams.md) | HanXin params. | [optional]

src/Api/BarcodeApi.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ public BarcodeApi(string clientSecret, string clientId)
128128
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "textColor", request.TextColor);
129129

130130

131-
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "fontSizeMode", request.FontSizeMode);
132-
133-
134131
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "noWrap", request.NoWrap);
135132

136133

@@ -608,9 +605,6 @@ public async Task<ResultImageInfo> PutBarcodeGenerateFileAsync(PutBarcodeGenerat
608605
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "textColor", request.TextColor);
609606

610607

611-
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "fontSizeMode", request.FontSizeMode);
612-
613-
614608
resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "noWrap", request.NoWrap);
615609

616610

@@ -848,6 +842,7 @@ public async Task<BarcodeResponseList> ScanBarcodeAsync(ScanBarcodeRequest reque
848842

849843

850844

845+
851846
if (request.imageFile != null)
852847
{
853848
formParams.Add(new StreamContent(request.imageFile), "imageFile", "imageFile.png");
@@ -863,6 +858,10 @@ public async Task<BarcodeResponseList> ScanBarcodeAsync(ScanBarcodeRequest reque
863858
{
864859
formParams.Add(new StringContent($"{request.timeout}"), "timeout");
865860
}
861+
if (request.checksumValidation != null)
862+
{
863+
formParams.Add(new StringContent($"{request.checksumValidation}"), "checksumValidation");
864+
}
866865
string response = await _apiInvoker.InvokeApiAsync(
867866
resourcePath,
868867
"POST",

src/Model/CaptionParams.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class CaptionParams : IToString
2323
public string Text { get; set; }
2424

2525
/// <summary>
26-
/// Text color.
26+
/// Text color. Default value: black Use named colors like: red, green, blue Or HTML colors like: #FF0000, #00FF00, #0000FF
2727
/// </summary>
2828
public string Color { get; set; }
2929

0 commit comments

Comments
 (0)