Created
November 15, 2013 03:07
-
-
Save kylekeesling/7478473 to your computer and use it in GitHub Desktop.
How to Generate a Prawn PDF class with a repeating footer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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