Skip to content

Instantly share code, notes, and snippets.

@kylekeesling
Created November 15, 2013 03:07
Show Gist options
  • Save kylekeesling/7478473 to your computer and use it in GitHub Desktop.
Save kylekeesling/7478473 to your computer and use it in GitHub Desktop.
How to Generate a Prawn PDF class with a repeating footer
class KylesSuperCoolPdf < Prawn::Document
def initialize
super()
repeat :all do
#Create a bounding box and move it up 18 units from the bottom boundry of the page
bounding_box [bounds.left, bounds.bottom + 18], width: bounds.width do
text "Probably the Best Footer Ever", size: 8, align: :center
end
end
#Create another box that is placed on the page after our footer is
bounding_box [bounds.left, bounds.top], width: bounds.width, height: bounds.height - 16 do
#Generate the rest of your PDF content here
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment