Rabels Library

Rabels is a ruby library that provides the ability to create a PDF file of mailing labels. The Rabels::Address and Rabels::LabelSpecification classes are populated by the user and passed into the create_labels method as parameters. Rabels requires the pdf-writer library to actually generate the PDF.


Rabels is a dead project. You should use pdf-labels instead. It’s much better, as it comes pre-configured with a bunch of label types, and its API lets you put anything you want on the label (not just an address).


# Create an address that Rabels can use
address = Rabels::Address.new(
  :addressee => 'Mr. & Mrs. John and Jane Doe and Family',
  :address_line_1 => '12345 Mockingbird Lane',
  :city => 'Chicago',
  :state => 'IL',
  :zip => '60606')

# Dump 10 of these addresses into an Array
addresses = []
10.times { addresses << address }

# Create some specifications for the labels, specifying sizes in inches
label_spec = Rabels::LabelSpecification.new(
  :page_margin_top => 0.5,
  :page_margin_bottom => 0.5,
  :page_margin_left => 0.15625,
  :page_margin_right => 0.15625,
  :label_width => 2.625,
  :label_height => 1,
  :label_font => 'Times-Roman',
  :label_font_size => 10,
  :label_font_color => Color::RGB::Black,
  :label_justification => :center)

# Create the PDF
Rabels.create_labels(addresses, label_spec, 'test.pdf')

# Create a new PDF, using the pre-configured specs for the 
# Avery 8660 label