Module: Asposebarcodejava::WideNarrowRatio

Defined in:
lib/asposebarcodejava/Barcode/widenarrowratio.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
# File 'lib/asposebarcodejava/Barcode/widenarrowratio.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 the code text of the barcode
    bb.setCodeText("12345678")

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

    # Set the wide to narrow ratio for the barcode
    bb.setWideNarrowRatio(3.0)
    # Save the image to file
    bb.save(data_dir + "barcode_ratio_3.jpg")

    # Set the wide to narrow ratio for the barcode
    bb.setWideNarrowRatio(5.0)
    # Save the image to file
    bb.save(data_dir + "barcode_ratio_5.jpg")

    # Set the wide to narrow ratio for the barcode
    bb.setWideNarrowRatio(7.0)
    # Save the image to file
    bb.save(data_dir + "barcode_ratio_7.jpg")

    # Set the wide to narrow ratio for the barcode
    bb.setWideNarrowRatio(9.0)
    # Save the image to file
    bb.save(data_dir + "barcode_ratio_9.jpg")

    # Display Status.
    puts "BarCodes with different wide narrow ratios have been created successfully."
end