Class: PDF417::Lib
- Inherits:
-
Object
- Object
- PDF417::Lib
- Defined in:
- lib/pdf417/lib.rb
Overview
A barebones ruby interface to the C library, uses C style constants and mixes in attribute accessors for moving data back and forth
Constant Summary collapse
- PDF417_USE_ASPECT_RATIO =
0
- PDF417_FIXED_RECTANGLE =
1
- PDF417_FIXED_COLUMNS =
2
- PDF417_FIXED_ROWS =
4
- PDF417_AUTO_ERROR_LEVEL =
0
- PDF417_USE_ERROR_LEVEL =
16
- PDF417_USE_RAW_CODEWORDS =
64
- PDF417_INVERT_BITMAP =
128
- PDF417_ERROR_SUCCESS =
0
- PDF417_ERROR_TEXT_TOO_BIG =
1
- PDF417_ERROR_INVALID_PARAMS =
2
Instance Attribute Summary collapse
-
#aspect_ratio ⇒ Object
writeonly
The following are read from the last generated barcode, but they need a writer because they get set.
-
#code_cols ⇒ Object
writeonly
The following are read from the last generated barcode, but they need a writer because they get set.
-
#code_rows ⇒ Object
writeonly
The following are read from the last generated barcode, but they need a writer because they get set.
-
#error_level ⇒ Object
writeonly
The following are read from the last generated barcode, but they need a writer because they get set.
-
#generation_options ⇒ Object
The int representing the options used to generate the barcode, defined in the library as: [PDF417_USE_ASPECT_RATIO] use aspectRatio to set the y/x dimension.
-
#raw_codewords ⇒ Object
The int representing the options used to generate the barcode, defined in the library as: [PDF417_USE_ASPECT_RATIO] use aspectRatio to set the y/x dimension.
-
#text ⇒ Object
The int representing the options used to generate the barcode, defined in the library as: [PDF417_USE_ASPECT_RATIO] use aspectRatio to set the y/x dimension.
-
#y_height ⇒ Object
writeonly
The following are read from the last generated barcode, but they need a writer because they get set.
Instance Method Summary collapse
-
#inspect ⇒ Object
:nodoc:.
Instance Attribute Details
#aspect_ratio=(value) ⇒ Object (writeonly)
The following are read from the last generated barcode, but they need a writer because they get set
35 36 37 |
# File 'lib/pdf417/lib.rb', line 35 def aspect_ratio=(value) @aspect_ratio = value end |
#code_cols=(value) ⇒ Object (writeonly)
The following are read from the last generated barcode, but they need a writer because they get set
35 36 37 |
# File 'lib/pdf417/lib.rb', line 35 def code_cols=(value) @code_cols = value end |
#code_rows=(value) ⇒ Object (writeonly)
The following are read from the last generated barcode, but they need a writer because they get set
35 36 37 |
# File 'lib/pdf417/lib.rb', line 35 def code_rows=(value) @code_rows = value end |
#error_level=(value) ⇒ Object (writeonly)
The following are read from the last generated barcode, but they need a writer because they get set
35 36 37 |
# File 'lib/pdf417/lib.rb', line 35 def error_level=(value) @error_level = value end |
#generation_options ⇒ Object
The int representing the options used to generate the barcode, defined in the library as:
- PDF417_USE_ASPECT_RATIO
-
use aspectRatio to set the y/x dimension. Also uses yHeight
- PDF417_FIXED_RECTANGLE
-
make the barcode dimensions at least codeColumns by codeRows
- PDF417_FIXED_COLUMNS
-
make the barcode dimensions at least codeColumns
- PDF417_FIXED_ROWS
-
make the barcode dimensions at least codeRows
- PDF417_AUTO_ERROR_LEVEL
-
automatic error level depending on text size
- PDF417_USE_ERROR_LEVEL
-
the error level is errorLevel. The used errorLevel may be different
- PDF417_USE_RAW_CODEWORDS
-
use codewords instead of text
- PDF417_INVERT_BITMAP
-
invert the resulting bitmap
For example
b. = PDF417::PDF417_INVERT_BITMAP | PDF417::PDF417_AUTO_ERROR_LEVEL
33 34 35 |
# File 'lib/pdf417/lib.rb', line 33 def @generation_options end |
#raw_codewords ⇒ Object
The int representing the options used to generate the barcode, defined in the library as:
- PDF417_USE_ASPECT_RATIO
-
use aspectRatio to set the y/x dimension. Also uses yHeight
- PDF417_FIXED_RECTANGLE
-
make the barcode dimensions at least codeColumns by codeRows
- PDF417_FIXED_COLUMNS
-
make the barcode dimensions at least codeColumns
- PDF417_FIXED_ROWS
-
make the barcode dimensions at least codeRows
- PDF417_AUTO_ERROR_LEVEL
-
automatic error level depending on text size
- PDF417_USE_ERROR_LEVEL
-
the error level is errorLevel. The used errorLevel may be different
- PDF417_USE_RAW_CODEWORDS
-
use codewords instead of text
- PDF417_INVERT_BITMAP
-
invert the resulting bitmap
For example
b. = PDF417::PDF417_INVERT_BITMAP | PDF417::PDF417_AUTO_ERROR_LEVEL
33 34 35 |
# File 'lib/pdf417/lib.rb', line 33 def raw_codewords @raw_codewords end |
#text ⇒ Object
The int representing the options used to generate the barcode, defined in the library as:
- PDF417_USE_ASPECT_RATIO
-
use aspectRatio to set the y/x dimension. Also uses yHeight
- PDF417_FIXED_RECTANGLE
-
make the barcode dimensions at least codeColumns by codeRows
- PDF417_FIXED_COLUMNS
-
make the barcode dimensions at least codeColumns
- PDF417_FIXED_ROWS
-
make the barcode dimensions at least codeRows
- PDF417_AUTO_ERROR_LEVEL
-
automatic error level depending on text size
- PDF417_USE_ERROR_LEVEL
-
the error level is errorLevel. The used errorLevel may be different
- PDF417_USE_RAW_CODEWORDS
-
use codewords instead of text
- PDF417_INVERT_BITMAP
-
invert the resulting bitmap
For example
b. = PDF417::PDF417_INVERT_BITMAP | PDF417::PDF417_AUTO_ERROR_LEVEL
33 34 35 |
# File 'lib/pdf417/lib.rb', line 33 def text @text end |
#y_height=(value) ⇒ Object (writeonly)
The following are read from the last generated barcode, but they need a writer because they get set
35 36 37 |
# File 'lib/pdf417/lib.rb', line 35 def y_height=(value) @y_height = value end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/pdf417/lib.rb', line 36 def inspect # :nodoc: attributes = inspect_attributes.reject { |x| begin attribute = send x !attribute || (attribute.respond_to?(:empty?) && attribute.empty?) rescue NoMethodError true end }.map { |attribute| "#{attribute.to_s}=#{send(attribute).inspect}" }.join ' ' "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{attributes}>" end |