Module: Asposebarcodejava::ManageDimension

Defined in:
lib/asposebarcodejava/Barcode/managedimension.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/asposebarcodejava/Barcode/managedimension.rb', line 3

def initialize()
    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
            
    # Instantiate barcode object
    bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new

    # Set up code text (data to be encoded)
    bb.setCodeText("1234567")

    # Set the symbology type to Code128
    bb.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Code128)

    # Save the image to file
    bb.save(data_dir + "barcode.jpg")

    # Set the x-dimension for the bars of the barcode
    bb.setxDimension(0.5)
    # Save the image to file
    bb.save(data_dir + "barcodeXDimensionChanged.jpg")


    # Instantiate barcode object
    bb1 = Rjb::import('com.aspose.barcode.BarCodeBuilder').new

    # Set the code text of the barcode
    bb1.setCodeText("12345678")

    # Set the symbology type to code128
    bb1.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Pdf417)

    # Set the x-dimension for the bars of the barcode
    bb1.setxDimension(0.5)

    # Save the image to file
    bb1.save(data_dir + "barcodeYDimensionChanged.jpg")

    # Display Status.
    puts "BarCodes with different dimensions have been created successfully."
end