asposebarcodejava 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e40afbcab9dd8e072a9e289fb7c7efa82641b35a
|
4
|
+
data.tar.gz: 0969559dd19392dccf49649ce774ef279a6ac9c0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8f62e8fafc7e136962d582fa62aba81390a06ea6e8e9e80c06a1ab1d5bcf38f446da7c9fcf89b8aefb20a1bbaef57f0426ef54654b1f187fb38e52c54732b3da
|
7
|
+
data.tar.gz: eb1c420bf24f224ffcd04de8088eda5ca7addf8142f5c6a5dd2fb6b3c0b3db277b843696897b5490a453790656d3687a57afe54751f28ef2e60939da2fbb35b7
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2001-2015 Aspose Pty Ltd
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Aspose_Barcode_Java_for_Ruby
|
2
|
+
Aspose.Barcode Java for Ruby is a gem that demonstrates / provides the Aspose.Barcode for Java API usage examples in Ruby by using Rjb - Ruby Java Bridge.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
Execute following command.
|
7
|
+
|
8
|
+
$ gem install asposebarcodejava
|
9
|
+
|
10
|
+
To download Aspose.BarCode for Java API to be used with these examples through RJB, Please navigate to:
|
11
|
+
|
12
|
+
http://www.aspose.com/community/files/72/java-components/aspose.barcode-for-java/
|
13
|
+
|
14
|
+
Note: Create jars folder at root of the gem folder and copy downloaded Aspose.BarCode for java component into it.
|
15
|
+
|
16
|
+
For most complete documentation of the project, check Aspose.BarCode Java for Ruby confluence wiki link:
|
17
|
+
|
18
|
+
http://www.aspose.com/docs/display/barcodejava/2.+Aspose.Barcode+Java+For+Ruby
|
19
|
+
|
20
|
+
## Usage
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
require File.dirname(File.dirname(File.dirname(__FILE__))) + '/lib/asposebarcodejava'
|
24
|
+
include Asposebarcodejava
|
25
|
+
include Asposebarcodejava::RecognizeBarcode
|
26
|
+
initialize_aspose_barcode
|
27
|
+
```
|
28
|
+
Lets understand the above code
|
29
|
+
* The first line makes sure that the Aspose.BarCode is loaded and available
|
30
|
+
* Include the files that are required to access the Aspose.BarCode
|
31
|
+
* Initialize the libraries. The aspose JAVA classes are loaded from the path provided in the aspose.yml file
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'asposebarcodejava/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'asposebarcodejava'
|
8
|
+
spec.version = Asposebarcodejava::VERSION
|
9
|
+
spec.authors = ['Aspose Marketplace']
|
10
|
+
spec.email = ['marketplace@aspose.com']
|
11
|
+
spec.summary = %q{A Ruby gem to work with Aspose.BarCode for Java libraries}
|
12
|
+
spec.description = %q{AsposeBarcodeJava is a Ruby gem that can help working with Aspose.BarCode for Java libraries}
|
13
|
+
spec.homepage = 'https://github.com/asposebarcode/Aspose_Barcode_Java/tree/master/Plugins/Aspose_Barcode_Java_for_Ruby'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec'
|
24
|
+
|
25
|
+
spec.add_dependency 'rjb', '~> 1.5.2'
|
26
|
+
|
27
|
+
end
|
data/config/aspose.yml
ADDED
data/data/barcode.jpg
ADDED
Binary file
|
Binary file
|
Binary file
|
data/data/test.png
ADDED
Binary file
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative 'asposebarcodejava/version'
|
2
|
+
require_relative 'asposebarcodejava/asposebarcode'
|
3
|
+
require 'logger'
|
4
|
+
require 'rjb'
|
5
|
+
|
6
|
+
module Asposebarcodejava
|
7
|
+
|
8
|
+
class << self
|
9
|
+
attr_accessor :aspose_barcode_config
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize_aspose_barcode
|
13
|
+
aspose_jars_dir = Asposebarcodejava.aspose_barcode_config ? Asposebarcodejava.aspose_barcode_config['jar_dir'] : nil
|
14
|
+
aspose_license_path = Asposebarcodejava.aspose_barcode_config ? Asposebarcodejava.aspose_barcode_config['license_path'] : nil
|
15
|
+
jvm_args = Asposebarcodejava.aspose_barcode_config ? Asposebarcodejava.aspose_barcode_config['jvm_args'] : nil
|
16
|
+
|
17
|
+
load_aspose_jars(aspose_jars_dir, jvm_args)
|
18
|
+
load_aspose_license(aspose_license_path)
|
19
|
+
end
|
20
|
+
|
21
|
+
def load_aspose_license(aspose_license_path)
|
22
|
+
if aspose_license_path && File.exist?(aspose_license_path)
|
23
|
+
set_license(File.join(aspose_license_path))
|
24
|
+
else
|
25
|
+
logger = Logger.new(STDOUT)
|
26
|
+
logger.level = Logger::WARN
|
27
|
+
logger.warn('Using the non licensed aspose jar. Please specify path to your aspose license directory in config/aspose.yml file!')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def load_aspose_jars(aspose_jars_dir, jvm_args)
|
32
|
+
if aspose_jars_dir && File.exist?(aspose_jars_dir)
|
33
|
+
jardir = File.join(aspose_jars_dir, '**', '*.jar')
|
34
|
+
else
|
35
|
+
jardir = File.join(File.dirname(File.dirname(__FILE__)), 'jars', '**', '*.jar')
|
36
|
+
end
|
37
|
+
|
38
|
+
if jvm_args
|
39
|
+
args = jvm_args.split(' ') << '-Djava.awt.headless=true'
|
40
|
+
logger = Logger.new(STDOUT)
|
41
|
+
logger.level = Logger::DEBUG
|
42
|
+
logger.debug("JVM args : #{args}")
|
43
|
+
Rjb::load(classpath = Dir.glob(jardir).join(':'), jvmargs=args)
|
44
|
+
else
|
45
|
+
Rjb::load(classpath = Dir.glob(jardir).join(':'), jvmargs=['-Djava.awt.headless=true'])
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
def input_file(file)
|
51
|
+
Rjb::import('java.io.FileInputStream').new(file)
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_license(aspose_license_file)
|
55
|
+
begin
|
56
|
+
fstream = input_file(aspose_license_file)
|
57
|
+
license = Rjb::import('com.aspose.api.License').new()
|
58
|
+
license.setLicense(fstream)
|
59
|
+
rescue Exception => ex
|
60
|
+
logger = Logger.new(STDOUT)
|
61
|
+
logger.level = Logger::ERROR
|
62
|
+
logger.error("Could not load the license file : #{ex}")
|
63
|
+
fstream.close() if fstream
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.configure_aspose_barcode config
|
68
|
+
Asposebarcodejava.aspose_barcode_config = config
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module Creating2DBarcode
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
builder.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Pdf417)
|
10
|
+
|
11
|
+
# Width of each module
|
12
|
+
builder.setxDimension(0.6)
|
13
|
+
|
14
|
+
# Height of each module
|
15
|
+
builder.setyDimension(1.2)
|
16
|
+
builder.setCodeText("this is some test code text. \n Second line \n third line.")
|
17
|
+
|
18
|
+
# Save the image to your system and set its image format to Jpeg
|
19
|
+
builder.save(data_dir + "Creating2DBarcode.jpg")
|
20
|
+
|
21
|
+
# Display Status
|
22
|
+
puts "Created 2D Barcode Successfully."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module CreatingAztecBarcode
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
builder.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Aztec)
|
10
|
+
|
11
|
+
builder.setCodeText("1234567890")
|
12
|
+
|
13
|
+
# Save the image to your system and set its image format to Jpeg
|
14
|
+
builder.save(data_dir + "CreatingAztecBarcode.jpg")
|
15
|
+
|
16
|
+
# Display Status
|
17
|
+
puts "Created Aztec Barcode Successfully."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module CreatingDataMatrixBarcode
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
builder.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').DataMatrix)
|
10
|
+
|
11
|
+
builder.setCodeText("1234567890")
|
12
|
+
|
13
|
+
# Save the image to your system and set its image format to Jpeg
|
14
|
+
builder.save(data_dir + "CreatingDataMatrixBarcode.jpg")
|
15
|
+
|
16
|
+
# Display Status
|
17
|
+
puts "Created DataMatrix Barcode Successfully."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module CreatingPdf417Barcode
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
builder.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Pdf417)
|
10
|
+
|
11
|
+
builder.setCodeText("12345")
|
12
|
+
|
13
|
+
# Save the image to your system and set its image format to Jpeg
|
14
|
+
builder.save(data_dir + "CreatingPdf417Barcode.jpg")
|
15
|
+
|
16
|
+
# Display Status
|
17
|
+
puts "Created Pdf417 Barcode Successfully."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module CreatingQRBarcode
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
builder.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').QR)
|
10
|
+
|
11
|
+
builder.setCodeText("1234567890")
|
12
|
+
|
13
|
+
# Hide code text
|
14
|
+
builder.setCodeLocation(Rjb::import('com.aspose.barcode.CodeLocation').None)
|
15
|
+
|
16
|
+
builder.setRotationAngleF(90)
|
17
|
+
|
18
|
+
# Save the image to your system and set its image format to Jpeg
|
19
|
+
builder.save(data_dir + "CreatingQRBarcode.jpg")
|
20
|
+
|
21
|
+
# Display Status
|
22
|
+
puts "Created QR Barcode Successfully."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module GenerateMultipleMacroPdf417Barcodes
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
builder.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').MacroPdf417)
|
10
|
+
|
11
|
+
# Create array for storing multiple barcodes
|
12
|
+
i = 1
|
13
|
+
size = 4
|
14
|
+
list_code_text = ["code-1", "code-2", "code-3", "code-last"]
|
15
|
+
str_file_id = 1
|
16
|
+
|
17
|
+
# Check the listbox for getting codetext and generating the barcodes
|
18
|
+
for i in 1..4
|
19
|
+
builder.setCodeText(list_code_text[i - 1])
|
20
|
+
# fileID should be same for all the generated barcodes
|
21
|
+
builder.setMacroPdf417FileID(str_file_id)
|
22
|
+
|
23
|
+
# Assign segmentID in increasing order (1,2,3,....)
|
24
|
+
builder.setMacroPdf417SegmentID(i)
|
25
|
+
|
26
|
+
# Save the barcode (fileid_segmentid.png)
|
27
|
+
builder.save(data_dir + "#{i}.png")
|
28
|
+
end
|
29
|
+
# Display Status
|
30
|
+
puts "Saved Images Successfully."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module HideCodeText
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
builder.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').DataMatrix)
|
10
|
+
|
11
|
+
builder.setCodeText("The quick brown fox jumps over the lazy dog\n The quick brown fox jumps over the lazy dog\n");
|
12
|
+
|
13
|
+
builder.setCodeLocation(Rjb::import('com.aspose.barcode.CodeLocation').None)
|
14
|
+
|
15
|
+
font = Rjb::import('java.awt.Font')
|
16
|
+
builder.setCodeTextFont(font.new("Serif", font.BOLD + font.ITALIC, 20))
|
17
|
+
|
18
|
+
# Save the image
|
19
|
+
builder.save(data_dir + "HideCodeText.jpg")
|
20
|
+
|
21
|
+
# Display Status
|
22
|
+
puts "Hide Code Text Successfully."
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module SetAspectRatio
|
3
|
+
def initialize()
|
4
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
5
|
+
|
6
|
+
# Instantiate barcode object
|
7
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
8
|
+
|
9
|
+
builder.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Pdf417)
|
10
|
+
|
11
|
+
builder.setCodeText("1234567890")
|
12
|
+
|
13
|
+
# Set Aspect Ratio to 3:2 or 1.5
|
14
|
+
builder.setAspectRatio(1.5)
|
15
|
+
|
16
|
+
# Save the image
|
17
|
+
builder.save(data_dir + "SetAspectRatio.jpg")
|
18
|
+
|
19
|
+
# Display Status
|
20
|
+
puts "Set Aspect Ratio Successfully."
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require_relative '2DBarcode/creating2dbarcode'
|
2
|
+
require_relative '2DBarcode/creatingpdf417barcode'
|
3
|
+
require_relative '2DBarcode/creatingdatamatrixbarcode'
|
4
|
+
require_relative '2DBarcode/creatingqrbarcode'
|
5
|
+
require_relative '2DBarcode/creatingaztecbarcode'
|
6
|
+
require_relative '2DBarcode/hidecodetext'
|
7
|
+
require_relative '2DBarcode/setaspectratio'
|
8
|
+
require_relative '2DBarcode/generatemultiplemacropdf417barcodes'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module AustraliaPostBarcode
|
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
|
+
builder = Rjb::import('com.aspose.barcode.BarCodeBuilder').new("1234567890", symbology.AustraliaPost)
|
9
|
+
|
10
|
+
# Set format control code to standard
|
11
|
+
builder.setAustraliaPostFormatControlCode(Rjb::import('com.aspose.barcode.AustraliaPostFormatControlCode').Standard)
|
12
|
+
|
13
|
+
# Save the image to your system and set its image format to Jpeg
|
14
|
+
builder.save(data_dir + "AusraliaPost-Barcode.jpg")
|
15
|
+
|
16
|
+
# Display Status
|
17
|
+
puts "Generated Austrailia Post Barcode Successfully."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Asposebarcodejava
|
2
|
+
module CodeText
|
3
|
+
def initialize()
|
4
|
+
# Set appearance of the code text
|
5
|
+
set_appearance()
|
6
|
+
|
7
|
+
# Set code text for Barcode
|
8
|
+
set_codetext()
|
9
|
+
end
|
10
|
+
|
11
|
+
def set_appearance()
|
12
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
13
|
+
|
14
|
+
# Instantiate barcode object
|
15
|
+
bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
16
|
+
|
17
|
+
# Set up code text (data to be encoded)
|
18
|
+
bb.setCodeText("1234567")
|
19
|
+
|
20
|
+
# Set up code text color
|
21
|
+
bb.setCodeTextColor(Rjb::import('java.awt.Color').RED)
|
22
|
+
|
23
|
+
# Set the location of the code text to above the barcode
|
24
|
+
bb.setCodeLocation(Rjb::import('com.aspose.barcode.CodeLocation').Above)
|
25
|
+
|
26
|
+
#Increase the space between code text and barcode to 1 point
|
27
|
+
bb.setCodeTextSpace(1.0)
|
28
|
+
|
29
|
+
# Set the symbology type to Code128
|
30
|
+
bb.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Code128)
|
31
|
+
|
32
|
+
# Save the image to your system and set its image format to Jpeg
|
33
|
+
bb.save(data_dir + "barcode.jpg", Rjb::import('com.aspose.barcode.BarCodeImageFormat').Jpeg)
|
34
|
+
|
35
|
+
# Display Status
|
36
|
+
puts "Barcode with custom appearance saved as JPEG image successfully."
|
37
|
+
end
|
38
|
+
|
39
|
+
def set_codetext()
|
40
|
+
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
|
41
|
+
|
42
|
+
# Instantiate barcode object
|
43
|
+
bb = Rjb::import('com.aspose.barcode.BarCodeBuilder').new
|
44
|
+
|
45
|
+
# Set the code text for the barcode
|
46
|
+
bb.setCodeText("Aspose-123")
|
47
|
+
|
48
|
+
# Set the symbology type to Code128
|
49
|
+
bb.setSymbologyType(Rjb::import('com.aspose.barcode.Symbology').Code128)
|
50
|
+
|
51
|
+
# Set the width of the bars to 0.5 millimeter
|
52
|
+
bb.setxDimension(0.5)
|
53
|
+
|
54
|
+
# save the barcode image to file
|
55
|
+
bb.save(data_dir + "codetext.out.jpg")
|
56
|
+
|
57
|
+
# Print message
|
58
|
+
puts "Barcode image generated successfully."
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|