In this article, we are going to discuss the details on how to create Barcode using Java as well as recognizing the Barcode using the same Java API. We are already familiar that a barcode is an encoding tag or label that is placed on all merchandise that allows computers to track and ring up products much faster and more accurately. Similarly, they can easily be printed and added to items in a timely fashion so that your entire inventory is labeled and tracked immediately. Furthermore, the Barcode offers automatic product identification, extremely fast recognition, and implementation of data at a very low error rate. This approach is extremely cost-effective and can assist employers with lowering overhead and cutting down on training time and labor.

Barcode Generation API

Aspose.BarCode Cloud is a REST API enabling our customers to implement BarCode generation and manipulation capabilities in the programming

The API is capable of parsing popular raster image formats. For further details, please visit Supported File Formats.

Generate Barcode with Specified Dimensions

The quick and easiest way to test our APIs is to use the API reference section. The GetBarcodeGenerate method is used to create BarCode images and it provides a wide range of options to generate the BarCode as per your requirements and related details pertinent to specific parameters are well explained on the API reference page. While generating BarCode, you may specify either of the following types

  • Codabar
  • Code11
  • Code39Standard
  • Code39Extended
  • Code93Standard
  • Code93Extended
  • Code128
  • GS1Code128
  • EAN8
  • EAN13
  • EAN14
  • SCC14
  • SSCC18
  • UPCA
  • UPCE
  • ISBN
  • ISSN
  • ISMN
  • Standard2of5
  • Interleaved2of5
  • Matrix2of5
  • ItalianPost25
  • IATA2of5
  • ITF14
  • ITF6
  • MSI
  • VIN
  • DeutschePostIdentcode
  • DeutschePostLeitcode
  • OPC
  • PZN
  • Code16K
  • Pharmacode
  • DataMatrix
  • QR
  • Aztec
  • Pdf417
  • MacroPdf417
  • AustraliaPost
  • Postnet
  • Planet
  • OneCode
  • RM4SCC
  • DatabarOmniDirectional
  • DatabarTruncated
  • DatabarLimited
  • DatabarExpanded
  • SingaporePost
  • GS1DataMatrix
  • AustralianPosteParcel
  • SwissPostParcel
  • PatchCode
  • DatabarExpandedStacked
  • DatabarStacked
  • DatabarStackedOmniDirectional
  • MicroPdf417
  • GS1QR
  • MaxiCode
  • Code32
  • DataLogic2of5
  • DotCode
  • DutchKIX
  • UpcaGs1Code128Coupon
  • UpcaGs1DatabarCoupon
  • CodablockF
  • GS1CodablockF

cURL command

curl -X GET "https://api.aspose.cloud/v3.0/barcode/generate?Type=Codabar&Text=Hello%20World&TwoDDisplayText=QR&TextLocation=Above&TextAlignment=Center&TextColor=Blue&FontSizeMode=Auto&Resolution=96&TextSpace=2&Units=Point&SizeMode=Nearest&BarHeight=50&ImageHeight=200&ImageWidth=200&RotationAngle=0&BackColor=White&BorderDashStyle=Solid&SupplementData=EAN8&format=PNG" -H  "accept: image/png" -H  "authorization: Bearer <JWT Token>"

Request URL

https://api.aspose.cloud/v3.0/barcode/generate?Type=Codabar&Text=Hello%20World&TwoDDisplayText=QR&TextLocation=Above&TextAlignment=Center&TextColor=Blue&FontSizeMode=Auto&Resolution=96&TextSpace=2&Units=Point&SizeMode=Nearest&BarHeight=50&ImageHeight=200&ImageWidth=200&RotationAngle=0&BackColor=White&BorderDashStyle=Solid&SupplementData=EAN8&format=PNG

Java

The following code snippet can be used to generate a BarCode image and store it over Cloud Storage.

BarCode Image

Image 1:- Preview of Barcode generated with Java API

Recognize Barcode from Raster Image

The API also offers the capabilities to recognize BarCode from raster image files. The image file can be PNG, JPEG, BMP, GIF, TIFF, or EXIF format. The GetBarcodeRecognize method of API enables you to accomplish this requirement. The name field is mandatory and other optional fields provide the capabilities to perform better recognition operations because you can specify the BarCode type information, ChecksumValidation, Encoding, a preset allowing to configure recognition quality and speed, and much more.

cURL

curl -X GET "https://api.aspose.cloud/v3.0/barcode/index.png/recognize?Type=all&ChecksumValidation=Off&DetectEncoding=false&Preset=HighQuality" -H  "accept: application/json" -H  "authorization: Bearer <JWT Token>"

Request URL

https://api.aspose.cloud/v3.0/barcode/index.png/recognize?Type=all&ChecksumValidation=Off&DetectEncoding=false&Preset=HighQuality

Read Barcode from External Image URL

Conclusion

In this article, we have discussed the steps and related details on how to programmatically create BarCode using Java as well as how to read and recognize an existing BarCode using Java code snippet. You may have noticed that all these operations are performed with a few simple code lines. No additional software download or installation is required and these operations can be accomplished with fewer code lines.

We recommend you visit the following links to learn more about