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
|
# File 'lib/asposebarcodejava/Barcode/managecaption.rb', line 3
def initialize()
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
bb.setCodeText("1234567")
bb.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Code128)
caption = Rjb::import('com.aspose.barcode.Caption').new
caption.setText("Captions")
caption.setTextAlign(Rjb::import('com.aspose.barcode.Alignment').Middle)
bb.setCaptionAbove(caption)
bb.setCaptionBelow(caption)
bb.getCaptionAbove().setTextAlign(Rjb::import('com.aspose.barcode.Alignment').Left)
bb.getCaptionAbove().setText("Aspose")
bb.getCaptionAbove().setVisible(true)
bb.getCaptionBelow().setTextAlign(Rjb::import('com.aspose.barcode.Alignment').Right)
bb.getCaptionBelow().setText("Aspose.BarCode Caption Below")
bb.getCaptionBelow().setVisible(true)
bb.save(data_dir + "barcode.jpg", Rjb::import('com.aspose.barcode.BarCodeImageFormat').Jpeg)
puts "Barcode with Captions saved successfully."
end
|