- API version: 4.0
- SDK version: 25.1.0
- SDK Version 25.1 and Later: Starting from SDK version 25.1, all subsequent versions are compatible with API Version v4.0.
- SDK Version 24.12 and Earlier: These versions are compatible with API Version v3.0.
Scan QR | Generate Barcode | Recognize Barcode |
---|---|---|
Generate Wi-Fi QR | Embed Barcode | Scan Barcode |
Aspose.BarCode for Cloud is a REST API for Linear, 2D and postal barcode generation and recognition in the cloud. API recognizes and generates barcode images in a variety of formats. Barcode REST API allows to specify barcode image attributes like image width, height, border style and output image format in order to customize the generation process. Developers can also specify the barcode type and text attributes such as text location and font styles in order to suit the application requirements.
This repository contains Aspose.BarCode Cloud SDK for Java source code. This SDK allows you to work with Aspose.BarCode for Cloud REST APIs in your Java applications quickly and easily.
Building the API client library requires:
- Java 8 (JDK 1.8)
- Maven
To use Aspose.BarCode Cloud SDK for Java you need to register an account with Aspose Cloud and lookup/create Client Id and Client Secret at Cloud Dashboard. There is free quota available. For more details, see Aspose Cloud Pricing.
Add Aspose Cloud repository to your application pom.xml
<repository>
<id>aspose-cloud</id>
<name>Aspose Cloud Repository</name>
<url>https://releases.aspose.cloud/java/repo/</url>
</repository>
To install the API client library to your local Maven repository, simply execute:
mvn clean install
To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:
mvn clean deploy
Refer to the OSSRH Guide for more information.
Add this dependency to your project's POM:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-barcode-cloud</artifactId>
<version>25.1.0</version>
<scope>compile</scope>
</dependency>
At first generate the JAR by executing:
mvn clean package
Then manually install the following JARs:
target/aspose-barcode-cloud-25.1.0.jar
target/lib/*.jar
Please follow the installation instruction and execute the following Java code:
package com.aspose.barcode.cloud.examples;
import com.aspose.barcode.cloud.ApiClient;
import com.aspose.barcode.cloud.ApiException;
import com.aspose.barcode.cloud.api.GenerateApi;
import com.aspose.barcode.cloud.api.ScanApi;
import com.aspose.barcode.cloud.model.BarcodeImageFormat;
import com.aspose.barcode.cloud.model.BarcodeResponseList;
import com.aspose.barcode.cloud.model.EncodeBarcodeType;
import com.aspose.barcode.cloud.requests.GenerateRequestWrapper;
import com.aspose.barcode.cloud.requests.ScanMultipartRequestWrapper;
import java.io.File;
public class Example {
public static void main(String[] args) {
ApiClient client =
new ApiClient(
"Client Id from https://dashboard.aspose.cloud/applications",
"Client Secret from https://dashboard.aspose.cloud/applications");
GenerateApi genApi = new GenerateApi(client);
ScanApi scanApi = new ScanApi(client);
try {
System.out.println("Generating barcode...");
File barcodeImage = generateBarcode(genApi);
System.out.println("Barcode image saved to file " + barcodeImage.getAbsolutePath());
System.out.println("Recognizing barcode on image...");
BarcodeResponseList recognized = scanBarcode(scanApi, barcodeImage);
System.out.print("Barcode on image:");
System.out.println(recognized.toString());
} catch (ApiException e) {
System.err.println("Error");
e.printStackTrace();
}
}
private static File generateBarcode(GenerateApi api) throws ApiException {
EncodeBarcodeType type = EncodeBarcodeType.QR;
String text = "Aspose.BarCode for Cloud Sample";
GenerateRequestWrapper request = new GenerateRequestWrapper(type, text);
request.imageFormat = BarcodeImageFormat.JPEG;
return api.generate(request);
}
private static BarcodeResponseList scanBarcode(ScanApi api, File barcodeImage)
throws ApiException {
ScanMultipartRequestWrapper request = new ScanMultipartRequestWrapper(barcodeImage);
return api.scanMultipart(request);
}
}
All Aspose.BarCode for Cloud SDKs, helper scripts and templates are licensed under MIT License.
All URIs are relative to https://api.aspose.cloud/v4.0
Class | Method | HTTP request | Description |
---|---|---|---|
GenerateApi | generate | GET /barcode/generate/{barcodeType} | Generate barcode using GET request with parameters in route and query string. |
GenerateApi | generateBody | POST /barcode/generate-body | Generate barcode using POST request with parameters in body in json or xml format. |
GenerateApi | generateMultipart | POST /barcode/generate-multipart | Generate barcode using POST request with parameters in multipart form. |
RecognizeApi | recognize | GET /barcode/recognize | Recognize barcode from file on server using GET requests with parameters in route and query string. |
RecognizeApi | recognizeBase64 | POST /barcode/recognize-body | Recognize barcode from file in request body using POST requests with parameters in body in json or xml format. |
RecognizeApi | recognizeMultipart | POST /barcode/recognize-multipart | Recognize barcode from file in request body using POST requests with parameters in multipart form. |
ScanApi | scan | GET /barcode/scan | Scan barcode from file on server using GET requests with parameter in query string. |
ScanApi | scanBase64 | POST /barcode/scan-body | Scan barcode from file in request body using POST requests with parameter in body in json or xml format. |
ScanApi | scanMultipart | POST /barcode/scan-multipart | Scan barcode from file in request body using POST requests with parameter in multipart form. |
- ApiError
- ApiErrorResponse
- BarcodeImageFormat
- BarcodeImageParams
- BarcodeResponse
- BarcodeResponseList
- CodeLocation
- DecodeBarcodeType
- EncodeBarcodeType
- EncodeData
- EncodeDataType
- GenerateParams
- GraphicsUnit
- RecognitionImageKind
- RecognitionMode
- RecognizeBase64Request
- RegionPoint
- ScanBase64Request
Authentication schemes defined for the API:
- Type: OAuth
- Flow: application
- Authorization URL: https://id.aspose.cloud/connect/token
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.