Set Code Text for BarCode in Ruby

Aspose.BarCode - Set Code Text for Barcode

To Set Code Text for Barcode using Aspose.Barcode Java for Ruby, call set_codetext method of CodeText module. Here you can see example code.

Ruby Code

 def set_codetext()

    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'

    # Instantiate barcode object

    bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new

    # Set the code text for the barcode


    # Set the symbology type to Code128


    # Set the width of the bars to 0.5 millimeter


    # save the barcode image to file + "codetext.out.jpg")

    # Print message

    puts "Barcode image generated successfully."


Download Running Code

Download Set Code Text for Barcode (Aspose.BarCode) from any of the below mentioned social coding sites: