File: README.md

package info (click to toggle)
ruby-barby 0.6.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 512 kB
  • sloc: ruby: 4,133; java: 1,228; makefile: 7
file content (108 lines) | stat: -rw-r--r-- 4,870 bytes parent folder | download
1
2
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Barby
Barby is a Ruby library that generates barcodes in a variety of symbologies.

Its functionality is split into _barcode_ and "_outputter_" objects:
  * [`Barby::Barcode` objects] [symbologies] turn data into a binary representation for a given symbology.
  * [`Barby::Outputter`] [outputters] then takes this representation and turns it into images, PDF, etc.

You can easily add a symbology without having to worry about graphical
representation. If it can be represented as the usual 1D or 2D matrix of
lines or squares, outputters will do that for you.

Likewise, you can easily add an outputter for a format that doesn't have one
yet, and it will work with all existing symbologies.

For more information, check out [the Barby wiki][wiki].


### New require policy

Barcode symbologies are no longer required automatically, so you'll have to
require the ones you need.

If you need EAN-13, `require 'barby/barcode/ean_13'`. Full list of symbologies and filenames below.

## Example

```ruby
require 'barby'
require 'barby/barcode/code_128'
require 'barby/outputter/ascii_outputter'

barcode = Barby::Code128B.new('BARBY')

puts barcode.to_ascii #Implicitly uses the AsciiOutputter

## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
## #    #  #   # ##   # #   ##   ##   # ### #   # ##   ### ## #   ## ### ### ##   ### # ##
          B          A          R          B          Y
```

## Supported symbologies

```ruby
require 'barby/barcode/<filename>'
```

| Name                                | Filename              | Dependencies                       |
| ----------------------------------- | --------------------- | ---------------------------------- |
| Code 25                             | `code_25`             | ─                                  |
| ├─ Interleaved                      | `code_25_interleaved` | ─                                  |
| └─ IATA                             | `code_25_iata`        | ─                                  |
| Code 39                             | `code_39`             | ─                                  |
| └─ Extended                         | `code_39`             | ─                                  |
| Code 93                             | `code_93`             | ─                                  |
| Code 128 (A, B, and C)              | `code_128`            | ─                                  |
| └─ GS1 128                          | `gs1_128`             | ─                                  |
| EAN-13                              | `ean_13`              | ─                                  |
| ├─ Bookland                         | `bookland`            | ─                                  |
| └─ UPC-A                            | `ean_13`              | ─                                  |
| EAN-8                               | `ean_8`               | ─                                  |
| UPC/EAN supplemental, 2 & 5 digits  | `upc_supplemental`    | ─                                  |
| QR Code                             | `qr_code`             | `rqrcode`                          |
| DataMatrix (Semacode)               | `data_matrix`         | `semacode` or `semacode-ruby19`    |
| PDF417                              | `pdf_417`             | JRuby                              |


## Outputters

```ruby
require 'barby/outputter/<filename>_outputter'
```

| filename    | dependencies  |
| ----------- | ------------- |
| `ascii`     | ─             |
| `cairo`     | cairo         |
| `html`      | ─             |
| `pdfwriter` | ─             |
| `png`       | chunky_png    |
| `prawn`     | prawn         |
| `rmagick`   | rmagick       |
| `svg`       | ─             |

### Formats supported by outputters

* Text (mostly for testing)
* PNG, JPEG, GIF
* PS, EPS
* SVG
* PDF
* HTML

---

For more information, check out [the Barby wiki][wiki].


  [wiki]: https://github.com/toretore/barby/wiki
  [symbologies]: https://github.com/toretore/barby/wiki/Symbologies
  [outputters]: https://github.com/toretore/barby/wiki/Outputters