Skip to content

Instantly share code, notes, and snippets.

@co-hack
Created November 3, 2009 05:20
Show Gist options
  • Save co-hack/224821 to your computer and use it in GitHub Desktop.
Save co-hack/224821 to your computer and use it in GitHub Desktop.
def wrap_it(&block)
new_pdf = ConsoloPdf.new
beginning_y = new_pdf.y
yield new_pdf
new_pdf_height = beginning_y - new_pdf.y
self.start_new_page if self.y < new_pdf_height
yield self
end
## to use
pdf.wrap_it do |group|
group.h1 "Some Header info"
## display table is a helper that I have created
group.display_table(other_clinical_data)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment