Skip to content

Instantly share code, notes, and snippets.

@wesmaldonado
Created February 6, 2009 17:45
Show Gist options
  • Save wesmaldonado/59521 to your computer and use it in GitHub Desktop.
Save wesmaldonado/59521 to your computer and use it in GitHub Desktop.
require "rubygems"
require "prawn"
require "prawn/measurement_extensions"
Prawn::Document.generate("badge_printing.pdf", :margin_top => 0.5.in) do
# our start_x position for the columns
[0.5, 4].each do |column_width|
# spacing between each "badge"
move_down 0.5.in
5.times do
bounding_box [column_width.in, cursor], :width => 3.0.in, :height => 1.5.in do
# do what you want within this box
move_down bounds.height/2
font_size 16
text "John Smith", :align => :center
font_size 12
text "job title", :align => :center
text "\"personal quote\"", :align => :center
stroke_bounds
end
stroke_bounds
# spacing between the badges
move_down 0.3.in
end
# next column, back to the top
move_up bounds.top - cursor
end
end
`open badge_printing.pdf`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment