Aspose.Barcode Cloud logo A barcode is an optical machine-readable representation of data relating to the object to which it is attached. Barcodes have replaced the traditional price tags and every we you see bar codes in the world around you. They are used in supermarkets, on labels, greeting cards and consumable goods. Barcodes can be used in every business around the world. For example, they are used to:

  • Track assets in any building including every desk, computer, telephone, copier and desk accessory.
  • Track mail from the time it arrives in the mail room to the time it is delivered to the final desk or location within an office.
  • Help security guards identify employees, the door they enter and every room they work in.
  • Secure, lock or unlock entrances or exits throughout a plant.
  • Manage and track vehicles in a fleet and each driver.

Aspose.Barcode Cloud conforms to most modern barcode standards and specifications and allows you to create and read barcodes in any language including .NET, Java, PHP, Ruby, Rails, Python, jQuery and many more. You can use it with any language or platform that supports REST. (Almost all platforms and languages support REST and provide native REST clients to work with REST APIs.)

This post covers how to generate a barcode and save as TIFF, JPEG, PNG, EMF, BMP and GIF formats in Java. You can check Working with Barcode Generation for other languages.

You need to send a GET request to generate barcodes on local disk. Following topics describe the supported barcode types, and process to create barcodes in detail.

Supported Barcode Symbologies

Following are the barcode types supported by Aspose.Barcode Cloud:

Numeric Only Symbologies

  • EAN13
  • EAN8
  • UPCA
  • UPCE
  • ISBN
  • ISMN
  • ISSN
  • Interleaved2of5
  • Standard2of5
  • MSI
  • Code11
  • Codabar
  • Postnet
  • Planet
  • EAN14(SCC14)
  • SSCC18
  • ITF14
  • IATA 2 of 5
  • DatabarOmniDirectional
  • DatabarLimited
  • DatabarTruncated

Alpha-Numeric Symbologies

  • GS1Code128
  • Code128
  • Code39 Extended
  • Code39 Standard
  • Code93 Extended
  • Code93 Standard
  • Australia Post
  • Italian Post 25
  • Matrix 2 of 5
  • Databar Expanded

2D Symbologies

  • PDF417
  • DataMatrix
  • Aztec
  • QR
  • GS1DataMatrix
  • Code16K

Generate Barcodes using Java REST

You can set any text and supported type in the following URI to create a new barcode. for new barcode image&type=QR

Following is the list of optional parameters for this URI. All or specific parameters can be used as needed.

  • format – Used to set the required image format. If not specified, PNG is used.
  • resolutionX – Used to set the resolution along the X-axis in DPI.
  • resolutionY – Used to set the resolution along the Y-axis in DPI.
  • dimensionX – Used to set the width of the barcode unit (bar or space).
  • dimensionY – Used to set the height of the barcode unit (for 2D barcodes).

After building the URI, you need to go through the following steps:

  1. Set App SID and App Key and sign the URI.
    See section 1 of the following code and Sign URI method for more details.
  2. Send a GET request to Aspose Cloud service.
    See section 2 of the following code and ProcessCommand method for more details.
  3. Save output barcode image to disk.
    See section 3 of the following code and SaveStreamToFile method for more details.

Below is the code to create a new barcode.

/**** Section 1 ****/
//Build URI to generate barcode
//Type: Codabar, Code11, Code128 and Code39Extended etc.
//Format: PNG, JPEG and JPG etc.

String strURI = " Text Here&type=QR&format=png";

//Sign URI

String signedURI = Utils._Sign_(strURI);

/**** End Section 1 ****/

/**** Section 2 ****/

InputStream responseStream = Utils._ProcessCommand_(signedURI, "GET");

/**** End Section 2 ****/

/**** Section 3 ****/

Folder._SaveStreamToFile_("Barcode1.png", responseStream);

/**** End Section 3 ****/


Generate Barcodes using Java SDK

If you want to use our Java SDK to create a new barcode, you can download this SDK from Aspose Cloud SDK for Java. In order to use the Java SDK, you need to perform following steps:

  1. Set base product URI, App SID and App Key.
    See section 1 of the following code.
  2. Create object of the BarCodeBuilder class and call the Save method.
    See section 2 of the following code.

Below is the code that creates a new barcode.

/**** Section 1 ****/"");"77******-1***-4***-a***-80**********");"********************");

/**** End Section 1 ****/

/**** Section 2 ****/

//Create an instance of BarCodeBuilder class builder = **new**"PDF417
barcode generated by Aspose.BarCode for Cloud",;

// Call Save() method to save the barcode to local disk

builder.Save(, "Barcode1.png",;

/**** End Section 2 ****/