Skip to content

Instantly share code, notes, and snippets.

@kevinprince
Created September 12, 2011 23:04
Show Gist options
  • Save kevinprince/1212725 to your computer and use it in GitHub Desktop.
Save kevinprince/1212725 to your computer and use it in GitHub Desktop.
badges in ruby
require "prawn"
require "prawn/measurement_extensions"
Prawn::Document.generate("hello.pdf",
:page_size => "A5",
:page_layout => :landscape,
:margin => 0.mm
) do
bounding_box [0.mm, 148.mm], :width => 105.mm, :height => 148.mm do
bounding_box [5.mm, 105.mm], :width => 105.mm, :height => 220.mm do
font("Helvetica", :size => 36) do
text "Johnaton", :style => :bold
text "Doedeer", :style => :bold
end
font("Helvetica", :size => 16) do
text "@jdoe"
end
end
bounding_box [0.mm, 20.mm], :width => 95.mm, :height => 100.mm do
image "barcodes/barcode.png", :position => :right, :width => 40.mm, :height => 10.mm
end
end
bounding_box [105.mm, 148.mm], :width => 105.mm, :height => 148.mm do
bounding_box [5.mm, 105.mm], :width => 105.mm, :height => 220.mm do
font("Helvetica", :size => 36) do
text "Johnaton", :style => :bold
text "Doedeer", :style => :bold
end
font("Helvetica", :size => 16) do
text "@jdoe"
end
end
bounding_box [0.mm, 20.mm], :width => 95.mm, :height => 100.mm do
image "barcodes/barcode.png", :position => :right, :width => 40.mm, :height => 10.mm
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment