asposebarcodejava 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/asposebarcodejava.gemspec +27 -0
- data/config/aspose.yml +5 -0
- data/data/barcode.jpg +0 -0
- data/data/orientation.jpg +0 -0
- data/data/symbologies.png +0 -0
- data/data/test.png +0 -0
- data/lib/asposebarcodejava.rb +71 -0
- data/lib/asposebarcodejava/2DBarcode/creating2dbarcode.rb +25 -0
- data/lib/asposebarcodejava/2DBarcode/creatingaztecbarcode.rb +20 -0
- data/lib/asposebarcodejava/2DBarcode/creatingdatamatrixbarcode.rb +20 -0
- data/lib/asposebarcodejava/2DBarcode/creatingpdf417barcode.rb +20 -0
- data/lib/asposebarcodejava/2DBarcode/creatingqrbarcode.rb +25 -0
- data/lib/asposebarcodejava/2DBarcode/generatemultiplemacropdf417barcodes.rb +33 -0
- data/lib/asposebarcodejava/2DBarcode/hidecodetext.rb +25 -0
- data/lib/asposebarcodejava/2DBarcode/setaspectratio.rb +23 -0
- data/lib/asposebarcodejava/2dbarcode.rb +8 -0
- data/lib/asposebarcodejava/Barcode/australiapostbarcode.rb +20 -0
- data/lib/asposebarcodejava/Barcode/codetext.rb +61 -0
- data/lib/asposebarcodejava/Barcode/managecaption.rb +41 -0
- data/lib/asposebarcodejava/Barcode/managedimension.rb +43 -0
- data/lib/asposebarcodejava/Barcode/patchcode.rb +22 -0
- data/lib/asposebarcodejava/Barcode/setbarsheight.rb +31 -0
- data/lib/asposebarcodejava/Barcode/specifysymbologies.rb +34 -0
- data/lib/asposebarcodejava/Barcode/startstopsymbol.rb +22 -0
- data/lib/asposebarcodejava/Barcode/usechecksumandsupplementdata.rb +25 -0
- data/lib/asposebarcodejava/Barcode/widenarrowratio.rb +39 -0
- data/lib/asposebarcodejava/BarcodeImage/customizebarcodeimageresolution.rb +24 -0
- data/lib/asposebarcodejava/BarcodeImage/generatebarcodebycustomimagesize.rb +25 -0
- data/lib/asposebarcodejava/BarcodeImage/generatebarcodewithemptybars.rb +19 -0
- data/lib/asposebarcodejava/BarcodeImage/printingbarcodeimage.rb +17 -0
- data/lib/asposebarcodejava/BarcodeImage/rotateimage.rb +24 -0
- data/lib/asposebarcodejava/BarcodeImage/savebarcodeimagetostreams.rb +25 -0
- data/lib/asposebarcodejava/BarcodeImage/setbarcodeimageborders.rb +34 -0
- data/lib/asposebarcodejava/BarcodeImage/setbarcodeimagecolor.rb +33 -0
- data/lib/asposebarcodejava/BarcodeImage/setbarcodeimagemargins.rb +28 -0
- data/lib/asposebarcodejava/BarcodeImage/setbarcodeimagequality.rb +24 -0
- data/lib/asposebarcodejava/BarcodeImage/setbarcodeimageunitsize.rb +22 -0
- data/lib/asposebarcodejava/BarcodeRecognition/barcodeorientation.rb +24 -0
- data/lib/asposebarcodejava/BarcodeRecognition/fastandbetterbarcodeprocessing.rb +25 -0
- data/lib/asposebarcodejava/BarcodeRecognition/getallonedbarcodes.rb +37 -0
- data/lib/asposebarcodejava/BarcodeRecognition/getbarcoderecognitionquality.rb +23 -0
- data/lib/asposebarcodejava/BarcodeRecognition/getbarcoderegioninfo.rb +31 -0
- data/lib/asposebarcodejava/BarcodeRecognition/makingbarcoderegions.rb +42 -0
- data/lib/asposebarcodejava/BarcodeRecognition/readbarcodefromspecificregion.rb +24 -0
- data/lib/asposebarcodejava/BarcodeRecognition/recognizebarcode.rb +21 -0
- data/lib/asposebarcodejava/BarcodeRecognition/recognizemultiplesymbologies.rb +21 -0
- data/lib/asposebarcodejava/BarcodeRecognition/recognizespecificsymbology.rb +21 -0
- data/lib/asposebarcodejava/BarcodeRecognition/switchbarcoderecognitionmodes.rb +27 -0
- data/lib/asposebarcodejava/asposebarcode.rb +4 -0
- data/lib/asposebarcodejava/barcode.rb +10 -0
- data/lib/asposebarcodejava/barcodeimage.rb +10 -0
- data/lib/asposebarcodejava/barcoderecognition.rb +11 -0
- data/lib/asposebarcodejava/version.rb +3 -0
- data/samples/2dbarcode.rb +16 -0
- data/samples/barcode.rb +18 -0
- data/samples/barcodeimage.rb +18 -0
- data/samples/barcoderecognition.rb +19 -0
- metadata +162 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module SetBarcodeImageColor
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
color = Rjb::import('java.awt.Color')
|
10
|
+
|
11
|
+
# Set the background color of the barcode
|
12
|
+
bb.setBackColor(color.YELLOW)
|
13
|
+
|
14
|
+
# Set the foreground color of the barcode
|
15
|
+
bb.setForeColor(color.BLUE)
|
16
|
+
|
17
|
+
# Set border's color
|
18
|
+
bb.setBorderColor(color.RED)
|
19
|
+
|
20
|
+
# Set the code text's color
|
21
|
+
bb.setCodeTextColor(color.RED)
|
22
|
+
|
23
|
+
# Caption's color
|
24
|
+
bb.getCaptionAbove().setForeColor(color.darkGray)
|
25
|
+
bb.getCaptionBelow().setForeColor(color.CYAN)
|
26
|
+
|
27
|
+
bb.save(data_dir + "color.jpg")
|
28
|
+
|
29
|
+
# Display Status.
|
30
|
+
puts "Applied color to barcode image, please check the output file."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module SetBarcodeImageMargins
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
symbology = Rjb::import('com.aspose.barcode.Symbology')
|
8
|
+
bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new("12345678", symbology.Code128)
|
9
|
+
|
10
|
+
# sets the top margin
|
11
|
+
bb.getMargins().setTop(4)
|
12
|
+
|
13
|
+
# sets the bottom margin
|
14
|
+
bb.getMargins().setBottom(5)
|
15
|
+
|
16
|
+
# sets the left margin
|
17
|
+
bb.getMargins().setLeft(2)
|
18
|
+
|
19
|
+
# sets the right margin
|
20
|
+
bb.getMargins().setRight(3)
|
21
|
+
|
22
|
+
bb.save(data_dir + "SetBarcodeImageMargins.jpg")
|
23
|
+
|
24
|
+
# Display Status.
|
25
|
+
puts "Set Barcode Image Margins, please check the output file."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module SetBarcodeImageQuality
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
# Set the code text of the barcode
|
10
|
+
bb.setCodeText("12345678")
|
11
|
+
|
12
|
+
# Set the graphics drawing hint to be Anti Alias
|
13
|
+
bb.setImageQuality(Rjb::import('com.aspose.barcode.ImageQualityMode').AntiAlias)
|
14
|
+
|
15
|
+
# Set the symbology type to code39
|
16
|
+
bb.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Code39Extended)
|
17
|
+
|
18
|
+
bb.save(data_dir + "SetBarcodeImageQuality.jpg")
|
19
|
+
|
20
|
+
# Display Status.
|
21
|
+
puts "Set Barcode Image Quality, please check the output file."
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module SetBarcodeImageUnitSize
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
symbology = Rjb::import('com.aspose.barcode.Symbology')
|
8
|
+
bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new("12345678", symbology.Code128)
|
9
|
+
|
10
|
+
# Measurement is Milimeter
|
11
|
+
bb.setGraphicsUnit(Rjb::import('com.aspose.barcode.GraphicsUnit').Point)
|
12
|
+
|
13
|
+
# Set the bar height to 3 points
|
14
|
+
bb.setBarHeight(3.0)
|
15
|
+
|
16
|
+
bb.save(data_dir + "SetBarcodeImageUnitSize.jpg")
|
17
|
+
|
18
|
+
# Display Status.
|
19
|
+
puts "Set Barcode Image Unit Size, please check the output file."
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module BarcodeOrientation
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# initialize barcode reader
|
7
|
+
img = data_dir + "orientation.jpg"
|
8
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
9
|
+
reader = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
10
|
+
|
11
|
+
# Set orientation
|
12
|
+
reader.setOrientationHints(Rjb::import('com.aspose.barcoderecognition.RecognitionHints$Orientation').Rotate90)
|
13
|
+
|
14
|
+
# Try to recognize all possible barcodes in the image
|
15
|
+
while reader.read()
|
16
|
+
# print the code text, if barcode found
|
17
|
+
puts "CodeText: " + reader.getCodeText().to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
# Close reader
|
21
|
+
reader.close()
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module FastAndBetterBarcodeProcessing
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
img = data_dir + "test.png"
|
7
|
+
|
8
|
+
# initialize barcode reader
|
9
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
10
|
+
reader = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
11
|
+
|
12
|
+
# Set recognition hints
|
13
|
+
reader.setImageBinarizationHints(Rjb::import('com.aspose.barcoderecognition.RecognitionHints$ImageBinarization').MedianSmoothing)
|
14
|
+
reader.setMedianSmoothingWindowSize(4)
|
15
|
+
|
16
|
+
# Call read method
|
17
|
+
while reader.read()
|
18
|
+
puts "Barcode CodeText: " + reader.getCodeText().to_s
|
19
|
+
end
|
20
|
+
|
21
|
+
# Close reader
|
22
|
+
reader.close()
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module GetAllOneDBarcodes
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
img = data_dir + "barcode.jpg"
|
7
|
+
|
8
|
+
# initialize barcode reader
|
9
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
10
|
+
reader = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
11
|
+
|
12
|
+
# Call read method
|
13
|
+
reader.read()
|
14
|
+
|
15
|
+
# Now get all possible barcodes
|
16
|
+
barcodes = reader.getAllPossibleBarCodes()
|
17
|
+
|
18
|
+
i = 0
|
19
|
+
while i < barcodes.length
|
20
|
+
# Display code text, symbology, detected angle, recognition percentage of the barcode
|
21
|
+
puts "Code Text: " + barcodes[i].getCodetext().to_s + " Symbology: " + barcodes[i].getBarCodeReadType().to_s + " Recognition percentage: " + barcodes[i].getAngle().to_s
|
22
|
+
|
23
|
+
# Display x and y coordinates of barcode detected
|
24
|
+
point = barcodes[i].getRegion().getPoints()
|
25
|
+
|
26
|
+
puts "Top left coordinates: X = " + point[0].getX().to_s + ", Y = " + point[0].getY().to_s
|
27
|
+
puts "Bottom left coordinates: X = " + point[1].getX().to_s + ", Y = " + point[1].getY().to_s
|
28
|
+
puts "Bottom right coordinates: X = " + point[2].getX().to_s + ", Y = " + point[2].getY().to_s
|
29
|
+
puts "Top right coordinates: X = " + point[3].getX().to_s + ", Y = " + point[3].getY().to_s
|
30
|
+
i +=1
|
31
|
+
end
|
32
|
+
|
33
|
+
# Close reader
|
34
|
+
reader.close()
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module GetBarcodeRecognitionQuality
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
img = data_dir + "barcode.jpg"
|
7
|
+
|
8
|
+
# initialize barcode reader
|
9
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
10
|
+
reader = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
11
|
+
|
12
|
+
# Call read method
|
13
|
+
while reader.read()
|
14
|
+
puts "Barcode CodeText: " + reader.getCodeText().to_s + " Barcode Type: " + reader.getReadType().to_s
|
15
|
+
percent = reader.getRecognitionQuality()
|
16
|
+
puts "Barcode Quality Percentage: " + percent.to_s
|
17
|
+
end
|
18
|
+
|
19
|
+
# Close reader
|
20
|
+
reader.close()
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module GetBarcodeRegionInfo
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# initialize barcode reader
|
7
|
+
img = data_dir + "barcode.jpg"
|
8
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
9
|
+
reader = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
10
|
+
|
11
|
+
# Try to recognize all possible barcodes in the image
|
12
|
+
while reader.read()
|
13
|
+
# Get the region information
|
14
|
+
region = reader.getRegion()
|
15
|
+
|
16
|
+
if region != nil
|
17
|
+
# Display x and y coordinates of barcode detected
|
18
|
+
point = region.getPoints()
|
19
|
+
puts "Top left coordinates: X = " + point[0].x.to_s + ", Y = " + point[0].y.to_s
|
20
|
+
puts "Bottom left coordinates: X = " + point[1].x.to_s + ", Y = " + point[1].y.to_s
|
21
|
+
puts "Bottom right coordinates: X = " + point[2].x.to_s + ", Y = " + point[2].y.to_s
|
22
|
+
puts "Top right coordinates: X = " + point[3].x.to_s + ", Y = " + point[3].y.to_s
|
23
|
+
end
|
24
|
+
puts "Codetext: " + reader.getCodeText().to_s
|
25
|
+
end
|
26
|
+
|
27
|
+
# Close reader
|
28
|
+
reader.close()
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module MakingBarcodeRegions
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# initialize barcode reader
|
7
|
+
img = data_dir + "barcode.jpg"
|
8
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
9
|
+
reader = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
10
|
+
|
11
|
+
# Try to recognize all possible barcodes in the image
|
12
|
+
while reader.read()
|
13
|
+
# Display the symbology type
|
14
|
+
puts "BarCode Type: " + reader.getReadType().to_s
|
15
|
+
# Display the codetext
|
16
|
+
puts "BarCode CodeText: " + reader.getCodeText().to_s
|
17
|
+
# Get the barcode region
|
18
|
+
region = reader.getRegion()
|
19
|
+
|
20
|
+
if region != nil
|
21
|
+
# Initialize an object of type BufferedImage to get the Graphics object
|
22
|
+
bufferedImage = Rjb::import('javax.imageio.ImageIO').read(Rjb::import('java.io.File').new(img))
|
23
|
+
|
24
|
+
# Initialize graphics object from the image
|
25
|
+
g = bufferedImage.getGraphics()
|
26
|
+
|
27
|
+
color = Rjb::import('java.awt.Color')
|
28
|
+
# Initialize paint object
|
29
|
+
p = Rjb::import('java.awt.GradientPaint').new(0, 0, color.red, 100, 100, color.pink, true)
|
30
|
+
|
31
|
+
region.drawBarCodeEdges(g, color.RED)
|
32
|
+
|
33
|
+
# Save the image
|
34
|
+
Rjb::import('javax.imageio.ImageIO').write(bufferedImage, "png", Rjb::import('java.io.File').new(data_dir + "Code39StdOut.png"))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Close reader
|
39
|
+
reader.close()
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module ReadBarcodeFromSpecificRegion
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Open the stream. Read only access is enough for Aspose.BarCode to load an image.
|
7
|
+
stream = Rjb::import('java.io.FileInputStream').new(data_dir + "test.png")
|
8
|
+
|
9
|
+
# Create an instance of BarCodeReader class
|
10
|
+
# and specify an area to look for the barcode
|
11
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
12
|
+
reader = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(stream, Rjb::import('java.awt.Rectangle').new(0, 0, 10, 50), barcode_reader_type.Code39Standard)
|
13
|
+
|
14
|
+
# TRead all barcodes in the provided area
|
15
|
+
while reader.read() == true
|
16
|
+
# Display the codetext and symbology type of the barcode found
|
17
|
+
puts "Codetext: " + reader.getCodeText().to_s + " Symbology: " + reader.getReadType().to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
# Close reader
|
21
|
+
reader.close()
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module RecognizeBarcode
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# initialize barcode reader
|
7
|
+
img = data_dir + "barcode.jpg"
|
8
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
9
|
+
rd = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
10
|
+
|
11
|
+
# read barcode
|
12
|
+
while rd.read()
|
13
|
+
# print the code text, if barcode found
|
14
|
+
puts "CodeText: " + rd.getCodeText().to_s
|
15
|
+
|
16
|
+
# print the symbology type
|
17
|
+
puts "Type: " + rd.getReadType().to_s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module RecognizeMultipleSymbologies
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# initialize barcode reader
|
7
|
+
img = data_dir + "symbologies.png"
|
8
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
9
|
+
rd = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.AllSupportedTypes)
|
10
|
+
|
11
|
+
# read barcode
|
12
|
+
while rd.read()
|
13
|
+
# print the code text, if barcode found
|
14
|
+
puts "CodeText: " + rd.getCodeText().to_s
|
15
|
+
|
16
|
+
# print the symbology type
|
17
|
+
puts "Type: " + rd.getReadType().to_s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module RecognizeSpecificSymbology
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# initialize barcode reader
|
7
|
+
img = data_dir + "barcode.jpg"
|
8
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
9
|
+
rd = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
10
|
+
|
11
|
+
# read barcode
|
12
|
+
while rd.read()
|
13
|
+
# print the code text, if barcode found
|
14
|
+
puts "CodeText: " + rd.getCodeText().to_s
|
15
|
+
|
16
|
+
# print the symbology type
|
17
|
+
puts "Type: " + rd.getReadType().to_s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module SwitchBarcodeRecognitionModes
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
img = data_dir + "barcode.jpg"
|
7
|
+
|
8
|
+
# initialize barcode reader
|
9
|
+
barcode_reader_type = Rjb::import('com.aspose.barcoderecognition.BarCodeReadType')
|
10
|
+
reader = Rjb::import('com.aspose.barcoderecognition.BarCodeReader').new(img, barcode_reader_type.Code39Standard)
|
11
|
+
|
12
|
+
# Set recognition mode
|
13
|
+
reader.setRecognitionMode(Rjb::import('com.aspose.barcoderecognition.RecognitionMode').ManualHints)
|
14
|
+
|
15
|
+
# Set manual hints
|
16
|
+
reader.setManualHints(Rjb::import('com.aspose.barcoderecognition.ManualHint').InvertImage || Rjb::import('com.aspose.barcoderecognition.ManualHint').IncorrectBarcodes)
|
17
|
+
|
18
|
+
# Call read method
|
19
|
+
while reader.read()
|
20
|
+
puts "Barcode CodeText: " + reader.getCodeText().to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
# Close reader
|
24
|
+
reader.close()
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require_relative 'Barcode/codetext'
|
2
|
+
require_relative 'Barcode/managecaption'
|
3
|
+
require_relative 'Barcode/specifysymbologies'
|
4
|
+
require_relative 'Barcode/setbarsheight'
|
5
|
+
require_relative 'Barcode/managedimension'
|
6
|
+
require_relative 'Barcode/widenarrowratio'
|
7
|
+
require_relative 'Barcode/startstopsymbol'
|
8
|
+
require_relative 'Barcode/usechecksumandsupplementdata'
|
9
|
+
require_relative 'Barcode/australiapostbarcode'
|
10
|
+
require_relative 'Barcode/patchcode'
|