Barcodes are ubiquitous in commerce and retail to aid product tracking, purchases, and inventory. They enable organizations to keep accurate records of their supplies, goods and other items that are key to their operations. For international and national use, there are different barcodes that are used in specific contexts. For example, UPC and EAN barcodes look the same in their formatting and can be used in a similar way, but UPC is basically a North American encoding system; however, UPC and EAN are used all over the world. QR codes are also used all over the world, but they are commonly used to exchange complex sets of information, such as product details or links to websites.
The following five APIs will allow you to create barcode images in the three previously mentioned formats. This will allow you to print or create a package with your personal barcodes attached, without having to retrieve it from an external source. This can be especially useful for small businesses as it provides greater company independence and improves the visual and professional appeal of your products.
To use any of the following APIs, you first need to link to the SDK with Maven or Gradle. To install from Maven add the Jitpack repository link to pom.xml:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Then add a link to the dependency:
<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v3.54</version>
</dependency>
</dependencies>
To install your desired dependency using Gradle, add a link to your root build.gradle at the end of the repositories:
allprojects { repositories { ... maven { url 'https://jitpack.io' } } }
build.gradle:
dependencies {
implementation 'com.github.Cloudmersive:Cloudmersive.APIClient.Java:v3.54'
}
- UPC : UPC-A UPC-E. UPC-A — - UPC, 12 , . UPC-E , 12- 6 . UPC , UPC-E. , . - UPC-A, SDK, , :
// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.GenerateBarcodeApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
GenerateBarcodeApi apiInstance = new GenerateBarcodeApi();
String value = "value_example"; // String | UPC-A barcode value to generate from
try {
byte[] result = apiInstance.generateBarcodeUPCA(value);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling GenerateBarcodeApi#generateBarcodeUPCA");
e.printStackTrace();
}
, , — - UPC, . , - PNG. API , :
- UPC .
API, 800 API. - Cloudmersive.
UPC-E, , :
// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.GenerateBarcodeApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
GenerateBarcodeApi apiInstance = new GenerateBarcodeApi();
String value = "value_example"; // String | UPC-E barcode value to generate from
try {
byte[] result = apiInstance.generateBarcodeUPCE(value);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling GenerateBarcodeApi#generateBarcodeUPCE");
e.printStackTrace();
}
- EAN , . EAN — EAN-13 EAN-8, EAN-13 . UPC, EAN , . EAN-13 13 , , , . EAN-8 8 , EAN-13.
EAN-13, SDK, , :
// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.GenerateBarcodeApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
GenerateBarcodeApi apiInstance = new GenerateBarcodeApi();
String value = "value_example"; // String | Barcode value to generate from
try {
byte[] result = apiInstance.generateBarcodeEAN13(value);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling GenerateBarcodeApi#generateBarcodeEAN13");
e.printStackTrace();
}
EAN-8 :
// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.GenerateBarcodeApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
GenerateBarcodeApi apiInstance = new GenerateBarcodeApi();
String value = "value_example"; // String | Barcode value to generate from
try {
byte[] result = apiInstance.generateBarcodeEAN8(value);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling GenerateBarcodeApi#generateBarcodeEAN8");
e.printStackTrace();
}
- , , . , , QR- 2D. QR-, Quick Return code ( ), , QR-, . , .
QR-, :
// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.GenerateBarcodeApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
GenerateBarcodeApi apiInstance = new GenerateBarcodeApi();
String value = "value_example"; // String | QR code text to convert into the QR code barcode
try {
byte[] result = apiInstance.generateBarcodeQRCode(value);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling GenerateBarcodeApi#generateBarcodeQRCode");
e.printStackTrace();
}
, , .
All of these functions return a PNG file containing your barcode image for use on any product or item. If you have any questions about using these APIs, or questions regarding other API solutions, you can visit the Cloudmersive website, where our team will be happy to help you with whatever you might need.