5
5
[ ![ Maven metadata URL] ( https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Freleases.aspose.cloud%2Fjava%2Frepo%2Fcom%2Faspose%2Faspose-barcode-cloud%2Fmaven-metadata.xml )] ( https://releases.aspose.cloud/java/repo/com/aspose/aspose-barcode-cloud/ )
6
6
7
7
- API version: 3.0
8
- - SDK version: 24.6 .0
8
+ - SDK version: 24.7 .0
9
9
10
10
## Demo applications
11
11
@@ -68,7 +68,7 @@ Add this dependency to your project's POM:
68
68
<dependency >
69
69
<groupId >com.aspose</groupId >
70
70
<artifactId >aspose-barcode-cloud</artifactId >
71
- <version >24.6 .0</version >
71
+ <version >24.7 .0</version >
72
72
<scope >compile</scope >
73
73
</dependency >
74
74
```
@@ -83,29 +83,34 @@ mvn clean package
83
83
84
84
Then manually install the following JARs:
85
85
86
- - ` target/aspose-barcode-cloud-24.6 .0.jar `
86
+ - ` target/aspose-barcode-cloud-24.7 .0.jar `
87
87
- ` target/lib/*.jar `
88
88
89
89
## Getting Started
90
90
91
91
Please follow the [ installation] ( #installation ) instruction and execute the following Java code:
92
92
93
93
``` java
94
+ package com.aspose.barcode.cloud.examples ;
95
+
96
+ import com.aspose.barcode.cloud.ApiClient ;
97
+ import com.aspose.barcode.cloud.ApiException ;
94
98
import com.aspose.barcode.cloud.api.BarcodeApi ;
95
99
import com.aspose.barcode.cloud.model.BarcodeResponseList ;
100
+ import com.aspose.barcode.cloud.model.DecodeBarcodeType ;
96
101
import com.aspose.barcode.cloud.model.EncodeBarcodeType ;
97
- import com.aspose.barcode.cloud.model.PresetType ;
98
102
import com.aspose.barcode.cloud.requests.GetBarcodeGenerateRequest ;
99
- import com.aspose.barcode.cloud.requests.PostBarcodeRecognizeFromUrlOrContentRequest ;
103
+ import com.aspose.barcode.cloud.requests.ScanBarcodeRequest ;
100
104
101
105
import java.io.File ;
106
+ import java.util.Collections ;
102
107
103
- public class BarcodeApiExample {
108
+ public class Example {
104
109
public static void main (String [] args ) {
105
- ApiClient client = new ApiClient (
106
- " Client Id from https://dashboard.aspose.cloud/applications " ,
107
- " Client Secret from https://dashboard.aspose.cloud/applications"
108
- );
110
+ ApiClient client =
111
+ new ApiClient (
112
+ " Client Id from https://dashboard.aspose.cloud/applications" ,
113
+ " Client Secret from https://dashboard.aspose.cloud/applications " );
109
114
client. setReadTimeout(5 * 60 * 1000 );
110
115
111
116
BarcodeApi api = new BarcodeApi (client);
@@ -116,7 +121,7 @@ public class BarcodeApiExample {
116
121
System . out. println(" Barcode image saved to file " + barcodeImage. getAbsolutePath());
117
122
118
123
System . out. println(" Recognizing barcode on image..." );
119
- BarcodeResponseList recognized = recognizeBarcode (api, barcodeImage);
124
+ BarcodeResponseList recognized = scanBarcode (api, barcodeImage);
120
125
System . out. print(" Barcode on image:" );
121
126
System . out. println(recognized. toString());
122
127
} catch (ApiException e) {
@@ -130,18 +135,19 @@ public class BarcodeApiExample {
130
135
String text = " Aspose.BarCode for Cloud Sample" ;
131
136
GetBarcodeGenerateRequest request = new GetBarcodeGenerateRequest (type, text);
132
137
request. textLocation = " None" ;
133
-
138
+
134
139
return api. getBarcodeGenerate(request);
135
140
}
136
141
137
- private static BarcodeResponseList recognizeBarcode (BarcodeApi api , File barcodeImage ) throws ApiException {
138
- PostBarcodeRecognizeFromUrlOrContentRequest recognizeRequest = new PostBarcodeRecognizeFromUrlOrContentRequest ();
139
- recognizeRequest . image = barcodeImage;
140
- recognizeRequest . preset = PresetType . HIGHPERFORMANCE . toString( );
142
+ private static BarcodeResponseList scanBarcode (BarcodeApi api , File barcodeImage )
143
+ throws ApiException {
144
+ ScanBarcodeRequest request = new ScanBarcodeRequest ( barcodeImage) ;
145
+ request . decodeTypes = Collections . singletonList( DecodeBarcodeType . QR );
141
146
142
- return api. postBarcodeRecognizeFromUrlOrContent(recognizeRequest );
147
+ return api. scanBarcode(request );
143
148
}
144
149
}
150
+
145
151
```
146
152
147
153
## Licensing
@@ -281,3 +287,4 @@ Authentication schemes defined for the API:
281
287
## Recommendation
282
288
283
289
It's recommended to create an instance of ` ApiClient ` per thread in a multithreaded environment to avoid any potential issues.
290
+
0 commit comments