Prawn/Labels: A simple helper to generate labels for Prawn PDFs
Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 75 commits behind jordanbyron:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
lib/prawn
COPYING
LICENSE
README

README

== Prawn/Labels: A simple helper to generate labels for Prawn PDFs

Prawn/Labels takes the guess work out of generating labels using Prawn

== Usage
  
  require 'prawn/labels'

  names = ["Jordan", "Chris", "Jon", "Mike", "Kelly", "Bob", "Greg"]

  # Create and save a PDF file
  Prawn::Labels.generate("names.pdf", names, :type => "Avery5160") do |pdf, name|
    pdf.text name
  end

  # Render a PDF file and send to browser
  labels = Prawn::Labels.render(names, :type => "Avery5160") do |pdf, name|
    pdf.text name
  end
  send_data labels, :filename => "names.pdf", :type => "application/pdf"

This creates a document with a name from the names array in each label. The labels will be formatted for Avery 5160 labels. Formats are defined in the prawn/labels/types.yaml file.

== Contributors

Jordan Byron <jordan@ducksoupsoftware.com>
David Speake <david@verycleverstuff.co.uk>