Created
August 6, 2012 19:04
-
-
Save kgrz/3277585 to your computer and use it in GitHub Desktop.
Generates a PDF documents using the Prawn Library. This was before I came across this __EPIC__ demo of Prawn https://gist.github.com/441285. And everything changed from this point onwards and I stopped writing more of this nonsensical code.
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
# 18th Feb 2012 | |
require 'prawn' | |
Prawn::Document.generate("Form A2.pdf", :page_size => "A4", :page_layout => :portrait) do |pdf| | |
pdf.font "Times-Roman" | |
pdf.font_size 10 | |
pdf.text "Form A2" | |
pdf.text "Application cum Declaration" | |
pdf.text "(To be completed by the applicant)" | |
pdf.text "" | |
pdf.text "Application for drawal of foreign exchange" | |
pdf.pad_bottom(5) { pdf.text ""} | |
pdf.bounding_box([0, pdf.cursor], :width => 500, :height => 300) do | |
y = pdf.cursor | |
pdf.bounding_box([10, y], :width => 10) do | |
pdf.text "I" | |
end | |
pdf.bounding_box([50, y], :width => 480) do | |
pdf.text "Details of the applicant -" | |
pdf.text "a) Name:" | |
pdf.text "b) Address:" | |
pdf.text "c) Account Number:" | |
end | |
pdf.pad(5) { pdf.text ""} | |
y = pdf.cursor | |
pdf.bounding_box([10, y], :width => 10) do | |
pdf.text "II" | |
end | |
pdf.bounding_box([50, y], :width => 480) do | |
pdf.text "Details of the foreign exchange required -" | |
pdf.text "a) Amount:" | |
pdf.text "b) Currency:" | |
pdf.text "c) Purpose:" | |
end | |
pdf.pad(5) { pdf.text ""} | |
y = pdf.cursor | |
pdf.bounding_box([10, y], :width => 10, :height => 30) do | |
pdf.text "III" | |
end | |
pdf.bounding_box([50, y], :width => 480) do | |
pdf.text "I authorise you to debit my Savings Bank/Current/RFC/EEFC Account" + | |
" number................. together with your charges and" | |
pdf.text "a) Amount:" | |
pdf.text "b) Currency:" | |
pdf.text "c) Purpose:" | |
end | |
pdf.pad(5) { pdf.text ""} | |
end | |
pdf.text "#{pdf.cursor}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment